summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO23
-rw-r--r--PKGBUILD40
-rw-r--r--nethogs.service24
-rwxr-xr-xnethogst.sh2
4 files changed, 89 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..12b8df7a1214
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,23 @@
+pkgbase = nethogs-parser-git
+ pkgdesc = A parser to summarize the nethogs trace mode output + nethogs.service that outputs logs in /var/lib/nethogs
+ pkgver = r28.b465721
+ pkgrel = 1
+ url = https://github.com/boopathi/nethogs-parser.git
+ arch = x86_64
+ license = MIT
+ makedepends = git
+ makedepends = go
+ depends = nethogs
+ provides = nethogs-parser
+ provides = nethogst
+ conflicts = nethogs-parser
+ conflicts = nethogst
+ source = git+https://github.com/boopathi/nethogs-parser.git
+ source = nethogst.sh
+ source = nethogs.service
+ md5sums = SKIP
+ md5sums = 43e0fd92f60bf28c4213569006d9e20a
+ md5sums = 6c240522737c0ed56cba6703c865f81c
+
+pkgname = nethogs-parser-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..5b7c8febdbc3
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,40 @@
+# Maintainer: Mahor1221 <mahorforuzesh at protonmail dot com>
+_pkgname=nethogs-parser
+pkgname=${_pkgname}-git
+pkgver=r28.b465721
+pkgrel=1
+pkgdesc="A parser to summarize the nethogs trace mode output + nethogs.service that outputs logs in /var/lib/nethogs"
+arch=('x86_64')
+url="https://github.com/boopathi/nethogs-parser.git"
+license=('MIT')
+depends=("nethogs")
+makedepends=("git" "go")
+provides=("${_pkgname}" "nethogst")
+conflicts=("${_pkgname}" "nethogst")
+source=(
+ "git+${url}"
+ "nethogst.sh"
+ "nethogs.service"
+)
+md5sums=('SKIP'
+ '43e0fd92f60bf28c4213569006d9e20a'
+ '6c240522737c0ed56cba6703c865f81c')
+
+pkgver() {
+ cd "${_pkgname}"
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+}
+
+build() {
+ cd "${_pkgname}"
+ go build -o ${_pkgname} hogs.go
+}
+
+package() {
+ mkdir -p /var/lib/nethogs
+ install -Dm755 "nethogst.sh" "${pkgdir}/usr/bin/nethogst"
+ install -Dm777 "nethogs.service" "${pkgdir}/etc/systemd/system/nethogs.service"
+
+ cd "${_pkgname}"
+ install -Dm755 ${_pkgname} "${pkgdir}/usr/bin/"
+} \ No newline at end of file
diff --git a/nethogs.service b/nethogs.service
new file mode 100644
index 000000000000..dbc07459fb76
--- /dev/null
+++ b/nethogs.service
@@ -0,0 +1,24 @@
+[Unit]
+Description=nethogs tracemode service
+Wants=network-online.target
+After=network-online.target
+
+[Service]
+ExecStart=/usr/bin/nethogst
+
+# Hardening
+ProtectSystem=strict
+ReadWritePaths=/var/lib
+StateDirectory=nethogs
+PrivateDevices=yes
+ProtectKernelTunables=yes
+ProtectControlGroups=yes
+ProtectHome=yes
+ProtectKernelModules=yes
+PrivateTmp=yes
+MemoryDenyWriteExecute=yes
+RestrictRealtime=yes
+RestrictNamespaces=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/nethogst.sh b/nethogst.sh
new file mode 100755
index 000000000000..98d3c49e7e0f
--- /dev/null
+++ b/nethogst.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/nethogs -t > var/lib/nethogs/$(/usr/bin/date +%Y-%m-%d_%H-%M-%S).log