aboutsummaryrefslogtreecommitdiff
path: root/pkgs/tools/security/thc-hydra/default.nix
blob: 252d73b479b64186145775c0636991aa66d88126 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{ stdenv, lib, fetchurl, zlib, openssl, ncurses, libidn, pcre, libssh, mysql, postgresql
, withGUI ? false, makeWrapper, pkgconfig, gtk2 }:

let
  makeDirs = output: subDir: pkgs: lib.concatStringsSep " " (map (path: lib.getOutput output path + "/" + subDir) pkgs);

in stdenv.mkDerivation rec {
  pname = "thc-hydra";
  version = "8.5";

  src = fetchurl {
    url = "http://www.thc.org/releases/hydra-${version}.tar.gz";
    sha256 = "0vfx6xwmw0r7nd0s232y7rckcj58fc1iqjgp4s56rakpz22b4yjm";
  };

  preConfigure = ''
    substituteInPlace configure \
      --replace "\$LIBDIRS" "${makeDirs "lib" "lib" buildInputs}" \
      --replace "\$INCDIRS" "${makeDirs "dev" "include" buildInputs}" \
      --replace "/usr/include/math.h" "${lib.getDev stdenv.cc.libc}/include/math.h" \
      --replace "libcurses.so" "libncurses.so" \
      --replace "-lcurses" "-lncurses"
  '';

  nativeBuildInputs = lib.optionals withGUI [ pkgconfig makeWrapper ];
  buildInputs = [ zlib openssl ncurses libidn pcre libssh mysql.connector-c postgresql ]
                ++ lib.optional withGUI gtk2;

  postInstall = lib.optionalString withGUI ''
    wrapProgram $out/bin/xhydra \
      --add-flags --hydra-path --add-flags "$out/bin/hydra"
  '';

  meta = with stdenv.lib; {
    description = "A very fast network logon cracker which support many different services";
    license = licenses.agpl3;
    homepage = https://www.thc.org/thc-hydra/;
    maintainers = with maintainers; [offline];
    platforms = platforms.linux;
  };
}