From 2aa98d4c5daab8d03f21442247ef6f63c6a4a6a9 Mon Sep 17 00:00:00 2001 From: lalvarezt Date: Mon, 6 Oct 2025 09:41:44 +0200 Subject: [PATCH 1/3] Migrate to modern Python packaging with pyproject.toml --- httpmethods.py | 11 ++++++++--- pyproject.toml | 33 +++++++++++++++++++++++++++++++++ setup.py | 34 ---------------------------------- 3 files changed, 41 insertions(+), 37 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/httpmethods.py b/httpmethods.py index 3c3d0be..4d1e1ee 100755 --- a/httpmethods.py +++ b/httpmethods.py @@ -185,7 +185,7 @@ def methods_from_wordlist(wordlist): with open(options.wordlist, "r") as infile: methods += infile.read().split() except Exception as e: - logger.error(f"Had some kind of error loading the wordlist ¯\_(ツ)_/¯: {e}") + logger.error(rf"Had some kind of error loading the wordlist ¯\_(ツ)_/¯: {e}") def methods_from_http_options(console, options, proxies, headers, cookies): @@ -338,7 +338,7 @@ def main(options, logger, console): test_dangerous_method = "n" else: test_dangerous_method = console.input( - f"[bold orange3][?][/bold orange3] Do you really want to test method {method} (can be dangerous)? \[y/N] ") + f"[bold orange3][?][/bold orange3] Do you really want to test method {method} (can be dangerous)? [y/N] ") if not test_dangerous_method.lower() == "y": logger.verbose(f"Method {method} will not be tested") else: @@ -365,7 +365,8 @@ def main(options, logger, console): json_export(results, options.jsonfile) -if __name__ == '__main__': +def cli_entry(): + """Entry point for console script.""" try: print(banner) options = get_options() @@ -384,3 +385,7 @@ def main(options, logger, console): except KeyboardInterrupt: logger.info("Terminating script...") raise SystemExit + + +if __name__ == '__main__': + cli_entry() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e809a02 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,33 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "httpmethods" +version = "1.1.0" +description = "HTTP verb tampering & methods enumeration" +readme = "README.md" +authors = [{name = "Shutdown"}] +license = {text = "GPL-3.0"} +requires-python = ">=3.6" +classifiers = [ + "Environment :: Console", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3", + "Topic :: Security", +] +dependencies = [ + "requests", + "urllib3", + "rich", +] + +[project.urls] +Homepage = "https://github.com/ShutdownRepo/httpmethods" + +[project.scripts] +httpmethods = "httpmethods:cli_entry" + +[tool.setuptools] +py-modules = ["httpmethods"] diff --git a/setup.py b/setup.py deleted file mode 100644 index b32a769..0000000 --- a/setup.py +++ /dev/null @@ -1,34 +0,0 @@ -import shutil -import os -from setuptools import setup - -with open('README.md', 'r', encoding='utf-8') as f: - long_description = f.read() - -with open('requirements.txt', 'r', encoding='utf-8') as f: - content = f.readlines() - requirements = [x.strip() for x in content] - -shutil.copyfile('httpmethods.py', 'httpmethods') - -setup( - name='httpmethods', - version='1.1.0', - author='Shutdown', - description='HTTP verb tampering & methods enumeration ', - long_description=long_description, - long_description_content_type='text/markdown', - url='https://github.com/ShutdownRepo/httpmethods', - classifiers=[ - 'Environment :: Console' - 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', - 'Operating System :: POSIX :: Linux', - 'Programming Language :: Python :: 3', - 'Topic :: Security', - ], - python_requires='>=3.6', - install_requires=requirements, - scripts=['httpmethods'] -) - -os.remove('httpmethods') From 16009dcc7d87769ecbbdca7c3cabf98c5a664b10 Mon Sep 17 00:00:00 2001 From: lalvarezt Date: Mon, 6 Oct 2025 09:47:13 +0200 Subject: [PATCH 2/3] remove requirements.txt file, not needed anymore --- requirements.txt | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 47fc132..0000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -setuptools -requests -urllib3 -rich \ No newline at end of file From 51a6058b9fafac7f26464d51a028f475716cfec7 Mon Sep 17 00:00:00 2001 From: lalvarezt Date: Mon, 6 Oct 2025 10:07:10 +0200 Subject: [PATCH 3/3] fix globals and urllib3 compatibility issues --- httpmethods.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/httpmethods.py b/httpmethods.py index 4d1e1ee..292334d 100755 --- a/httpmethods.py +++ b/httpmethods.py @@ -367,6 +367,7 @@ def main(options, logger, console): def cli_entry(): """Entry point for console script.""" + global logger, console, options try: print(banner) options = get_options() @@ -376,7 +377,11 @@ def cli_entry(): # Disable warnings of insecure connection for invalid cerificates requests.packages.urllib3.disable_warnings() # Allow use of deprecated and weak cipher methods - requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += ':HIGH:!DH:!aNULL' + try: + requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += ':HIGH:!DH:!aNULL' + except AttributeError: + # urllib3 v2.0+ removed DEFAULT_CIPHERS + pass try: requests.packages.urllib3.contrib.pyopenssl.util.ssl_.DEFAULT_CIPHERS += ':HIGH:!DH:!aNULL' except AttributeError: