Skip to content

Instantly share code, notes, and snippets.

@PedroHLC
Last active May 23, 2022 20:35
Show Gist options
  • Save PedroHLC/e6cefa4dce6474d27f3a91f4ff929a67 to your computer and use it in GitHub Desktop.
Save PedroHLC/e6cefa4dce6474d27f3a91f4ff929a67 to your computer and use it in GitHub Desktop.
diff --git a/pkgs/tools/networking/airgeddon/default.nix b/pkgs/tools/networking/airgeddon/default.nix
index c364d56a5df..07f0f5cad06 100644
--- a/pkgs/tools/networking/airgeddon/default.nix
+++ b/pkgs/tools/networking/airgeddon/default.nix
@@ -1,7 +1,7 @@
{ lib
, stdenv
, fetchFromGitHub
-, makeWrapper
+, resholve
# Required
, aircrack-ng
, bash
@@ -51,9 +51,9 @@
, networkmanager
, systemd
# Support groups
-, supportWpaWps ? true # Most common use-case
-, supportHashCracking ? false
-, supportEvilTwin ? false
+, supportWpaWps ? true
+, supportHashCracking ? true
+, supportEvilTwin ? true
, supportX11 ? false # Allow using xterm instead of tmux, hard to test
}:
let
@@ -106,8 +106,30 @@ let
xorg.xset
xorg.xdpyinfo
]);
+
+ disabledOptionalsCommands =
+ (lib.optionals (supportWpaWps != true) [
+ "bully"
+ "reaver"
+ "wash"
+ ]) ++ (lib.optionals (supportHashCracking != true) [
+ "hashcat"
+ "hcxdumptool"
+ "hcxpcapngtool"
+ "john"
+ "tshark"
+ ]) ++ (lib.optionals (supportEvilTwin != true) [
+ "bettercap"
+ "openssl"
+ "apparmor_status"
+ "etterlog"
+ ]) ++ (lib.optionals (supportX11 != true) [
+ "xdpyinfo"
+ "xset"
+ "xterm"
+ ]);
in
-stdenv.mkDerivation rec {
+resholve.mkDerivation rec {
pname = "airgeddon";
version = "11.01";
@@ -118,17 +140,14 @@ stdenv.mkDerivation rec {
sha256 = "3TjaLEcerRk69Ys4kj7vOMCRUd0ifFJzL4MB5ifoK68=";
};
- strictDeps = true;
- nativeBuildInputs = [ makeWrapper ];
-
# What these replacings do?
# - Disable the auto-updates (we'll run from a read-only directory);
# - Silence the checks (NixOS will enforce the PATH, it will only see the tools as we listed);
- # - Use "tmux", we're not patching XTerm commands;
+ # - Use "tmux" by default
# - Remove PWD and $0 references, forcing it to use the paths from store;
- # - Force our PATH to all tmux sessions.
+ # - Bypass https://github.com/oilshell/oil/issues/606 that affects resholve;
+ # - Hard resolve rc file.
postPatch = ''
- patchShebangs airgeddon.sh
sed -i '
s|AIRGEDDON_AUTO_UPDATE=true|AIRGEDDON_AUTO_UPDATE=false|
s|AIRGEDDON_SILENT_CHECKS=false|AIRGEDDON_SILENT_CHECKS=true|
@@ -136,26 +155,98 @@ stdenv.mkDerivation rec {
' .airgeddonrc
sed -Ei '
- s|\$\(pwd\)|${placeholder "out"}/share/airgeddon;scriptfolder=${placeholder "out"}/share/airgeddon/|
+ s|\$\(pwd\)|${placeholder "out"}/share/airgeddon;scriptfolder=${placeholder "out"}/lib/airgeddon/|
s|\$\{0\}|${placeholder "out"}/bin/airgeddon|
- s|tmux send-keys -t "([^"]+)" "|tmux send-keys -t "\1" "export PATH=\\"$PATH\\"; |
+ s|^(.+) =~ ([^\$].+) ]]|regexp='\2'; \1 =~ $regexp ]]|
+ s|\$\{scriptfolder}\$\{rc_file_name}|${placeholder "out"}/share/airgeddon/.airgeddonrc|
' airgeddon.sh
'';
- # ATTENTION: No need to chdir around, we're removing the occurrences of "$(pwd)"
- postInstall = ''
- wrapProgram $out/bin/airgeddon --prefix PATH : ${lib.makeBinPath deps}
- '';
-
# Install only the interesting files
installPhase = ''
- runHook preInstall
install -Dm 755 airgeddon.sh "$out/bin/airgeddon"
+ install -Dm 644 language_strings.sh "$out/lib/airgeddon/language_strings.sh"
+ install -m 644 known_pins.db "$out/lib/airgeddon/known_pins.db"
+ install -Dm 644 plugins/missing_dependencies.sh "$out/lib/airgeddon/plugins/missing_dependencies.sh"
install -dm 755 "$out/share/airgeddon"
- cp -dr --no-preserve='ownership' .airgeddonrc known_pins.db language_strings.sh plugins/ "$out/share/airgeddon/"
- runHook postInstall
+ cp -dr --no-preserve='ownership' .airgeddonrc "$out/share/airgeddon/"
'';
+ solutions = {
+ airgeddon = {
+ interpreter = "${bash}/bin/bash";
+ scripts = [
+ "${placeholder "out"}/bin/airgeddon"
+ "${placeholder "out"}/lib/airgeddon/known_pins.db"
+ "${placeholder "out"}/lib/airgeddon/language_strings.sh"
+ "${placeholder "out"}/lib/airgeddon/plugins/*"
+ ];
+ inputs = deps;
+ keep = {
+ "$option_var_value" = true;
+ "$iptables_cmd" = true;
+ "$hccapx_converter_path" = true;
+ "$prehook_funcion_name" = true;
+ "$funtion_call" = true;
+ "$posthook_funcion_name" = true;
+
+ # Configurable stuff
+ "$AIRGEDDON_DEBUG_MODE" = true;
+ "$AIRGEDDON_DEVELOPMENT_MODE" = true;
+ "$AIRGEDDON_5GHZ_ENABLED" = true;
+ "$AIRGEDDON_SKIP_INTRO" = true;
+ "$AIRGEDDON_BASIC_COLORS" = true;
+ "$AIRGEDDON_EXTENDED_COLORS" = true;
+ "$AIRGEDDON_AUTO_CHANGE_LANGUAGE" = true;
+ "$AIRGEDDON_SILENT_CHECKS" = true;
+ "$AIRGEDDON_PRINT_HINTS" = true;
+ "$AIRGEDDON_FORCE_IPTABLES" = true;
+ "$AIRGEDDON_FORCE_NETWORK_MANAGER_KILLING" = true;
+ "$AIRGEDDON_WINDOWS_HANDLING" = true;
+
+ source = [ "${placeholder "out"}/lib/airgeddon/plugins/missing_dependencies.sh" ];
+ };
+ fix = {
+ source = [ "${placeholder "out"}" ];
+ "$airmon" = [ "airmon-ng" ];
+ "$AIRGEDDON_AUTO_UPDATE" = [ "false" ];
+ "$AIRGEDDON_MDK_VERSION" = [ "mdk4" ];
+ "$AIRGEDDON_PLUGINS_ENABLED" = [ "true" ];
+
+ "$scriptfolder" = [ "${placeholder "out"}/lib/airgeddon/" ];
+ "$language_strings_file" = [ "language_strings.sh" ];
+ "$known_pins_dbfile" = [ "known_pins.db" ];
+
+ # Thank god there is only one plugin
+ "$file" = [ "${placeholder "out"}/lib/airgeddon/plugins/missing_dependencies.sh" ];
+ };
+ fake.external = [ "apt" "pacman" ] # platform-specific external commands in cross-platform conditionals
+ ++ [
+ "service" # This seems to be used to manage the "beef" service, we don't have beef.
+ "ping" # There is not yet a good way to resolve 'ping' in Nix builds.
+ ]
+ ++ disabledOptionalsCommands;
+ execer = [
+ "cannot:${bully}/bin/bully"
+ "cannot:${reaverwps-t6x}/bin/reaver"
+ "cannot:${iproute2}/bin/ss"
+ "cannot:${reaverwps-t6x}/bin/wash"
+ "cannot:${iproute2}/bin/ip"
+ "cannot:${aircrack-ng}/bin/airmon-ng"
+ "cannot:${systemd}/bin/systemctl"
+ "cannot:${ettercap}/bin/etterlog"
+ "cannot:${networkmanager}/bin/NetworkManager"
+ "cannot:${hcxdumptool}/bin/hcxdumptool"
+ "cannot:${bettercap}/bin/bettercap"
+ "cannot:${wireshark-cli}/bin/tshark"
+
+ # These can run their arguments, but their lore is broken
+ "cannot:${tmux}/bin/tmux"
+ "cannot:${coreutils-full}/bin/timeout"
+ ];
+ };
+ };
+
meta = with lib; {
description = "Multi-use TUI to audit wireless networks. ";
homepage = "https://github.com/v1s1t0r1sh3r3/airgeddon";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment