rio: 0.0.36 -> 0.0.37
[NixPkgs.git] / pkgs / tools / networking / nikto / default.nix
blob098171de09df13894a50eeea6a9ecfc60ffeb193
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , perlPackages
5 , makeWrapper
6 , installShellFiles
7 }:
9 let
10   version = "2.5.0";
12 stdenv.mkDerivation rec {
13   pname = "nikto";
14   inherit version;
16   src = fetchFromGitHub {
17     owner = "sullo";
18     repo = "nikto";
19     rev = version;
20     sha256 = "sha256-lWiDbWc2BWAUgyaIm0tvZytja02WogYRoc7na4sHiNM=";
21   };
23   # Nikto searches its configuration file based on its current path
24   # This fixes the current path regex for the wrapped executable.
25   patches = [ ./nix-wrapper-fix.patch ];
27   postPatch = ''
28     # EXECDIR needs to be changed to the path where we copy the programs stuff
29     # Forcing SSLeay is needed for SSL support (the auto mode doesn't seem to work otherwise)
30     substituteInPlace program/nikto.conf.default \
31       --replace "# EXECDIR=/opt/nikto" "EXECDIR=$out/share" \
32       --replace "LW_SSL_ENGINE=auto" "LW_SSL_ENGINE=SSLeay"
33   '';
35   nativeBuildInputs = [ makeWrapper installShellFiles ];
37   buildInputs = [
38     perlPackages.perl
39     perlPackages.NetSSLeay
40   ];
42   installPhase = ''
43     runHook preInstall
44     install -d "$out/share"
45     cp -a program/* "$out/share"
46     install -Dm 755 "program/nikto.pl" "$out/bin/nikto"
47     install -Dm 644 program/nikto.conf.default "$out/etc/nikto.conf"
48     installManPage documentation/nikto.1
49     install -Dm 644 README.md "$out/share/doc/${pname}/README"
50     runHook postInstall
51   '';
53   postInstall = ''
54     wrapProgram $out/bin/nikto \
55       --prefix PERL5LIB : $PERL5LIB
56   '';
58   meta = with lib; {
59     description = "Web server scanner";
60     mainProgram = "nikto";
61     license = licenses.gpl2Plus;
62     homepage = "https://cirt.net/Nikto2";
63     changelog = "https://github.com/sullo/nikto/releases/tag/${version}";
64     maintainers = with maintainers; [ shamilton ];
65     platforms = platforms.unix;
66   };