immunIT / drupwn

Drupal enumeration & exploitation tool
GNU General Public License v3.0
585 stars 129 forks source link

timeout not handled #24

Closed noraj closed 5 years ago

noraj commented 5 years ago
$ drupwn enum http://xxx                                                                                                                

        ____                                                                                                                                                                                                       
       / __ \_______  ______ _      ______                                                                                                                                                                         
      / / / / ___/ / / / __ \ | /| / / __ \                                                                                                                                                                        
     / /_/ / /  / /_/ / /_/ / |/ |/ / / / /                                                                                                                                                                        
    /_____/_/   \__,_/ .___/|__/|__/_/ /_/                                                                                                                                                                         
                     /_/                                                                                                                                                                                           

[-] Version not specified, trying to identify it                                                                                                                                                                   
Traceback (most recent call last):                                                                                                                                                                                 
  File "/usr/lib/python3.7/site-packages/urllib3/connection.py", line 159, in _new_conn                                                                                                                            
    (self._dns_host, self.port), self.timeout, **extra_kw)                                                                                                                                                         
  File "/usr/lib/python3.7/site-packages/urllib3/util/connection.py", line 80, in create_connection                                                                                                                
    raise err                                                                                                                                                                                                      
  File "/usr/lib/python3.7/site-packages/urllib3/util/connection.py", line 70, in create_connection                                                                                                                
    sock.connect(sa)                                                                                                                                                                                               
TimeoutError: [Errno 110] Connection timed out                                                                                                                                                                     

During handling of the above exception, another exception occurred:                                                                                                                                                

Traceback (most recent call last):                                                                                                                                                                                 
  File "/usr/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen                                                                                                                          
    chunked=chunked)                                                                                                                                                                                               
  File "/usr/lib/python3.7/site-packages/urllib3/connectionpool.py", line 354, in _make_request                                                                                                                    
    conn.request(method, url, **httplib_request_kw)                                                                                                                                                                
  File "/usr/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1016, in _send_output
    self.send(msg)
  File "/usr/lib/python3.7/http/client.py", line 956, in send
    self.connect()
  File "/usr/lib/python3.7/site-packages/urllib3/connection.py", line 181, in connect
    conn = self._new_conn()
  File "/usr/lib/python3.7/site-packages/urllib3/connection.py", line 168, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f8e76308898>: Failed to establish a new connection: [Errno 110] Connection timed out                                       

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3.7/site-packages/urllib3/util/retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='xxx', port=80): Max retries exceeded with url: /CHANGELOG.txt (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f8e76308898>: Failed to establish a new connection: [Errno 110] Connection timed out'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "drupwn", line 37, in <module>
    Fingerprinter(request, logger).fingerprint(config)
  File "/usr/share/drupwn/engine/Fingerprinter.py", line 19, in fingerprint
    config["version"] = self._getDefaultFilesVersion()
  File "/usr/share/drupwn/engine/Fingerprinter.py", line 58, in _getDefaultFilesVersion
    r = self.request.get(dfile)
  File "/usr/share/drupwn/engine/Request.py", line 52, in get
    return self.session.get(self.url + path, headers=self.headers, cookies=self.cookies, proxies=proxies, verify=False)                                                                                           
  File "/usr/lib/python3.7/site-packages/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='xxx', port=80): Max retries exceeded with url: /CHANGELOG.txt (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f8e76308898>: Failed to establish a new connection: [Errno 110] Connection timed out'))

$ python --version 
Python 3.7.2
immunIT commented 5 years ago

Hi @noraj, I'm working on it and the fix will be released in the next update.

Best,

noraj commented 5 years ago

@immunIT Thx for the awesome work!

immunIT commented 5 years ago

Fixed #28