about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/log4j-scan/default.nix
blob: e3de824b223c4e74fff70df44b32ce1261d9846f (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
{ lib
, fetchFromGitHub
, python3
}:

python3.pkgs.buildPythonApplication rec {
  pname = "log4j-scan";
  version = "unstable-2021-12-18";
  format = "other";

  src = fetchFromGitHub {
    owner = "fullhunt";
    repo = pname;
    rev = "070fbd00f0945645bd5e0daa199a554ef3884b95";
    sha256 = "sha256-ORSc4KHyAMjuA7QHReDh6SYY5yZRunBBN1+lkCayqL4=";
  };

  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";
    mainProgram = "log4j-scan";
    homepage = "https://github.com/fullhunt/log4j-scan";
    license = licenses.mit;
    maintainers = with maintainers; [ fab ];
  };
}