From 2367be910aabbf30490ebcbbd98748702ff9607f Mon Sep 17 00:00:00 2001 From: Zitrone Date: Tue, 22 Oct 2024 23:43:10 +0200 Subject: [PATCH] python3Packages.dirsearch: init at 0.4.3 closes #191097 --- .../python-modules/dirsearch/default.nix | 95 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 97 insertions(+) create mode 100644 pkgs/development/python-modules/dirsearch/default.nix diff --git a/pkgs/development/python-modules/dirsearch/default.nix b/pkgs/development/python-modules/dirsearch/default.nix new file mode 100644 index 000000000000..4eebafa6397a --- /dev/null +++ b/pkgs/development/python-modules/dirsearch/default.nix @@ -0,0 +1,95 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + python, + # deps + /* + ntlm-auth is in the requirements.txt, however nixpkgs tells me + > ntlm-auth has been removed, because it relies on the md4 implementation provided by openssl. Use pyspnego instead. + Not sure if pyspnego is a drop in replacement. + The simple functionality dirsearch seems not to depend on this package. + */ + #ntlm-auth, + #pyspnego, + beautifulsoup4, + certifi, + cffi, + chardet, + charset-normalizer, + colorama, + cryptography, + defusedxml, + idna, + jinja2, + markupsafe, + pyopenssl, + pyparsing, + pysocks, + requests, + requests-ntlm, + setuptools, + urllib3, +}: + +buildPythonPackage rec { + pname = "dirsearch"; + version = "0.4.3"; + + src = fetchFromGitHub { + owner = "maurosoria"; + repo = "dirsearch"; + rev = "v${version}"; + hash = "sha256-eXB103qUB3m7V/9hlq2xv3Y3bIz89/pGJsbPZQ+AZXs="; + }; + + # setup.py does some weird stuff with mktemp + postPatch = '' + substituteInPlace setup.py \ + --replace-fail 'os.chdir(env_dir)' "" \ + --replace-fail 'shutil.copytree(os.path.abspath(os.getcwd()), os.path.join(env_dir, "dirsearch"))' "" + ''; + + dependencies = [ + # maybe needed, see above + #pyspnego + #ntlm-auth + beautifulsoup4 + certifi + cffi + chardet + charset-normalizer + colorama + cryptography + defusedxml + idna + jinja2 + markupsafe + pyopenssl + pyparsing + pysocks + requests + requests-ntlm + setuptools + urllib3 + ]; + + # the library files get installed in the wrong location + # and dirsearch.py, __init__.py and db/ are missing + postInstall = '' + dirsearchpath=$out/lib/python${lib.versions.majorMinor python.version}/site-packages/ + mkdir -p $dirsearchpath/dirsearch + mv $dirsearchpath/{lib,dirsearch} + cp $src/{dirsearch,__init__}.py $dirsearchpath/dirsearch + cp -r $src/db $dirsearchpath/dirsearch + ''; + + meta = { + changelog = "https://github.com/maurosoria/dirsearch/releases/tag/${version}"; + description = "command-line tool for brute-forcing directories and files in webservers, AKA a web path scanner"; + homepage = "https://github.com/maurosoria/dirsearch"; + license = lib.licenses.gpl2Only; + mainProgram = "dirsearch"; + maintainers = with lib.maintainers; [ quantenzitrone ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6b4ce7eebdcc..82fbcfd718ee 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3194,6 +3194,8 @@ self: super: with self; { dirigera = callPackage ../development/python-modules/dirigera { }; + dirsearch = callPackage ../development/python-modules/dirsearch { }; + dirty-equals = callPackage ../development/python-modules/dirty-equals { }; dirtyjson = callPackage ../development/python-modules/dirtyjson { };