1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 python,
6 # deps
7 /*
8 ntlm-auth is in the requirements.txt, however nixpkgs tells me
9 > ntlm-auth has been removed, because it relies on the md4 implementation provided by openssl. Use pyspnego instead.
10 Not sure if pyspnego is a drop in replacement.
11 The simple functionality dirsearch seems not to depend on this package.
12 */
13 #ntlm-auth,
14 #pyspnego,
15 beautifulsoup4,
16 certifi,
17 cffi,
18 chardet,
19 charset-normalizer,
20 colorama,
21 cryptography,
22 defusedxml,
23 idna,
24 jinja2,
25 markupsafe,
26 pyopenssl,
27 pyparsing,
28 pysocks,
29 requests,
30 requests-ntlm,
31 setuptools,
32 urllib3,
33}:
34
35buildPythonPackage rec {
36 pname = "dirsearch";
37 version = "0.4.3";
38
39 src = fetchFromGitHub {
40 owner = "maurosoria";
41 repo = "dirsearch";
42 rev = "v${version}";
43 hash = "sha256-eXB103qUB3m7V/9hlq2xv3Y3bIz89/pGJsbPZQ+AZXs=";
44 };
45
46 # setup.py does some weird stuff with mktemp
47 postPatch = ''
48 substituteInPlace setup.py \
49 --replace-fail 'os.chdir(env_dir)' "" \
50 --replace-fail 'shutil.copytree(os.path.abspath(os.getcwd()), os.path.join(env_dir, "dirsearch"))' ""
51 '';
52
53 dependencies = [
54 # maybe needed, see above
55 #pyspnego
56 #ntlm-auth
57 beautifulsoup4
58 certifi
59 cffi
60 chardet
61 charset-normalizer
62 colorama
63 cryptography
64 defusedxml
65 idna
66 jinja2
67 markupsafe
68 pyopenssl
69 pyparsing
70 pysocks
71 requests
72 requests-ntlm
73 setuptools
74 urllib3
75 ];
76
77 # the library files get installed in the wrong location
78 # and dirsearch.py, __init__.py and db/ are missing
79 postInstall = ''
80 dirsearchpath=$out/lib/python${lib.versions.majorMinor python.version}/site-packages/
81 mkdir -p $dirsearchpath/dirsearch
82 mv $dirsearchpath/{lib,dirsearch}
83 cp $src/{dirsearch,__init__}.py $dirsearchpath/dirsearch
84 cp -r $src/db $dirsearchpath/dirsearch
85 '';
86
87 meta = {
88 changelog = "https://github.com/maurosoria/dirsearch/releases/tag/${version}";
89 description = "command-line tool for brute-forcing directories and files in webservers, AKA a web path scanner";
90 homepage = "https://github.com/maurosoria/dirsearch";
91 license = lib.licenses.gpl2Only;
92 mainProgram = "dirsearch";
93 maintainers = with lib.maintainers; [ quantenzitrone ];
94 };
95}