def check():
br = mechanize.Browser()
br.set_handle_equiv(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
br.addheaders = [('User-agent', 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; BOIE9;ENUSMSNIP)')]
try:
FILE = open ("domains.txt","r" )
hosts = FILE.readlines()
FILE.close()
except IOError:
print "[+] domains.txt not found!\n"
sys.exit(1)
for host in hosts:
try:
print "[*] Connecting to:", host.strip()
br.open(host.strip(), timeout=1.0)
response = br.response()
find_script(response.read(), host.strip())
find_iframe(response.read(), host.strip())
except Exception, e:
if debug:
log("|Connection error: " + str(e))
print "[*] Connection error:", str(e)
pass