Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sparrow-wifi: init at unstable-2024-01-18 #259584

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions pkgs/by-name/sp/sparrow-wifi/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{ lib
, python3
, fetchFromGitHub
, qt5
, gpsd
, stdenv
, usbutils
, wirelesstools
, iw
, bluez
, ubertooth
, aircrack-ng
, john
, copyDesktopItems
, imagemagick
, makeDesktopItem
}:

python3.pkgs.buildPythonApplication rec {
pname = "sparrow-wifi";
version = "unstable-2024-01-18";
format = "other";

src = fetchFromGitHub {
owner = "ghostop14";
repo = "sparrow-wifi";
rev = "f9a39210eed9141707760ffd4fb31e79f991a15c";
sha256 = "sha256-62RAfSqjmAO1kNIFQnwJN3wh7XItFWYnXV8ZCP5IUhg=";
};

buildInputs = [
usbutils
gpsd
wirelesstools
bluez
aircrack-ng
john
iw
ubertooth
];

nativeBuildInputs = [ qt5.wrapQtAppsHook copyDesktopItems imagemagick ];

propagatedBuildInputs = with python3.pkgs; [
gps3
python-dateutil
requests
pyqt5
pyqtchart
numpy
matplotlib
manuf
elasticsearch
elastic-transport
pytz
] ++ lib.singleton qt5.qtwayland;

dontBuild = true;

postPatch = ''
patchShebangs .

substituteInPlace sparrow-wifi.py \
--replace "/usr/bin/xgps" "${gpsd}/bin/xgps"

substituteInPlace sparrowbluetooth.py \
--replace "/usr/bin/ubertooth-specan" "${ubertooth}/bin/ubertooth-specan"

substituteInPlace sparrowgps.py \
--replace "/usr/sbin/gpsd" "${gpsd}/sbin/gpsd"

substituteInPlace plugins/falconwifi.py \
--replace "/usr/sbin/airodump-ng" "${aircrack-ng}/sbin/airodump-ng" \
--replace "/usr/bin/aircrack-ng" "${aircrack-ng}/bin/aircrack-ng" \
--replace "/usr/bin/wpapcap2john" "${john}/bin/wpapcap2john"

substituteInPlace plugins/falconwifidialogs.py \
--replace "/usr/sbin/airodump-ng" "${aircrack-ng}/sbin/airodump-ng" \
--replace "/usr/bin/aircrack-ng" "${aircrack-ng}/bin/aircrack-ng" \
--replace "/usr/bin/wpapcap2john" "${john}/bin/wpapcap2john"
'';

installPhase = ''
runHook preInstall

mkdir -p $out/lib/sparrow-wifi/
cp -r . $out/lib/sparrow-wifi/
mkdir $out/bin

makeWrapper ${python3.interpreter} $out/bin/sparrow-wifi \
--add-flags "-O $out/lib/sparrow-wifi/sparrow-wifi.py" \
--prefix PATH : "${lib.makeBinPath [ usbutils gpsd wirelesstools bluez aircrack-ng john iw ]}" \
--prefix PYTHONPATH : "$PYTHONPATH" \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ stdenv.cc.cc.lib ]} \
--chdir "$out/lib/sparrow-wifi/" \
''${makeWrapperArgs[@]} \
''${qtWrapperArgs[@]}

makeWrapper ${python3.interpreter} $out/bin/sparrowwifiagent \
--add-flags "-O $out/lib/sparrow-wifi/sparrowwifiagent.py" \
--prefix PATH : "${lib.makeBinPath [ usbutils gpsd wirelesstools bluez aircrack-ng john iw ]}" \
--prefix PYTHONPATH : "$PYTHONPATH" \
--chdir "$out/lib/sparrow-wifi/" \
''${makeWrapperArgs[@]} \
''${qtWrapperArgs[@]}

makeWrapper ${python3.interpreter} $out/bin/sparrow-elastic \
--add-flags "-O $out/lib/sparrow-wifi/sparrow-elastic.py" \
--prefix PATH : "${lib.makeBinPath [ usbutils gpsd wirelesstools bluez aircrack-ng john iw ]}" \
--prefix PYTHONPATH : "$PYTHONPATH" \
--chdir "$out/lib/sparrow-wifi/" \
''${makeWrapperArgs[@]} \
''${qtWrapperArgs[@]}

runHook postInstall
'';

dontWrapQtApps = true;

doCheck = false;

postInstall = ''
# Generate and install icon files
for size in 16 32 48 64 72 96 128 192 512 1024; do
mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
convert wifi_icon.png -sample "$size"x"$size" \
-background white -gravity south -extent "$size"x"$size" \
$out/share/icons/hicolor/"$size"x"$size"/apps/wifi_icon.png
done
'';

desktopItems = [
(makeDesktopItem {
name = "Sparrow WiFi";
desktopName = "Sparrow WiFi";
exec = "sparrow-wifi";
comment = meta.description;
icon = "wifi_icon";
categories = [ "Network" ];
})
];

meta = with lib; {
homepage = "https://github.com/ghostop14/sparrow-wifi";
description = "Next-Gen GUI-based WiFi and Bluetooth Analyzer for Linux";
mainProgram = "sparrow-wifi";
license = licenses.gpl3;
maintainers = with maintainers; [ dsuetin ];
platforms = platforms.linux;
};
}