1{ 2 lib, 3 fetchFromGitHub, 4 buildPythonPackage, 5 python, 6 pytestCheckHook, 7 # deps 8 /* 9 ntlm-auth is in the requirements.txt, however nixpkgs tells me 10 > ntlm-auth has been removed, because it relies on the md4 implementation provided by openssl. Use pyspnego instead. 11 Not sure if pyspnego is a drop in replacement. 12 The simple functionality dirsearch seems not to depend on this package. 13 */ 14 #ntlm-auth, 15 #pyspnego, 16 beautifulsoup4, 17 certifi, 18 cffi, 19 chardet, 20 charset-normalizer, 21 colorama, 22 cryptography, 23 defusedxml, 24 idna, 25 jinja2, 26 markupsafe, 27 pyopenssl, 28 pyparsing, 29 pysocks, 30 requests, 31 requests-ntlm, 32 setuptools, 33 urllib3, 34}: 35 36buildPythonPackage rec { 37 pname = "dirsearch"; 38 version = "0.4.3"; 39 40 src = fetchFromGitHub { 41 owner = "maurosoria"; 42 repo = "dirsearch"; 43 rev = "v${version}"; 44 hash = "sha256-eXB103qUB3m7V/9hlq2xv3Y3bIz89/pGJsbPZQ+AZXs="; 45 }; 46 47 # setup.py does some weird stuff with mktemp 48 postPatch = '' 49 substituteInPlace setup.py \ 50 --replace-fail 'os.chdir(env_dir)' "" \ 51 --replace-fail 'shutil.copytree(os.path.abspath(os.getcwd()), os.path.join(env_dir, "dirsearch"))' "" 52 ''; 53 54 pyproject = true; 55 build-system = [ setuptools ]; 56 57 dependencies = [ 58 # maybe needed, see above 59 #pyspnego 60 #ntlm-auth 61 beautifulsoup4 62 certifi 63 cffi 64 chardet 65 charset-normalizer 66 colorama 67 cryptography 68 defusedxml 69 idna 70 jinja2 71 markupsafe 72 pyopenssl 73 pyparsing 74 pysocks 75 requests 76 requests-ntlm 77 setuptools 78 urllib3 79 ]; 80 81 # the library files get installed in the wrong location 82 # and dirsearch.py, __init__.py and db/ are missing 83 postInstall = '' 84 dirsearchpath=$out/lib/python${lib.versions.majorMinor python.version}/site-packages/ 85 mkdir -p $dirsearchpath/dirsearch 86 mv $dirsearchpath/{lib,dirsearch} 87 cp $src/{dirsearch,__init__}.py $dirsearchpath/dirsearch 88 cp -r $src/db $dirsearchpath/dirsearch 89 ''; 90 91 # tests 92 nativeCheckInputs = [ 93 pytestCheckHook 94 ]; 95 disabledTestPaths = [ 96 # needs network? 97 "tests/reports/test_reports.py" 98 ]; 99 disabledTests = [ 100 # failing for unknown reason 101 "test_detect_scheme" 102 ]; 103 pythonRemoveDeps = [ 104 # not available, see above 105 "ntlm_auth" 106 ]; 107 pythonRelaxDeps = [ 108 # version checker doesn't recognize 0.8.0.rc2 as >=0.7.0 109 "defusedxml" 110 # probably not but we don't have old charset-normalizer versions in nixpkgs 111 # and requests also depends on it so we can't just override it with an 112 # older version due to package duplication 113 "charset_normalizer" 114 ]; 115 116 meta = { 117 changelog = "https://github.com/maurosoria/dirsearch/releases/tag/${version}"; 118 description = "Command-line tool for brute-forcing directories and files in webservers, AKA a web path scanner"; 119 homepage = "https://github.com/maurosoria/dirsearch"; 120 license = lib.licenses.gpl2Only; 121 mainProgram = "dirsearch"; 122 maintainers = with lib.maintainers; [ quantenzitrone ]; 123 }; 124}