Skip to content

Commit

Permalink
wireshark-extcap: wrap wireshark with extcap programs
Browse files Browse the repository at this point in the history
  • Loading branch information
mrene committed Aug 10, 2024
1 parent 4b24372 commit 8de6878
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkgs/default/ieee-802-15-4-sniffer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This implements an ieee 802.15.4 sniffer in the 2.4ghz band using O-QPSK demod. The main entrypoint implements the wireshark extcap protocol, which will make it appear in the list of interfaces if it's located in its `lib/extpath` folder, or if it's referenced by `WIRESHARK_EXTCAP_DIR`.
1 change: 1 addition & 0 deletions pkgs/default/wireshark-extcap/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The default Wireshark only looks for extcap programs within a few specific locations, this creates a wrapper in order to expose specific extcap programs to Wireshark.
40 changes: 40 additions & 0 deletions pkgs/default/wireshark-extcap/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ lib
, wireshark
, symlinkJoin
, makeWrapper
, onlyBin
, extCapPackages ? []

# Whether to include the extcap binaries provided by this repository
, includeExtCaps ? true
, ieee-802-15-4-sniffer ? null
, ice9-bluetooth-sniffer ? null
}:

let
extCapDir = symlinkJoin {
name = "wireshark-extcap-dir";
paths = lib.optionals includeExtCaps [ ieee-802-15-4-sniffer ice9-bluetooth-sniffer ] ++ extCapPackages;
postBuild = ''
# Link the builtin extcap programs because wireshark doesn't look in its own lib directory
# if the env var is set
cp -vs ${wireshark}/lib/wireshark/extcap/* $out/bin
# Some programs might've been wrapped and have a hidden `.orig.wrapped` file that we don't want
# wireshark calling into
rm -f $out/bin/.[!.]*
'';
};
in

symlinkJoin {
name = "wireshark-wrapped";
paths = [ wireshark ];
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
for file in $out/bin/*; do
wrapProgram $file --prefix WIRESHARK_EXTCAP_DIR : ${onlyBin extCapDir}/bin
done
'';
meta = wireshark.meta;
}

0 comments on commit 8de6878

Please sign in to comment.