Skip to content

Commit 5ffafb1

Browse files
committed
Add ngrep package - network layer grep tool
Adds ngrep v1.48.0 - PCAP-based pattern matching tool for network packets
1 parent 83aaae2 commit 5ffafb1

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
pkg: "ngrep"
2+
3+
description: "ngrep is like GNU grep applied to the network layer. It's a PCAP-based tool that allows you to specify an extended regular or hexadecimal expression to match against data payloads of packets."
4+
5+
src_url:
6+
- "https://github.com/jpr5/ngrep"
7+
8+
x_exec:
9+
bsys: "host://soar-dl"
10+
host:
11+
- "aarch64-Linux"
12+
- "x86_64-Linux"
13+
shell: "bash"
14+
pkgver: |
15+
curl -qfsSL 'https://api.github.com/repos/jpr5/ngrep/releases/latest' | jq -r '.tag_name' | tr -d 'v'
16+
run: |
17+
#Download
18+
case "$(uname -m)" in
19+
aarch64)
20+
soar dl "https://github.com/jpr5/ngrep@v${PKGVER}" --match "linux,arm64,tar" --exclude "full,sha,bsd,macos,windows,freebsd,netbsd,openbsd,solaris" -o "${SBUILD_TMPDIR}/${PKG}.archive" --yes
21+
;;
22+
x86_64)
23+
soar dl "https://github.com/jpr5/ngrep@v${PKGVER}" --match "linux,x86_64,tar" --exclude "full,sha,bsd,macos,windows,freebsd,netbsd,openbsd,solaris" -o "${SBUILD_TMPDIR}/${PKG}.archive" --yes
24+
;;
25+
esac
26+
#Extract
27+
while E_X=$(find "${SBUILD_TMPDIR}" -type f -exec file -i "{}" + |
28+
grep -Ei "archive|compressed|gzip|x-compress|x-tar" |
29+
grep -iv "application/.*executable" |
30+
cut -d: -f1 | head -n1); [ -n "${E_X}" ]
31+
do
32+
7z e "${E_X}" -o"${SBUILD_TMPDIR}/." -y && {
33+
file -i "${E_X}" | grep -q "application/.*executable" && break
34+
rm -f "${E_X}"
35+
} || break
36+
done
37+
#Copy
38+
find "${SBUILD_TMPDIR}" -maxdepth 1 -type f -exec file -i "{}" \; | grep -Ei "application/.*executable|inode/symlink|text/x-perl|text/.*script" | cut -d":" -f1 | xargs realpath --no-symlinks | xargs -I "{}" rsync -achvL "{}" "${SBUILD_OUTDIR}"

0 commit comments

Comments
 (0)