Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pycurl
- import re
- import random
- from random import choice
- def random_user():
- global agent
- user = ['Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))',
- 'Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)',
- 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)',
- 'Mozilla/5.0 (X11; U; Linux i586; de; rv:5.0) Gecko/20100101 Firefox/5.0',
- 'Mozilla/5.0 (X11; U; Linux amd64; rv:5.0) Gecko/20100101 Firefox/5.0 (Debian)',
- 'Mozilla/5.0 (X11; U; Linux amd64; en-US; rv:5.0) Gecko/20110619 Firefox/5.0',
- 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; chromeframe/12.0.742.112)',
- 'Opera/9.80 (X11; Linux i686; U; ru) Presto/2.8.131 Version/11.11',
- 'Opera/9.80 (X11; Linux i686; U; es-ES) Presto/2.8.131 Version/11.11',
- 'Mozilla/5.0 (Windows NT 5.1; U; en; rv:1.8.1) Gecko/20061208 Firefox/5.0 Opera 11.11']
- agent = random.choice(user)
- def random_ref():
- global ref
- reflist = ['https://google.com.vn',
- 'https://facebook.com']
- ref = random.choice(reflist)
- def layproxy():
- global proxylist
- proxy_file = 'proxy.txt'
- proxylist = [];
- with open(proxy_file) as proxy:
- for line in proxy.readlines():
- search = re.search('p:(.*):p',line)
- if search:
- search_ok = search.group(1)
- proxylist.append(search_ok)
- def test(url,proxy,agent,ref):
- try:
- curl = pycurl.Curl()
- curl.setopt(pycurl.URL, url)
- curl.setopt(pycurl.CONNECTTIMEOUT, 5)
- curl.setopt(pycurl.TIMEOUT, 8)
- curl.setopt(pycurl.USERAGENT,agent)
- curl.setopt(pycurl.REFERER, ref)
- curl.setopt(pycurl.NOSIGNAL, 1)
- if proxy != '':
- curl.setopt(pycurl.PROXY, proxy);
- curl.setopt(pycurl.COOKIEFILE,'cookie.txt')
- curl.setopt(pycurl.COOKIEJAR,'cookie.txt')
- curl.setopt(pycurl.SSL_VERIFYHOST, 0)
- curl.setopt(pycurl.FOLLOWLOCATION, 1)
- curl.setopt(pycurl.SSL_VERIFYPEER, 0)
- curl.setopt(pycurl.MAXREDIRS, 5)
- curl.setopt(pycurl.VERBOSE, True)
- curl.perform()
- curl.close()
- except pycurl.error, error:
- errno, errstr = error
- print 'An error occurred: ', errstr
- def main():
- layproxy()
- while True:
- for proxy in proxylist:
- random_user()
- random_ref()
- test('http://xzone7.blogspot.com/',proxy,agent,ref)
- test('http://xzone7.blogspot.com/2013/06/su-ngu-dot-cua-admin-forum.html',proxy,agent,ref)
- test('http://xzone7.blogspot.com/2013/06/auto-register-login-final.html',proxy,agent,ref)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement