Skip to content

Commit 0b098ce

Browse files
committed
Add ngrep package - network layer grep tool
Adds ngrep v1.48.0 - PCAP-based pattern matching tool for network packets with required SBUILD header and fields. Claude Code was used to format this file.
1 parent 83aaae2 commit 0b098ce

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/SBUILD ver @v1.0.0
2+
#SELF: https://raw.githubusercontent.com/pkgforge/soarpkgs/refs/heads/main/binaries/ngrep/static.official.stable.yaml
3+
_disabled: false
4+
5+
pkg: "ngrep"
6+
pkg_id: "github.com.jpr5.ngrep"
7+
pkg_type: "static"
8+
category:
9+
- "ConsoleOnly"
10+
- "Network"
11+
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."
12+
homepage:
13+
- "https://github.com/jpr5/ngrep"
14+
license:
15+
- id: "BSD"
16+
url: "https://github.com/jpr5/ngrep/raw/master/LICENSE"
17+
maintainer:
18+
- "ryancnelson (https://github.com/ryancnelson)"
19+
note:
20+
- "[DO NOT RUN] (Meant for pkgforge CI Only)"
21+
- "Pre Built Binary Fetched from Upstream. Check/Report @ https://github.com/jpr5/ngrep"
22+
provides:
23+
- "ngrep"
24+
src_url:
25+
- "https://github.com/jpr5/ngrep"
26+
tag:
27+
- "grep"
28+
- "network"
29+
- "packet"
30+
- "pcap"
31+
- "sniffer"
32+
33+
x_exec:
34+
bsys: "host://soar-dl"
35+
host:
36+
- "aarch64-Linux"
37+
- "x86_64-Linux"
38+
shell: "bash"
39+
pkgver: |
40+
curl -qfsSL 'https://api.github.com/repos/jpr5/ngrep/releases/latest' | jq -r '.tag_name' | tr -d 'v'
41+
run: |
42+
#Download
43+
case "$(uname -m)" in
44+
aarch64)
45+
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
46+
;;
47+
x86_64)
48+
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
49+
;;
50+
esac
51+
#Extract
52+
while E_X=$(find "${SBUILD_TMPDIR}" -type f -exec file -i "{}" + |
53+
grep -Ei "archive|compressed|gzip|x-compress|x-tar" |
54+
grep -iv "application/.*executable" |
55+
cut -d: -f1 | head -n1); [ -n "${E_X}" ]
56+
do
57+
7z e "${E_X}" -o"${SBUILD_TMPDIR}/." -y && {
58+
file -i "${E_X}" | grep -q "application/.*executable" && break
59+
rm -f "${E_X}"
60+
} || break
61+
done
62+
#Copy
63+
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)