diff --git a/wp-fingerprint.py b/wp-fingerprint.py
index 6f2e222..dcee685 100644
--- a/wp-fingerprint.py
+++ b/wp-fingerprint.py
@@ -6,13 +6,14 @@
def main():
parser = argparse.ArgumentParser("Detects WP version from readme.html or meta tag")
parser.add_argument("-t", "--target", action="append", dest="targets", help="Add a target to scan")
+ parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", help="Turn on verbose mode. Useful for seeing the details of errors")
args = parser.parse_args()
if args.targets != None:
- scan(args.targets)
+ scan(args.targets, args.verbose)
-def scan(targets):
+def scan(targets, verbose):
for target in targets:
if not target[:5] == "http:" and not target[:6] == "https:":
target = "http://" + target
@@ -20,22 +21,28 @@ def scan(targets):
tlurl = urlparse(tltarget)
target = target + '/readme.html'
url = urlparse(target)
- r = requests.get(url.geturl())
- if r.status_code != 200:
- t = requests.get(tlurl.geturl())
- w = re.compile(r'', re.I)
- n = w.search(t.text)
- if n:
- print "Site " + tlurl.netloc + tlurl.path + ": Running WordPress " + n.group(1)
- else:
- print "Site " + tlurl.netloc + tlurl.path + ": No version found"
+ try:
+ r = requests.get(url.geturl())
+ except requests.exceptions.ConnectionError, e:
+ print "Error: Unable to connect to " + tlurl.netloc
+ if verbose:
+ print e
else:
- v = re.compile(r"Version (\d+\.\d+\.?(\d+)?)", re.I)
- m = v.search(r.text)
- if m:
- print "Site " + tlurl.netloc + tlurl.path + ": Running WordPress " + m.group(1)
+ if r.status_code != 200:
+ t = requests.get(tlurl.geturl())
+ w = re.compile(r'', re.I)
+ n = w.search(t.text)
+ if n:
+ print "Site " + tlurl.netloc + tlurl.path + ": Running WordPress " + n.group(1)
+ else:
+ print "Site " + tlurl.netloc + tlurl.path + ": No version found"
else:
- print "Site " + tlurl.netloc + tlurl.path + ": No version found"
+ v = re.compile(r"Version (\d+\.\d+\.?(\d+)?)", re.I)
+ m = v.search(r.text)
+ if m:
+ print "Site " + tlurl.netloc + tlurl.path + ": Running WordPress " + m.group(1)
+ else:
+ print "Site " + tlurl.netloc + tlurl.path + ": No version found"