#LINUXQQ PY刷流量工具 #www.linuxqq.net 有许多可用的PY脚本哦!~!~ import re,_winreg,glob import os import urllib import sys from PAM30 import PAMIE from time import sleep from random import randint #注:在使用IE7以上的浏览器须将是否关闭所有选项卡的勾点上 否则会造成程序死循环 #================清除COOKIE================否则百度不会计算访问,请在程序第67行修改自己电脑路劲 def CleanDir( Dir ): if os.path.isdir( Dir ): paths = os.listdir( Dir ) for path in paths: filePath = os.path.join( Dir, path ) if os.path.isfile( filePath ): try: os.remove( filePath ) except os.error: autoRun.exception( "remove %s error." %filePath )#引入logging elif os.path.isdir( filePath ): if filePath[-4:].lower() == ".svn".lower(): continue shutil.rmtree(filePath,True) return True #================获取网站代理地址 正则可自己去写,获得更多的代理地址# def get_proxy(url,i): print 'getting the proxy...' p=re.compile("(\d*.\d*.\d*.\d*:\d+)") try: webdata = urllib.urlopen("http://www.adminym.com/ip/"+url+"_"+str(i)+".html").read() except: print "something error while read the web...please check whether it has error..." sys.exit(1) get=p.findall(webdata) for ip in get: alterip("1",ip) #===============将获取到的IP地址在注册表中进行修改IE代理# def alterip(sw,ip=None): key=_winreg.OpenKey(_winreg.HKEY_CURRENT_USER,r"Software\Microsoft\Windows\CurrentVersion\Internet Settings",0,_winreg.KEY_ALL_ACCESS) value,type=_winreg.QueryValueEx(key,"ProxyServer") if sw=="0": _winreg.SetValueEx(key,'ProxyEnable',0,_winreg.REG_SZ,"0") if sw=="1": _winreg.SetValueEx(key,'ProxyEnable',0,_winreg.REG_SZ,"1") if _winreg.SetValueEx(key,'ProxyServer',0,_winreg.REG_SZ,ip): print "IP更换失败" else: print "更换成功" iepam() _winreg.CloseKey(key) #==============IE点击模块# def iepam(): ie=PAMIE() ie._ie.Navigate('http://www.baidu.com') #==============关键词模块# if ie.setTextBox("wd", "python")!=False: ie.clickButton("su") sleep(3) ie.clickLink(ie.getLink(unicode("Python Programming Language – Official Website ","cp936"))) #=============随机停留时间======= sleep(randint(5,20)) #=============正确填写自己电脑的COOKIE路劲# CleanDir("C:\Documents and Settings\Default User\Cookies") #ie._ie.Quit() os.system('taskkill /IM iexplore.exe') #=============main======# def main(): #=============代理网址后缀是什么? 例http://www.adminym.com/ip/29741.html 输入29741即可# url=raw_input("请输入代理网址后缀") i=0 while i < 20: alterip(0) get_proxy(url,i) i += 1 if __name__=="__main__": main()