summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e3fea6bd2f29dedf1b439c8ee42929e92efdc6bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgname=cowrie-git
pkgver=1.1.0+1352+115ccd6
pkgrel=2
pkgdesc='Medium interaction SSH honeypot designed to log brute force attacks and entire shell interaction'
url='https://github.com/micheloosterhof/cowrie'
arch=('any')
license=('BSD')
depends=('python2-twisted' 'python2-zope-interface' 'python2-crypto' 'python2-pyasn1' 'python2-cryptography'
         'python2-gmpy2' 'python2-pyopenssl' 'mysql-python' 'python2-dateutil' 'python2-tftpy'
         'python2-configparser' 'python2-service-identity' 'python2-requests')
makedepends=('git')
backup=('etc/cowrie.cfg')
provides=('cowrie')
conflicts=('cowrie')
install=cowrie.install
source=(${pkgname}::git+https://github.com/micheloosterhof/cowrie.git)
sha512sums=('SKIP')

pkgver() {
  cd ${pkgname}
  printf "%s+%s+%s" "$(git describe --tags --abbrev=0|sed -r 's|v?([^-]+).*|\1|')" \
    "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd ${pkgname}
  sed -e 's|env python$|env python2|g' -i bin/* cowrie/commands/tftp.py
  sed -e 's|/home/cowrie|/opt|g' -i doc/systemd/cowrie.service
  sed -e '/PIDFile/d' -i doc/systemd/cowrie.service
  sed -r 's|(cowrie)$|\1 -c /etc/cowrie.cfg|g' -i start.sh
}

build() {
  cd ${pkgname}
  python2 -m compileall .
  python2 -O -m compileall .
}

package() {
  cd ${pkgname}

  install -Dm 644 cowrie.cfg.dist "${pkgdir}/etc/cowrie.cfg"
  install -Dm 644 doc/systemd/cowrie.service -t "${pkgdir}/usr/lib/systemd/system"

  install -d "${pkgdir}/opt/cowrie"
  cp -a . "${pkgdir}/opt/cowrie"
  rm -r "${pkgdir}/opt/cowrie/"{.git,cowrie.cfg.dist}

  install -Dm 644 doc/COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  install -Dm 644 README.md INSTALL.md CHANGELOG.md -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: ts=2 sw=2 et: