about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/networking/nikto/default.nix
blob: df03cc8c3ce77991b7374f1ef5fed018faf25b61 (plain) (blame)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ lib
, stdenv
, fetchFromGitHub
, perlPackages
, makeWrapper
, installShellFiles
}:

let
  version = "2.5.0";
in
stdenv.mkDerivation rec {
  pname = "nikto";
  inherit version;

  src = fetchFromGitHub {
    owner = "sullo";
    repo = "nikto";
    rev = version;
    sha256 = "sha256-lWiDbWc2BWAUgyaIm0tvZytja02WogYRoc7na4sHiNM=";
  };

  # Nikto searches its configuration file based on its current path
  # This fixes the current path regex for the wrapped executable.
  patches = [ ./nix-wrapper-fix.patch ];

  postPatch = ''
    # EXECDIR needs to be changed to the path where we copy the programs stuff
    # Forcing SSLeay is needed for SSL support (the auto mode doesn't seem to work otherwise)
    substituteInPlace program/nikto.conf.default \
      --replace "# EXECDIR=/opt/nikto" "EXECDIR=$out/share" \
      --replace "LW_SSL_ENGINE=auto" "LW_SSL_ENGINE=SSLeay"
  '';

  nativeBuildInputs = [ makeWrapper installShellFiles ];

  buildInputs = [
    perlPackages.perl
    perlPackages.NetSSLeay
  ];

  installPhase = ''
    runHook preInstall
    install -d "$out/share"
    cp -a program/* "$out/share"
    install -Dm 755 "program/nikto.pl" "$out/bin/nikto"
    install -Dm 644 program/nikto.conf.default "$out/etc/nikto.conf"
    installManPage documentation/nikto.1
    install -Dm 644 README.md "$out/share/doc/${pname}/README"
    runHook postInstall
  '';

  postInstall = ''
    wrapProgram $out/bin/nikto \
      --prefix PERL5LIB : $PERL5LIB
  '';

  meta = with lib; {
    description = "Web server scanner";
    license = licenses.gpl2Plus;
    homepage = "https://cirt.net/Nikto2";
    changelog = "https://github.com/sullo/nikto/releases/tag/${version}";
    maintainers = with maintainers; [ shamilton ];
    platforms = platforms.unix;
  };
}