immunIT / drupwn

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

Fix AttributeError while detecting version #33

Closed dpedu closed 5 years ago

dpedu commented 5 years ago

I tested my site with this tool and encountered this:

$ drupwn enum https://dpedu.io/

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

[-] Version not specified, trying to identify it
Traceback (most recent call last):
  File "/Users/dave/code/drupwn/testenv/bin/drupwn", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/Users/dave/code/drupwn/drupwn", line 43, in <module>
    Fingerprinter(request, logger).fingerprint(config)
  File "/Users/dave/code/drupwn/engine/Fingerprinter.py", line 28, in fingerprint
    config["version"] = float(version.group(0))
AttributeError: 'NoneType' object has no attribute 'group'
$

This changes avoids this error using some checks and correctly shows the Please specify a version if version detection fails:

$ drupwn enum https://dpedu.io/

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

[-] Version not specified, trying to identify it

[-] The automatic detection failed. Please specify a version
$
immunIT commented 5 years ago

Hi @dpedu,

Could you please review your pull request according to our CONTRIBUTING file?

==> https://github.com/immunIT/drupwn/blob/master/CONTRIBUTING.md

Best,

dpedu commented 5 years ago

Follow up in #34.