刷流量程序代码
来源:互联网 发布:java split函数用法 编辑:程序博客网 时间:2024/05/01 05:16
流量精灵刷PTP520
经常有人找刷流量的程序,这个东西有时候也挺有用 的。这个虽然比较简单,但是提供了基本使用C++的刷流量的思路
#include <stdio.h>
#include <winsock2.h>
#include <winbase.h>
#pragma comment(lib,"ws2_32")
//#define BUF_SIZE 1024
#define RefreshTimes 10 //刷新次数
char host[128];
char path[128];
void main(int argc,char * argv[])
{
HANDLE hThread[RefreshTimes];
DWORD dwThread[RefreshTimes];
DWORD WINAPI SendThread(LPVOID lpParam);
void SetParam(); // Set host and path
int i;
SetParam();
for( i = 0 ; i < RefreshTimes ; i++ )
{
hThread = CreateThread(NULL,0,SendThread,(LPVOID)i,0,&dwThread);
if( hThread == NULL )
{
printf("/tCreateThread Failed./n");
exit(0);
}
Sleep(100); //100ms创建下一个线程
CloseHandle(hThread);
}
}
DWORD WINAPI SendThread(LPVOID lpParam) //数据发送线程
{
WSADATA wsd;
SOCKET local;
SOCKADDR_IN addr;
HOSTENT * Host = NULL;
if( WSAStartup(MAKEWORD(2,2),&wsd) != 0)
{
printf("/tFailed To Load Winsock Library!/n");
exit(0);
}
local = socket(AF_INET,SOCK_STREAM,0);
if( local == INVALID_SOCKET)
{
printf("/tFailed To Create Socket/n");
exit(0);
}
addr.sin_family = AF_INET;
addr.sin_port = htons(80);
addr.sin_addr.S_un.S_addr = inet_addr(host);
if( addr.sin_addr.S_un.S_addr == INADDR_NONE )
{
Host = gethostbyname(host);
if( Host == NULL )
{
printf("/tUnable To Resolve Server:%s/n",host);
return 0;
}
CopyMemory(&addr.sin_addr,Host->h_addr_list[0],Host->h_length);
printf("/tSend To:%s/n",inet_ntoa(addr.sin_addr));
}
if( SOCKET_ERROR == connect(local,(sockaddr*)&addr,sizeof(SOCKADDR)) )
{
printf("/tFailed To Connect To The Server!/n");
exit(0);
}
char SendBuf[512];
memset(SendBuf,'/0',512);
strcpy(SendBuf,"GET ");
char PartOne[] = " HTTP/1.1/r/nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, */*/r/nAccept-Language: zh-cn/r/nAccept-Encoding: gzip, deflate/r/nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)/r/nHost: ";
char PartTwo[] = "/r/nConnection: Keep-Alive/r/n/r/n";
strcat(SendBuf,path);
strcat(SendBuf,PartOne);
strcat(SendBuf,host);
strcat(SendBuf,PartTwo);
if( send(local,SendBuf,strlen(SendBuf)+1,0) == SOCKET_ERROR )
{
printf("/tSend Data Error./n");
}
closesocket(local);
WSACleanup();
return 0;
}
void SetParam()
{
char Host_Temp[128];
char Path_Temp[128];
printf("/n/tMade By dyong/n/tQQ:469892615/n/tEmail:dyong.syclover@163.com/n");
printf("/tGet The Host:");
gets(Host_Temp);
fflush(stdout);
strcpy(host,&Host_Temp[0]);
printf("/tGet The Path of WebPage:");
gets(Path_Temp);
strcpy(path,&ath_Temp[0]);
}
文章作者:dyong (http://dyong.syclover.cn)
文章来源:CUIT技术网 (http://icuit.cn)
代理刷流量(代码更新)
# ProxyBat_v1.3.py
import urllib2,time
# 生成错误日志
def errortype():
global line,num_Error
if(num_Error==0):
f_log.write("==========保护视力的分割线==========/n")
num_Error=num_Error+1
f_log.write(line)
f_log.write('/n')
# 死循环无休止的刷流量-_-!!!
while True:
# 用来记录发生错误的个数
num_Error=0
f_proxy=file('proxy.txt','r')
f_log=file('ErrLog.txt','a')
# 读取文件每一行的代理地址
while True:
line=f_proxy.readline()
if len(line)==0:
break
# 使用自己的代理地址,注意ProxyHandler()的参数必须是字典类型
# build_opener()创建一个实例句柄
# 使用这个句柄通过open方法访问目标网址
# 为了便于知道哪些代理地址不能用,这里我抛出了两个已知异常,并输出异常代理地址
# 最后打印出发生异常的个数
try:
proxy_handler = urllib2.ProxyHandler({'http':'http://'+line})
opener = urllib2.build_opener(proxy_handler)
opener.open('http://hi.baidu.com/sruingking/blog/item/ca74260931aa4385d1581bcd.html')
except urllib2.URLError:
print 'URLError! The bad proxy is %s'% line
errortype()
except urllib2.HTTPError:
print 'HTTPError! The bad proxy is %s'% line
errortype()
except:
print 'Unknown Error! The bad proxy is %s'% line
errortype()
f_proxy.close()
f_log.write('There are '+str(num_Error)+' Errors''/n')
f_log.close()
print '%d Errors'% num_Error
#休眠60秒同一IP短时间内算一次浏览量
time.sleep(60)
#!/usr/bin/perl
#脚本编写:ZV(zvrop_at_163.com),部分函数参考watercloud的getproxy脚本.
#用途赚钱
#程序会自动搜索baidu上能找到的代理,测试成功之后,对广告网站提供的URL进行模拟点击
#并虚拟一个随机但是存在的原始地址.
use strict;
use Data::Dump qw(dump);
use LWP::UserAgent;
use HTML::LinkExtor;
use URI::URL;
use URI::Escape;
use Getopt::Long;
use threads;
use threads::shared;
use Thread::Semaphore;
my $BAIDU="http://www.baidu.com/"; #搜索引擎,这里不要改了
my $m_key="http代理"; #搜索关键字,可以改,最好每人都不一样
my $m_much=100; #每次搜索多少页面
my $m_timeout=100; #测试代理的超时时间.一般不要改
my $m_test_site="http://www.[马赛克之].html";#目的站点,这个需要改到具体的广告点击后的地址.
my $m_referer="http://bbs.[马赛克之]/forums/index.php?showtopic=";#造假的网址
my $m_rand_max=50000; #造假的网址的随机ID范围
my @GGG; #存放广告的变量.
my $m_thread_num=5;
my $m_sem=Thread::Semaphore->new($m_thread_num);
my $m_get_num=0;
share $m_get_num;
&main();
sub main
{
my $i;
my %url_hist;
my @threads;
my $rurls;
get_gg($m_test_site);
my $m_raw_uri=$BAIDU . "s?rn=".$m_much."&wd=".uri_escape($m_key . " http");
for($i=0;;$i+=$m_much){
$rurls=get_proxy_pub_urls($m_raw_uri."&pn=".$i);
foreach (@$rurls)
{
next if exists($url_hist{$_});
my $rproxys=get_proxys($_);
my @t = &test_proxys($rproxys);
push @threads,@t;
}
foreach (@threads)
{
$_->join();
}
}
}
sub get_gg
{
my $search_uri=shift @_;
my $ua= LWP::UserAgent->new;
$ua->cookie_jar({});
$ua->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windws NT 5.1)');
$ua->timeout($m_timeout*3);
my $res_obj= $ua->get($search_uri);
exit 1 if (! $res_obj->is_success());
my $html_parse = HTML::LinkExtor->new();
$html_parse->parse($res_obj->as_string);
foreach ($html_parse->links)
{
next if $_->[0] ne "a";
push(@GGG,$_->[2]);
}
}
sub test_proxys
{
my $ref=shift @_;
my %proxy_hist;
my @threads;
foreach (@$ref)
{
next if exists($proxy_hist{$_});
$proxy_hist{$_}=1;
$m_sem->down();
my $t=threads->create("test_http_proxy",$_);
push(@threads,$t) if $t;
}
return @threads;
}
sub filter_url
{
return 1 if @_ != 2;
return 1 if $_[0] !~ /^http/;
return 1 if $_[1] !~ /^http/;
my $uri1=URI->new($_[0]);
my $uri2=URI->new($_[1]);
my $host1=$uri1->host;
my $host2=$uri2->host;
my $key1=substr($host1,index($host1,".")+1);
my $key2=substr($host2,index($host2,".")+1);
return 1 if $key1 eq $key2;
return 1 if $host1 eq $key2;
return 0;
}
sub get_proxy_pub_urls
{
my $search_uri=shift @_;
my $ua= LWP::UserAgent->new;
$ua->cookie_jar({});
$ua->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windws NT 5.1)');
$ua->timeout($m_timeout*3);
my $res_obj= $ua->get($search_uri);
exit 1 if (! $res_obj->is_success());
my $html_parse = HTML::LinkExtor->new();
$html_parse->parse($res_obj->as_string);
my @urls;
foreach ($html_parse->links)
{
next if $_->[0] ne "a";
next if filter_url($search_uri,$_->[2]);
push(@urls,$_->[2]);
}
return /@urls;
}
sub get_proxys
{
my $url=shift @_;
my @proxys;
my $ua= LWP::UserAgent->new;
$ua->cookie_jar({});
$ua->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windws NT 5.1)');
$ua->timeout($m_timeout*2);
my $res_obj= $ua->get($url);
next if (! $res_obj->is_success());
my $html=$res_obj->as_string;
while($html =~ m/(/d{1,3}/./d{1,3}/./d{1,3}/./d{1,3})/D+(?<!/=.)(/d{1,5})/xsg )
{
my $proxy="$1:$2";
pos($html);
push @proxys,$proxy;
}
return /@proxys;
}
sub test_http_proxy
{
return if @_ == 0;
$_=shift @_;
my ($proxy,$port)=split /:/,$_;
$_=$proxy . ":" . $port;
my $ua=LWP::UserAgent->new();
$ua->timeout($m_timeout);
$ua->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windws NT 5.1)');
$ua->proxy("http","http://" . $_);
my $count = @GGG;
my $desturl = @GGG[int(rand($count))];
my $req = HTTP::Request->new(GET => "$desturl");
$req->header('Referer' => $m_referer .int(rand($m_rand_max)));
my $res = $ua->request($req);
if($res->is_success())
{
my $html=$res->as_string;
if(length($html) > 1024 && $html =~ /html/i && /( $html =~ /table/i || $html =~ /div/i) )
{
$m_get_num++;
print "总共点击(".$m_get_num.")次,本次代理:$_/r/n";
}
}
$m_sem->up();
}
#include <stdio.h>
#include <winsock2.h>
#include <winbase.h>
#pragma comment(lib,"ws2_32")
//#define BUF_SIZE 1024
#define RefreshTimes 10 //刷新次数
char host[128];
char path[128];
void main(int argc,char * argv[])
{
HANDLE hThread[RefreshTimes];
DWORD dwThread[RefreshTimes];
DWORD WINAPI SendThread(LPVOID lpParam);
void SetParam(); // Set host and path
int i;
SetParam();
for( i = 0 ; i < RefreshTimes ; i++ )
{
hThread = CreateThread(NULL,0,SendThread,(LPVOID)i,0,&dwThread);
if( hThread == NULL )
{
printf("/tCreateThread Failed./n");
exit(0);
}
Sleep(100); //100ms创建下一个线程
CloseHandle(hThread);
}
}
DWORD WINAPI SendThread(LPVOID lpParam) //数据发送线程
{
WSADATA wsd;
SOCKET local;
SOCKADDR_IN addr;
HOSTENT * Host = NULL;
if( WSAStartup(MAKEWORD(2,2),&wsd) != 0)
{
printf("/tFailed To Load Winsock Library!/n");
exit(0);
}
local = socket(AF_INET,SOCK_STREAM,0);
if( local == INVALID_SOCKET)
{
printf("/tFailed To Create Socket/n");
exit(0);
}
addr.sin_family = AF_INET;
addr.sin_port = htons(80);
addr.sin_addr.S_un.S_addr = inet_addr(host);
if( addr.sin_addr.S_un.S_addr == INADDR_NONE )
{
Host = gethostbyname(host);
if( Host == NULL )
{
printf("/tUnable To Resolve Server:%s/n",host);
return 0;
}
CopyMemory(&addr.sin_addr,Host->h_addr_list[0],Host->h_length);
printf("/tSend To:%s/n",inet_ntoa(addr.sin_addr));
}
if( SOCKET_ERROR == connect(local,(sockaddr*)&addr,sizeof(SOCKADDR)) )
{
printf("/tFailed To Connect To The Server!/n");
exit(0);
}
char SendBuf[512];
memset(SendBuf,'/0',512);
strcpy(SendBuf,"GET ");
char PartOne[] = " HTTP/1.1/r/nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, */*/r/nAccept-Language: zh-cn/r/nAccept-Encoding: gzip, deflate/r/nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)/r/nHost: ";
char PartTwo[] = "/r/nConnection: Keep-Alive/r/n/r/n";
strcat(SendBuf,path);
strcat(SendBuf,PartOne);
strcat(SendBuf,host);
strcat(SendBuf,PartTwo);
if( send(local,SendBuf,strlen(SendBuf)+1,0) == SOCKET_ERROR )
{
printf("/tSend Data Error./n");
}
closesocket(local);
WSACleanup();
return 0;
}
void SetParam()
{
char Host_Temp[128];
char Path_Temp[128];
printf("/n/tMade By dyong/n/tQQ:469892615/n/tEmail:dyong.syclover@163.com/n");
printf("/tGet The Host:");
gets(Host_Temp);
fflush(stdout);
strcpy(host,&Host_Temp[0]);
printf("/tGet The Path of WebPage:");
gets(Path_Temp);
strcpy(path,&ath_Temp[0]);
}
文章作者:dyong (http://dyong.syclover.cn)
文章来源:CUIT技术网 (http://icuit.cn)
代理刷流量(代码更新)
# ProxyBat_v1.3.py
import urllib2,time
# 生成错误日志
def errortype():
global line,num_Error
if(num_Error==0):
f_log.write("==========保护视力的分割线==========/n")
num_Error=num_Error+1
f_log.write(line)
f_log.write('/n')
# 死循环无休止的刷流量-_-!!!
while True:
# 用来记录发生错误的个数
num_Error=0
f_proxy=file('proxy.txt','r')
f_log=file('ErrLog.txt','a')
# 读取文件每一行的代理地址
while True:
line=f_proxy.readline()
if len(line)==0:
break
# 使用自己的代理地址,注意ProxyHandler()的参数必须是字典类型
# build_opener()创建一个实例句柄
# 使用这个句柄通过open方法访问目标网址
# 为了便于知道哪些代理地址不能用,这里我抛出了两个已知异常,并输出异常代理地址
# 最后打印出发生异常的个数
try:
proxy_handler = urllib2.ProxyHandler({'http':'http://'+line})
opener = urllib2.build_opener(proxy_handler)
opener.open('http://hi.baidu.com/sruingking/blog/item/ca74260931aa4385d1581bcd.html')
except urllib2.URLError:
print 'URLError! The bad proxy is %s'% line
errortype()
except urllib2.HTTPError:
print 'HTTPError! The bad proxy is %s'% line
errortype()
except:
print 'Unknown Error! The bad proxy is %s'% line
errortype()
f_proxy.close()
f_log.write('There are '+str(num_Error)+' Errors''/n')
f_log.close()
print '%d Errors'% num_Error
#休眠60秒同一IP短时间内算一次浏览量
time.sleep(60)
#!/usr/bin/perl
#脚本编写:ZV(zvrop_at_163.com),部分函数参考watercloud的getproxy脚本.
#用途赚钱
#程序会自动搜索baidu上能找到的代理,测试成功之后,对广告网站提供的URL进行模拟点击
#并虚拟一个随机但是存在的原始地址.
use strict;
use Data::Dump qw(dump);
use LWP::UserAgent;
use HTML::LinkExtor;
use URI::URL;
use URI::Escape;
use Getopt::Long;
use threads;
use threads::shared;
use Thread::Semaphore;
my $BAIDU="http://www.baidu.com/"; #搜索引擎,这里不要改了
my $m_key="http代理"; #搜索关键字,可以改,最好每人都不一样
my $m_much=100; #每次搜索多少页面
my $m_timeout=100; #测试代理的超时时间.一般不要改
my $m_test_site="http://www.[马赛克之].html";#目的站点,这个需要改到具体的广告点击后的地址.
my $m_referer="http://bbs.[马赛克之]/forums/index.php?showtopic=";#造假的网址
my $m_rand_max=50000; #造假的网址的随机ID范围
my @GGG; #存放广告的变量.
my $m_thread_num=5;
my $m_sem=Thread::Semaphore->new($m_thread_num);
my $m_get_num=0;
share $m_get_num;
&main();
sub main
{
my $i;
my %url_hist;
my @threads;
my $rurls;
get_gg($m_test_site);
my $m_raw_uri=$BAIDU . "s?rn=".$m_much."&wd=".uri_escape($m_key . " http");
for($i=0;;$i+=$m_much){
$rurls=get_proxy_pub_urls($m_raw_uri."&pn=".$i);
foreach (@$rurls)
{
next if exists($url_hist{$_});
my $rproxys=get_proxys($_);
my @t = &test_proxys($rproxys);
push @threads,@t;
}
foreach (@threads)
{
$_->join();
}
}
}
sub get_gg
{
my $search_uri=shift @_;
my $ua= LWP::UserAgent->new;
$ua->cookie_jar({});
$ua->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windws NT 5.1)');
$ua->timeout($m_timeout*3);
my $res_obj= $ua->get($search_uri);
exit 1 if (! $res_obj->is_success());
my $html_parse = HTML::LinkExtor->new();
$html_parse->parse($res_obj->as_string);
foreach ($html_parse->links)
{
next if $_->[0] ne "a";
push(@GGG,$_->[2]);
}
}
sub test_proxys
{
my $ref=shift @_;
my %proxy_hist;
my @threads;
foreach (@$ref)
{
next if exists($proxy_hist{$_});
$proxy_hist{$_}=1;
$m_sem->down();
my $t=threads->create("test_http_proxy",$_);
push(@threads,$t) if $t;
}
return @threads;
}
sub filter_url
{
return 1 if @_ != 2;
return 1 if $_[0] !~ /^http/;
return 1 if $_[1] !~ /^http/;
my $uri1=URI->new($_[0]);
my $uri2=URI->new($_[1]);
my $host1=$uri1->host;
my $host2=$uri2->host;
my $key1=substr($host1,index($host1,".")+1);
my $key2=substr($host2,index($host2,".")+1);
return 1 if $key1 eq $key2;
return 1 if $host1 eq $key2;
return 0;
}
sub get_proxy_pub_urls
{
my $search_uri=shift @_;
my $ua= LWP::UserAgent->new;
$ua->cookie_jar({});
$ua->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windws NT 5.1)');
$ua->timeout($m_timeout*3);
my $res_obj= $ua->get($search_uri);
exit 1 if (! $res_obj->is_success());
my $html_parse = HTML::LinkExtor->new();
$html_parse->parse($res_obj->as_string);
my @urls;
foreach ($html_parse->links)
{
next if $_->[0] ne "a";
next if filter_url($search_uri,$_->[2]);
push(@urls,$_->[2]);
}
return /@urls;
}
sub get_proxys
{
my $url=shift @_;
my @proxys;
my $ua= LWP::UserAgent->new;
$ua->cookie_jar({});
$ua->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windws NT 5.1)');
$ua->timeout($m_timeout*2);
my $res_obj= $ua->get($url);
next if (! $res_obj->is_success());
my $html=$res_obj->as_string;
while($html =~ m/(/d{1,3}/./d{1,3}/./d{1,3}/./d{1,3})/D+(?<!/=.)(/d{1,5})/xsg )
{
my $proxy="$1:$2";
pos($html);
push @proxys,$proxy;
}
return /@proxys;
}
sub test_http_proxy
{
return if @_ == 0;
$_=shift @_;
my ($proxy,$port)=split /:/,$_;
$_=$proxy . ":" . $port;
my $ua=LWP::UserAgent->new();
$ua->timeout($m_timeout);
$ua->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windws NT 5.1)');
$ua->proxy("http","http://" . $_);
my $count = @GGG;
my $desturl = @GGG[int(rand($count))];
my $req = HTTP::Request->new(GET => "$desturl");
$req->header('Referer' => $m_referer .int(rand($m_rand_max)));
my $res = $ua->request($req);
if($res->is_success())
{
my $html=$res->as_string;
if(length($html) > 1024 && $html =~ /html/i && /( $html =~ /table/i || $html =~ /div/i) )
{
$m_get_num++;
print "总共点击(".$m_get_num.")次,本次代理:$_/r/n";
}
}
$m_sem->up();
}
- 刷流量程序代码
- 程序代码
- 程序代码
- 程序代码
- 如何使用流量精灵刷网站流量
- shell脚本刷流量
- 刷流量、刷IP——流量精灵(网站流量狂刷器流量精灵去广告版)
- 刷页面流量小工具
- PYTHON实现刷流量工具
- 广告联盟刷流量方法
- C#刷流量的原理
- 分页程序代码
- login程序代码
- 编写程序代码
- 万年历程序代码
- 关机程序代码
- c++程序代码
- 程序代码体会
- 添加状态条
- Oracle 学习:PL/SQL循序渐进全面学习教程--课程十三 使用组合数据类型* 游标操纵数据
- js表单验证
- first blog here
- 一个properties文件读写组件类,解决java自带的properties文件处理薄弱问题
- 刷流量程序代码
- Oracle 学习:PL/SQL循序渐进全面学习教程--最后一课 异常处理
- emacs 运行外部程序
- 客户端CheckBox按照选择的顺序进行排序
- java读.properties配置文件附C#的办法
- 【原创】C#导出数据到EXCEL方法谈(附实例源码和超级无敌详细讲解)
- 第一次讲课
- 开发人员一定要加入收藏夹的网站
- 眼前的世界