Python Script: Retrieve Drupal Version

by Vince
in Blog
Hits: 2084

#!/usr/bin/python
import urllib2
import sys
import re

print "[*] Target URL format = http://www.mydomain.com"
host = raw_input("[*] Enter target URL: ")
path = '/CHANGELOG.txt'
combined = host + path
print
print ("fetching... ") + combined
url = urllib2.urlopen(combined)
html = url.readlines()[:2]
for line in html:
if re.match(r'Drupal', line):
print
sys.stdout.write(line)
print