用linux的curl实现自动投票
2016-02-01 00:00
851 查看
http://513394217.blog.163.com/blog/static/10979118620125733237998/
curl命令
-------------------
给某个网址POST数据:
Linux代码
curl -d "id=1234" http://www.example.net/VoteAction.php 在curl里添加代理IP:
Linux代码
curl -x 219.136.206.29:80 -d "id=1234" http://www.example.net/VoteAction.php 如果我们要投票的网站只是检测代理IP,那么,上述命令就能自动投票了。我们用PHP脚本,去某些代理网站抓取代理IP和端口,然后用exec调用拼凑好的命令。
Php代码
/*------------获取proxy--------------*/
$urlList = array(
//'http://www.sooip.cn/Article_Show.asp?ArticleID=2141',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3961',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3959',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3956',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3951',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3948',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3946',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3944',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3939',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3933',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3909',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3907',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3904',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3900'
);
$result = array();
foreach($urlList as $url) {
echo "\nParsing web page: {$url}";
$tmpHtml = file_get_contents($url);
preg_match_all("/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+(\d{1,4})\s+HTTP/i", $tmpHtml, $matches);
for ($i=0; $i< count($matches[0]); $i++) {
$result[] = $matches[1][$i] . ":" . $matches[2][$i];
}
}
echo "\nParse excuted successfully!";
/*------------逐个投票--------------*/
echo "\n\n\nStart to vote:";
$i = 1;
$proxyList = $result;
while(!empt y($proxyList)) {
//empty多了个空格
$proxy = array_shift($proxyList);
echo "\n\nNo.{$i}\n";
//暂停,控制投票频率
$pauseSeconds = rand(10, 30);
echo "pausing: {$pauseSeconds} s\n";
sleep($pauseSeconds);
//执行投票
echo "vote from: {$proxy} \n";
echo "----------------------\n";
exec('curl -x ' . $proxy . ' -d "id=1234" http://www.example.net/VoteAction.php');
$i++;
}
echo "\ndone!";
curl命令
-------------------
给某个网址POST数据:
Linux代码
curl -d "id=1234" http://www.example.net/VoteAction.php 在curl里添加代理IP:
Linux代码
curl -x 219.136.206.29:80 -d "id=1234" http://www.example.net/VoteAction.php 如果我们要投票的网站只是检测代理IP,那么,上述命令就能自动投票了。我们用PHP脚本,去某些代理网站抓取代理IP和端口,然后用exec调用拼凑好的命令。
Php代码
/*------------获取proxy--------------*/
$urlList = array(
//'http://www.sooip.cn/Article_Show.asp?ArticleID=2141',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3961',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3959',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3956',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3951',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3948',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3946',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3944',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3939',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3933',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3909',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3907',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3904',
'http://www.sooip.cn/Article_Show.asp?ArticleID=3900'
);
$result = array();
foreach($urlList as $url) {
echo "\nParsing web page: {$url}";
$tmpHtml = file_get_contents($url);
preg_match_all("/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+(\d{1,4})\s+HTTP/i", $tmpHtml, $matches);
for ($i=0; $i< count($matches[0]); $i++) {
$result[] = $matches[1][$i] . ":" . $matches[2][$i];
}
}
echo "\nParse excuted successfully!";
/*------------逐个投票--------------*/
echo "\n\n\nStart to vote:";
$i = 1;
$proxyList = $result;
while(!empt y($proxyList)) {
//empty多了个空格
$proxy = array_shift($proxyList);
echo "\n\nNo.{$i}\n";
//暂停,控制投票频率
$pauseSeconds = rand(10, 30);
echo "pausing: {$pauseSeconds} s\n";
sleep($pauseSeconds);
//执行投票
echo "vote from: {$proxy} \n";
echo "----------------------\n";
exec('curl -x ' . $proxy . ' -d "id=1234" http://www.example.net/VoteAction.php');
$i++;
}
echo "\ndone!";
相关文章推荐
- Red Hat Enterprise Linux 7.0 Beta —— document
- (OK) CentOS7—mp4—avi—视频播放—SMPlayer
- 命令行浏览器 curl 命令详解,Linux中访问url地址
- 有关 CentOS 6 的问题
- linux mutt详解
- CentOS7—C++阅读器—source Insight
- CentOS 7 - The perfect desktop guide
- Kprobes—insight into the Linux kernel—replace kernel function with module
- Linux—Network—Socket—Programming—heartbeat—源代码
- 硬盘安装CentOS 6.0(超级详细图文教程)
- Kprobe在Linux kernel debug中的应用
- (OK) 调试cBPM—CentOS7—gdb—gdbserver—问题的解决—2—段错误
- Linux内核kprobe机制实现浅析
- 世界上最差的系统就是linux,双击不能安装软件
- linux awk命令详解
- linux下为php添加curl扩展的方法
- (OK) 调试cBPM—CentOS7—gdb—gdbserver—问题的解决—3—段错误
- Hashcat——Cracking WPA2 WPA with Hashcat in Kali Linux
- (OK) 调试cBPM—CentOS7—gdb—gdbserver—问题的解决—4—段错误
- 2013上半年—Linux操作系统—中考