summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2021-01-31 19:41:32 +0100
committerGitHub <noreply@github.com>2021-01-31 19:41:32 +0100
commitb6479673221dc6fcb19abf27c0a0790bc8c2ab5b (patch)
tree98ee3e15f9b3c7466dc6c0797e1145ef2e7a53cc
parent4f93b4c80dd256c02f452f03dc73a3fdd83ae7b4 (diff)
parentcfd0e90f31bdef32ae2904c7e5fd3271c38db240 (diff)
Merge pull request #111299 from SCOTT-HAMILTON/nikto
nikto: init at 2.2.0
-rw-r--r--pkgs/tools/networking/nikto/NIKTODIR-nix-wrapper-fix.patch26
-rw-r--r--pkgs/tools/networking/nikto/default.nix64
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 92 insertions, 0 deletions
diff --git a/pkgs/tools/networking/nikto/NIKTODIR-nix-wrapper-fix.patch b/pkgs/tools/networking/nikto/NIKTODIR-nix-wrapper-fix.patch
new file mode 100644
index 000000000000..d3caea1b26fd
--- /dev/null
+++ b/pkgs/tools/networking/nikto/NIKTODIR-nix-wrapper-fix.patch
@@ -0,0 +1,26 @@
+diff --color -ur a/program/nikto.pl b/program/nikto.pl
+--- a/program/nikto.pl 2021-01-30 12:05:54.915072538 +0100
++++ b/program/nikto.pl 2021-01-30 12:36:42.877729231 +0100
+@@ -223,7 +223,8 @@
+ # Guess Nikto current directory
+ my $NIKTODIR = abs_path($0);
+ chomp($NIKTODIR);
+- $NIKTODIR =~ s#[\\/]nikto.pl$##;
++ $NIKTODIR =~ s#[\\/]bin[\\/]\.nikto-wrapped$##;
++
+
+ # Guess user's home directory -- to support Windows
+ foreach my $var (split(/ /, "HOME USERPROFILE")) {
+@@ -231,10 +232,10 @@
+ }
+
+ # Read the conf files in order (previous values are over-written with each, if multiple found)
+- push(@CF,"$NIKTODIR/nikto.conf.default");
++ push(@CF,"$NIKTODIR/etc/nikto.conf.default");
+ push(@CF,"/etc/nikto.conf");
+ push(@CF,"$home/nikto.conf");
+- push(@CF,"$NIKTODIR/nikto.conf");
++ push(@CF,"$NIKTODIR/etc/nikto.conf");
+ push(@CF,"nikto.conf");
+ push(@CF,"$VARIABLES{'configfile'}");
+
diff --git a/pkgs/tools/networking/nikto/default.nix b/pkgs/tools/networking/nikto/default.nix
new file mode 100644
index 000000000000..e1abcb6c140d
--- /dev/null
+++ b/pkgs/tools/networking/nikto/default.nix
@@ -0,0 +1,64 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, perlPackages
+, makeWrapper
+, installShellFiles
+}:
+
+stdenv.mkDerivation rec {
+ pname = "nikto";
+ version = "2.2.0";
+
+ src = fetchFromGitHub {
+ owner = "sullo";
+ repo = "nikto";
+ rev = "c83d0461edd75c02677dea53da2896644f35ecab";
+ sha256 = "0vwq2zdxir67cn78ls11qf1smd54nppy266v7ajm5rqdc47q7fy2";
+ };
+
+ # Nikto searches its configuration file based on its current path
+ # This fixes the current path regex for the wrapped executable.
+ patches = [ ./NIKTODIR-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 ];
+
+ propagatedBuildInputs = [ perlPackages.NetSSLeay ];
+
+ buildInputs = [
+ perlPackages.perl
+ ];
+
+ 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 program/docs/nikto_manual.html "$out/share/doc/${pname}/manual.html"
+ 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";
+ maintainers = with maintainers; [ shamilton ];
+ platforms = platforms.unix;
+ };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 4cdf1cfa4d52..ad4d78560d8c 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -15838,6 +15838,8 @@ in
nika-fonts = callPackage ../data/fonts/nika-fonts { };
+ nikto = callPackage ../tools/networking/nikto { };
+
nlohmann_json = callPackage ../development/libraries/nlohmann_json { };
nntp-proxy = callPackage ../applications/networking/nntp-proxy { };