EntySec / HatSploit

Modular penetration testing platform that enables you to write, test, and execute exploit code.
https://hatsploit.com
MIT License
277 stars 62 forks source link

Add `http_methods` module #93

Closed naltun closed 2 years ago

naltun commented 2 years ago

Add the auxiliary/generic/scanner/http_methods module. From the description:

Find supported HTTP methods on a server.

The idea is that this module will show you which HTTP methods are available on ports 80 and 443, respectively. Here it is running on my box:

(hsf)> use auxiliary/generic/scanner/http_methods
(hsf: auxiliary: HTTP Methods)> set HOST 45.33.32.156 # scanme.nmap.org
[i] HOST ==> 45.33.32.156
(hsf: auxiliary: HTTP Methods)> run

[*] Scanning 45.33.32.156...
[+] Port 80 Supported Methods: GET HEAD OPTIONS POST
[+] Auxiliary module completed!

Edit 1: If there are any quality-of-life methods from the Module or TCPTools classes that I am not using but should, let me know.

Edit 2: Update May 27

image
naltun commented 2 years ago

Regarding the CodeFactor issue, the platform uses Bandit for Python code. Bandit will always complain about using urllib.request.urlopen() because the scheme could be modified dynamically. In this case, urllib.request.Request has a hardcoded URL that is not subject to change. I think it's OK to ignore this issue. I can also add # nosec to the side the line with urlopen(), which will tell Bandit (via CodeFactor) to ignore this line.

enty8080 commented 2 years ago

@naltun Do not use urllib, use pex.proto.http instead

from hatsploit.lib.module import Module
from pex.proto.http from HTTPClient

class HatSploitModule(Module, HTTPClient):
    # details, options

   def run(self):
        remote_host, remote_port = self.parse_options(self.options)

        self.http_request(
            method="GET",
            host=remote_host,
            port=remote_port,
            path="/"
        )
naltun commented 2 years ago

@naltun Do not use urllib, use pex.proto.http instead

@enty8080 please see ebc5479.