diff --git a/pkgs/default/ieee-802-15-4-sniffer/README.md b/pkgs/default/ieee-802-15-4-sniffer/README.md new file mode 100644 index 0000000..a81a252 --- /dev/null +++ b/pkgs/default/ieee-802-15-4-sniffer/README.md @@ -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`. diff --git a/pkgs/default/wireshark-extcap/README.md b/pkgs/default/wireshark-extcap/README.md new file mode 100644 index 0000000..c5ed32b --- /dev/null +++ b/pkgs/default/wireshark-extcap/README.md @@ -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. \ No newline at end of file diff --git a/pkgs/default/wireshark-extcap/package.nix b/pkgs/default/wireshark-extcap/package.nix new file mode 100644 index 0000000..f2fe56c --- /dev/null +++ b/pkgs/default/wireshark-extcap/package.nix @@ -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; +} \ No newline at end of file