Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re,requests,string,random,threading,os,inspect,gc,pdb,urllib2,urllib
- def load(filename):
- with open(filename) as f:
- return [line.rstrip() for line in f]
- def getpage():
- try:
- curl = urls.pop(0)
- thepage1 = requests.get(curl).text
- global ctot
- if "Contact Us" in thepage1:
- slist.write("\n" +curl)
- ctot = ctot + 1
- except:
- pass
- finally:
- if len(urls)>0 :
- getpage()
- urls = load('res\urls.txt')
- slist = open('res\output.txt', 'a+')
- totallinks = len(urls)
- global ctot
- ctot = 0
- noofthreads = input("Enter the Number of Threads : ")
- tout = input("Enter TimeOut Value : ")
- if (totallinks<noofthreads) :
- noofthreads = totallinks
- if totallinks>0 :
- for xd in range(0,noofthreads):
- t = threading.Thread(target=getpage)
- t.daemon = True
- t.start()
- tarray.append(t)
- for t in tarray:
- t.join()
- slist.close()
- print "Program Completed Its Execution"
- raw_input("Press ENTER to Exit the Program")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement