about summary refs log tree commit diff
path: root/pkgs/tools/security/log4j-scan
diff options
context:
space:
mode:
authorFabian Affolter <mail@fabian-affolter.ch>2021-12-14 16:25:29 +0100
committerFabian Affolter <mail@fabian-affolter.ch>2021-12-14 16:25:29 +0100
commitbad5eb111f4e29aa358ab1f4815bdab1ee07c818 (patch)
tree98661f9c74869f7eab8733ce00adb99fa391d0d7 /pkgs/tools/security/log4j-scan
parenta53d2afe681ef4c107deddf5896eb2e7460641d5 (diff)
log4j-scan: init at unstable-2021-12-14
Diffstat (limited to 'pkgs/tools/security/log4j-scan')
-rw-r--r--pkgs/tools/security/log4j-scan/default.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/pkgs/tools/security/log4j-scan/default.nix b/pkgs/tools/security/log4j-scan/default.nix
new file mode 100644
index 0000000000000..142c1dd8c1b19
--- /dev/null
+++ b/pkgs/tools/security/log4j-scan/default.nix
@@ -0,0 +1,44 @@
+{ lib
+, fetchFromGitHub
+, python3
+}:
+
+python3.pkgs.buildPythonApplication rec {
+  pname = "log4j-scan";
+  version = "unstable-2021-12-14";
+  format = "other";
+
+  src = fetchFromGitHub {
+    owner = "fullhunt";
+    repo = pname;
+    rev = "7be0f1c02ce3494469dc73a177e6f0c96f0016d9";
+    sha256 = "sha256-HazxK0wJ8xeFauD2xOxmOwWw1nEpQh+QdcBVZNaUgrM=";
+  };
+
+  propagatedBuildInputs = with python3.pkgs; [
+    pycryptodome
+    requests
+    termcolor
+  ];
+
+  postPatch = ''
+    substituteInPlace log4j-scan.py \
+      --replace "headers.txt" "../share/headers.txt"
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    install -vD ${pname}.py $out/bin/${pname}
+    install -vD headers.txt headers-large.txt -t $out/share
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "Scanner for finding hosts which are vulnerable for log4j";
+    homepage = "https://github.com/fullhunt/log4j-scan";
+    license = licenses.mit;
+    maintainers = with maintainers; [ fab ];
+  };
+}