diff --git a/pkgs/tools/networking/reaver-wps-t6x/default.nix b/pkgs/tools/networking/reaver-wps-t6x/default.nix index 59d2b04786da..6e4a5561f07a 100644 --- a/pkgs/tools/networking/reaver-wps-t6x/default.nix +++ b/pkgs/tools/networking/reaver-wps-t6x/default.nix @@ -1,8 +1,9 @@ -{ stdenv, fetchFromGitHub, libpcap, sqlite, pixiewps }: +{ stdenv, fetchFromGitHub, libpcap, sqlite, pixiewps, makeWrapper }: stdenv.mkDerivation rec { version = "1.5.2"; name = "reaver-wps-t6x-${version}"; + confdir = "/var/db/${name}"; # the sqlite database is at "${confdir}/reaver/reaver.db" src = fetchFromGitHub { owner = "t6x"; @@ -11,17 +12,27 @@ stdenv.mkDerivation rec { sha256 = "0zhlms89ncqz1f1hc22yw9x1s837yv76f1zcjizhgn5h7vp17j4b"; }; + nativeBuildInputs = [ makeWrapper ]; buildInputs = [ libpcap sqlite pixiewps ]; - prePatch = "cd src"; + sourceRoot = "reaver-wps-fork-t6x-v${version}-src/src"; - preInstall = "mkdir -p $out/bin"; + configureFlags = "--sysconfdir=${confdir}"; - meta = { + installPhase = '' + mkdir -p $out/{bin,etc} + cp reaver.db $out/etc/ + cp reaver wash $out/bin/ + + wrapProgram $out/bin/reaver --run "[ -s ${confdir}/reaver/reaver.db ] || install -D $out/etc/reaver.db ${confdir}/reaver/reaver.db" + wrapProgram $out/bin/wash --run "[ -s ${confdir}/reaver/reaver.db ] || install -D $out/etc/reaver.db ${confdir}/reaver/reaver.db" + ''; + + meta = with stdenv.lib; { description = "Online and offline brute force attack against WPS"; homepage = https://github.com/t6x/reaver-wps-fork-t6x; - license = stdenv.lib.licenses.gpl2Plus; - platforms = stdenv.lib.platforms.linux; - maintainer = stdenv.lib.maintainers.nico202; + license = licenses.gpl2Plus; + platforms = platforms.linux; + maintainers = with maintainers; [ nico202 volth ]; }; } diff --git a/pkgs/tools/networking/reaver-wps/default.nix b/pkgs/tools/networking/reaver-wps/default.nix index 9efe3df75201..c9bd3fbaa853 100644 --- a/pkgs/tools/networking/reaver-wps/default.nix +++ b/pkgs/tools/networking/reaver-wps/default.nix @@ -1,27 +1,36 @@ -{ stdenv, fetchurl, libpcap, sqlite }: +{ stdenv, fetchurl, libpcap, sqlite, makeWrapper }: stdenv.mkDerivation rec { - name = "reaver-wps-1.4"; + version = "1.4"; + name = "reaver-wps-${version}"; + confdir = "/var/db/${name}"; # the sqlite database is at "${confdir}/reaver/reaver.db" src = fetchurl { - url = http://reaver-wps.googlecode.com/files/reaver-1.4.tar.gz; + url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/reaver-wps/reaver-${version}.tar.gz"; sha256 = "0bdjai4p8xbsw8zdkkk43rgsif79x0nyx4djpyv0mzh59850blxd"; }; + nativeBuildInputs = [ makeWrapper ]; buildInputs = [ libpcap sqlite ]; - prePatch = '' - cd src + sourceRoot = "reaver-${version}/src"; + + configureFlags = "--sysconfdir=${confdir}"; + + installPhase = '' + mkdir -p $out/{bin,etc} + cp reaver.db $out/etc/ + cp reaver wash $out/bin/ + + wrapProgram $out/bin/reaver --run "[ -s ${confdir}/reaver/reaver.db ] || install -D $out/etc/reaver.db ${confdir}/reaver/reaver.db" + wrapProgram $out/bin/wash --run "[ -s ${confdir}/reaver/reaver.db ] || install -D $out/etc/reaver.db ${confdir}/reaver/reaver.db" ''; - preInstall = '' - mkdir -p $out/bin - ''; - - meta = { + meta = with stdenv.lib; { description = "Brute force attack against Wifi Protected Setup"; homepage = http://code.google.com/p/reaver-wps; - license = stdenv.lib.licenses.gpl2Plus; - platforms = stdenv.lib.platforms.linux; + license = licenses.gpl2Plus; + platforms = platforms.linux; + maintainers = with maintainers; [ nico202 volth ]; }; }