-
-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sparrow-wifi: init at unstable-2024-01-18
- Loading branch information
Showing
1 changed file
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; | ||
} |