mechanize python xe 2324

Solutions on MaxInterview for mechanize python xe 2324 by the best coders in the world

showing results for - "mechanize python xe 2324"
Armand
13 Aug 2016
1def check():
2    # Browser
3    br = mechanize.Browser()
4
5    # Cookie Jar
6    # cj = cookielib.LWPCookieJar()
7    # br.set_cookiejar(cj)
8
9    # Browser options
10    br.set_handle_equiv(True)
11    #br.set_handle_gzip(True)
12    br.set_handle_redirect(True)
13    br.set_handle_referer(True)
14    br.set_handle_robots(False)
15    br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
16
17    # br.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36')]
18    br.addheaders = [('User-agent', 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; BOIE9;ENUSMSNIP)')]
19
20    try:
21        FILE  = open ("domains.txt","r" )
22        hosts = FILE.readlines()
23        FILE.close()
24    except IOError:
25        print "[+] domains.txt not found!\n"
26        sys.exit(1)
27
28    for host in hosts:
29	try:
30		print "[*] Connecting to:", host.strip()
31        	br.open(host.strip(), timeout=1.0)
32        	response = br.response()
33		find_script(response.read(), host.strip())
34        	find_iframe(response.read(), host.strip())
35		# sys.exit(1)
36        except Exception, e:
37		if debug:
38			log("|Connection error: " + str(e))
39                print "[*] Connection error:", str(e)
40                pass 
similar questions
queries leading to this page
mechanize python xe 2324