校内网狗狗刷骨机完全版(不再维护)
由于时间关系,我没有用C语言写成程序,而是直接用perl语言写的。
基本原理就是,玩球,赚狗粮。然后喂养其他小狗赚骨头。
1.你必须知道什么是perl。
如果你用的Linux,Unix,那么他们会自带。如果你用的Windows,那么你只需要安装Active Perl。在windows的“运行”中输入"cmd"运行,然后输入"perl -v",如果出现版本信息之后,说明安装成功。
Windows用户可以到http://www.onlinedown.net/soft/8364.htm下载。
2.你必须要有HTTPLook。
你可以到我的上一篇文章中,查看说明。这是用来抓包,产生头文件的。
3.利用HTTPLook产生浏览器头文件。
在需要的情况下,首先打开HTTPLook的三角运行按钮。然后在IE或者FireFox做相关操作,然后关闭HTTPLook的正方形红色按钮。那么你就可以在HTTPLook中看到整个运行情况。将下面各个需要的内容,直接从右方拷贝下来,做成相应的txt文件。
dog_init.txt 登录狗狗时(必须在动作前开,登录完成后关闭HTPPLook的抓包功能,下面同理)。头文件第一行是GET /pet-profile.do?method=dogXML&actor...... 或者你可以直接看左边的URL地址,后面是否如此。
记住上面的PID和ACTOR_FID的数值,下面有用。
dog_pelt.txt 点击小狗抓球的动作时。头文件第一行是 POST /pet-profile.do
dog_store.txt 点击进入商店时。头文件第一行是GET /store.do
dog_buy.txt 点击购买5更骨头的食物时。头文件第一行是POST /store.do
dog_ids.txt 点击查看所有饿的狗时。头文件第一行是GET /hall.do?method=hungry
dog_hungry.txt 点击某一只饿狗时。头文件第一行是GET /hall.do?method=hungry
dog_feed.txt 点击给某一只狗喂食时。头文件第一行是POST /pet-profile.do
登录校内网,完成上面的步骤把上面的内容全部拷贝放到上述的文件中。
特别注意,在所有文件中,要把Accept-Encoding: 后面全部改成UTF-8。因为程序不会去解压zip格式。
下面是一个例子(dog_hungry.txt):
Accept: */*
Accept-Language: zh-CN
Referer: http://i.static.xiaonei.com/pet/swf/dog_v2.swf?ver=081016
x-flash-version: 9,0,124,0
Content-Type: application/x-www-form-urlencoded
UA-CPU: x86
Accept-Encoding: UTF-8
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648)
Host: dog.xiaonei.com
Connection: Keep-Alive
Cache-Control: no-cache
Cookie:..
4.运行下面的Perl文件。
dog4.pl 用于玩球产生狗粮。因为每5根骨头产生一次狗粮,因此玩球得分的概率还是非常高的。将所有的骨头全部换成狗粮。注意将文件中的PID=>XXXXXX和ACTOR_FID=>XXXXXXX改成上面你得到的值。登录狗狗时,可以在URL中看到。然后在命令行中进入文件目录(上述头文件也必须同在该目录下),运行perl dog4.pl就可以了。检查自己的骨头和狗粮是否发生变化,如果变化那么就成功了。
#crack dog
#Catch Ball -> buy food
use XML::Simple;
use Data::Dumper;
use Time::HiRes qw(gettimeofday);
use Digest::MD5 qw(md5_hex);
use LWP;
use constant PID=>XXXXXX;
use constant ACTOR_FID=>XXXXXXX;
use constant METHOD=>"pelt";
use constant APPURL=>"http://dog.xiaonei.com/";
use constant PROFILE_URL=>APPURL."pet-profile.do";
use constant XMLURL=>PROFILE_URL."?method=dogXML&actor%5Fid=".ACTOR_FID."&pid=".PID."&";
use constant STROE_URL=>APPURL."store.do";
use constant INI_HEADER_FILE=>"dog_init.txt";
use constant PELT_HEADER_FILE=>"dog_pelt.txt";
use constant STORE_HEADER_FILE=>"dog_store.txt";
use constant BUY_HEADER_FILE=>"dog_buy.txt";
%init_header = readhead(INI_HEADER_FILE);
%pelt_header = readhead(PELT_HEADER_FILE);
%store_header = readhead(STORE_HEADER_FILE);
%buy_header = readhead(BUY_HEADER_FILE);
&main;
sub main
{
print "start\n";
my $key = &getInit;
my $goal,$num;
my $catch = 0;
my $failed = 0;
while(1)
{
($key,$goal,$num) = pelt($key);
if($goal>0)
{
$catch++;
}else
{
$failed++;
}
print $catch.":".$failed."\tgoal=".$goal."\tbone=".$num."\n";
if($num>=5)
{
&buyfood;
}
my $range = 3;
my $random_number = 5+int(rand($range));
sleep($random_number);
}
}
#初始化
#返回key
sub getInit
{
my ($seconds, $microseconds) = gettimeofday();
$milliseconds = int($microseconds/1000);
#load user info
my $infourl = XMLURL."t=".$seconds.$milliseconds;
my $name = "INIT";
my $method = "GET";
my $file = httpcon(\$name,\$method,\$infourl,\%init_header);
my $xs1 = XML::Simple->new();
my $doc = $xs1->XMLin($file);
#print Dumper($doc),"\n";
my $pet = $doc->{'pet_id'}->{'content'};
my $bone = $doc->{'num_bones_available'}->{'content'};
my $key = $doc->{'key'};
print "init key:".$key."\tbone=".$bone."\n";
return $key;
}
#捡盘子输入一个key
#返回最后一次的@_[0]key,@_[1]goal,@_[2]bones
sub pelt
{
my($key) = @_;
my $code = $key."#".PID."#".ACTOR_FID;
$code = md5_hex($code);
my $content="code=".$code."&pid=".PID."&actor%5Fid=".ACTOR_FID."&method=".METHOD;
my $len = length($content);
my %headers=%pelt_header;
$headers{"Content-Length"}="$len";
my $name = "PELT";
my $method="POST";
my $url = PROFILE_URL;
my $file = httpcon(\$name,\$method,\$url,\%headers,\$content);
my @rst=split(/[\|]/,$file);
return ($rst[1],$rst[0],$rst[2]);
}
#buy food
sub buyfood{
my $name = "STORE";
my $method="GET";
my $url = STROE_URL;
my $file = httpcon(\$name,\$method,\$url,\%store_header);
my $b_tsc=0;
if($file=~/PET\.tsc\s+=\s+'(\w+)';/g)
{
$b_tsc=$1;
}
if($b_tsc eq 0)
{
return;
}
my $content = "method=buyfood&buy_id=1&buy_count=1&tsc=".$b_tsc;
my $len = length($content);
my %headers=%buy_header;
$headers{"Content-Length"}="$len";
my $name = "BUY";
my $method="POST";
my $url = STROE_URL;
$file = httpcon(\$name,\$method,\$url,\%headers,\$content);
print "Buy 5 foods.\n";
}
#sub : http connection
#input:
# $name, the connection name, to log
# $method, GET/POST
# $URL, complete URL
# %head, header,(opt)
# $content, content (opt, but must after %head)
#output:
# $WEB result
sub httpcon
{
my ($name,$method,$url,$head,$content) = @_;
my $num = @_;
my $agent = LWP::UserAgent->new;
my $request = HTTP::Request->new($$method=>$$url);
if($num>3)
{
$request->header(%$head);
}
if($num>4)
{
$request->content($$content);
}
my $res = $agent->request($request);
$res->is_success or print "$$name error:", $res->message,"\n";
$res->content;
}
#sub : readheadfile
#input : $filename
#output : %head
sub readhead
{
my($filename) = @_;
my %ret;
open MYFILE,"<$filename"
or die "Can't open head for append: $!";
my $str;
my @stuff = <MYFILE>;
close(MYFILE);
foreach $str (@stuff) {
#print $str;
chomp $str;
if($str=~/(\w+): (\w+)/g)
{
my @sp = split (/:/,$str,2);
$ret{$sp[0]}=$sp[1];
}
}
return %ret;
}
5.如果你有了足够的狗粮,比如几百几千甚至几万的。那么现在是把它变成骨头的时候了。运行下面的程序。同理,也要修改两个ID。如果你用骨头买了所有的东西之后,你想爬上热心排行榜,就先赚几千几万根骨头,然后把下文中的if($num > RESERVE_BONES)及其下面的四句前面的#删除,并且修改文件开始的RESERVE_BONES=>2000为你想保留的骨头数。此外如果你不想被人发现的话请修改sleep(5)中数字(最小为5,每5秒喂一只狗),修改成20,30的。下面运行这个程序,就可以不断的喂狗,赚粮再喂狗。
#crack dog
#feed dog <=> buy food
#version 7
use XML::Simple;
use Data::Dumper;
use Time::HiRes qw(gettimeofday);
use Digest::MD5 qw(md5_hex);
use LWP;
use constant PID=>XXXXX;
use constant ACTOR_FID=>XXXXXX;
use constant RESERVE_BONES=>2000;
use constant METHOD=>"doing";
use constant APPURL=>"http://dog.xiaonei.com/";
use constant PROFILE_URL=>APPURL."pet-profile.do";
use constant DOGIDS_URL=>APPURL."hall.do?method=hungry";
use constant XMLURL=>PROFILE_URL."?method=dogXML&actor%5Fid=".ACTOR_FID."&pid=";
use constant HUNGRY_HEADER_FILE=>"dog_hungry.txt";
use constant FEED_HEADER_FILE=>"dog_feed.txt";
use constant DOGS_HEADER_FILE=>"dog_ids.txt";
use constant STROE_URL=>APPURL."store.do";
use constant STORE_HEADER_FILE=>"dog_store.txt";
use constant BUY_HEADER_FILE=>"dog_buy.txt";
%hungry_header = readhead(HUNGRY_HEADER_FILE);
%feed_header = readhead(FEED_HEADER_FILE);
%dogids_header = readhead(DOGS_HEADER_FILE);
%store_header = readhead(STORE_HEADER_FILE);
%buy_header = readhead(BUY_HEADER_FILE);
&main;
sub main
{
print "start\n";
while(1)
{
$tt = localtime(time);
print "----------------------------------\n".
"Feed at $tt\n----------------------------------\n";
my ($is,@dogIds) = &getHungryDogs;
if($is eq 1)
{
#print "start feed upper dogs\n";
my $isSucceed=0,$id,$key,$goal,$num=0,$isHungry="false",$canFeed="false";
foreach $id (@dogIds)
{
($isSucceed,$key,$isHungry,$canFeed)= getHungryDogXMLFile($id);
if($isSucceed eq 1 && $isHungry eq "true" && $canFeed eq "true")
{
print "feed $id dog\t";
($isSucceed,$key,$goal,$num)= feed($key,$id);
if($isSucceed eq 1)
{
print "goal=".$goal."\tbone=".$num."\n";
}else
{
print "feed failed.\n"
}
}
sleep(5);
}
# if($num > RESERVE_BONES)
# {
# &buyfood;
# }
}
}
}
#初始化
#input: $petID
#返回isSucceed,key,isHungry,canFeed
sub getHungryDogXMLFile
{
my ($petid)=@_;
my ($seconds, $microseconds) = gettimeofday();
$milliseconds = int($microseconds/1000);
#load user info
my $infourl = XMLURL.$petid."&t=".$seconds.$milliseconds;
my $name = "HUNGRY";
my $method = "GET";
my ($succe,$file) = httpcon(\$name,\$method,\$infourl,\%hungry_header);
if($succe eq 1)
{
my $xs1 = XML::Simple->new();
my $doc = $xs1->XMLin($file);
#print Dumper($doc),"\n";
my $isHungry = $doc->{'is_pet_hungry'}->{'content'};
my $canFeed = $doc->{'can_feed'}->{'content'};
my $key = $doc->{'key'};
# print "init key:".$key."\tbone=".$bone."\n";
return (1,$key,$isHungry,$canFeed);
}else
{
#failed
return (0,0,0,0);
}
}
#捡盘子输入一个key,petid
#返回最后一次的@_[0]isSucceed,@_[1]key,@_[2]goal,@_[3]bones
sub feed
{
my($key,$petid) = @_;
#code + "#" + INFO["pet_id"] + "#" + INFO["actor_id"];
my $code = $key."#".$petid."#".ACTOR_FID;
$code = md5_hex($code);
my $content="code=".$code."&active%5Fid=1&pid=".$petid."&actor%5Fid=".ACTOR_FID."&method=".METHOD;
my $len = length($content);
my %headers=%feed_header;
$headers{"Content-Length"}="$len";
my $name = "FEED";
my $method="POST";
my $url = PROFILE_URL;
my ($succe,$file) = httpcon(\$name,\$method,\$url,\%headers,\$content);
if($succe eq 1)
{
my @rst=split(/[\|]/,$file);
return (1,$rst[1],$rst[0],$rst[2]);
}else
{
return (0,0,0,0);
}
}
#buy food
sub buyfood{
my $name = "STORE";
my $method="GET";
my $url = STROE_URL;
my ($isSucceed,$file) = httpcon(\$name,\$method,\$url,\%store_header);
if($isSucceed eq 1)
{
my $b_tsc=0;
if($file=~/PET\.tsc\s+=\s+'(\w+)';/g)
{
$b_tsc=$1;
}
if($b_tsc eq 0)
{
return;
}
my $content = "method=buyfood&buy_id=3&buy_count=1&tsc=".$b_tsc;
my $len = length($content);
my %headers=%buy_header;
$headers{"Content-Length"}="$len";
my $name = "BUY";
my $method="POST";
my $url = STROE_URL;
($isSucceed,$file) = httpcon(\$name,\$method,\$url,\%headers,\$content);
if($isSucceed eq 1)
{
print "***** Buy 40 foods. **********\n";
}else
{
print "***** Did not buy foods. *****\n";
}
}
}
#output:$isSucceed, @_, pets' ids
sub getHungryDogs{
my $name = "DOGIDS";
my $method="GET";
my $url = DOGIDS_URL;
my ($succe,$file) = httpcon(\$name,\$method,\$url,\%dogids_header);
if($succe eq 1)
{
my @ret;
my $index=0;
while($file=~/pet-profile.do\?pid=(\w+)\"><img/g)
{
$ret[$index]= $1;
#print "id:",$1,"\n";
$index++;
}
return (1,@ret);
}else
{
return (0,@ret);
}
}
#sub : http connection
#input:
# $name, the connection name, to log
# $method, GET/POST
# $URL, complete URL
# %head, header,(opt)
# $content, content (opt, but must after %head)
#output:
# $isSuccess 1/0
# $WEB result
sub httpcon
{
my ($name,$method,$url,$head,$content) = @_;
my $num = @_;
my $agent = LWP::UserAgent->new;
my $request = HTTP::Request->new($$method=>$$url);
if($num>3)
{
$request->header(%$head);
}
if($num>4)
{
$request->content($$content);
}
my $res = $agent->request($request);
if($res->is_success)
{
return (1,$res->content);
}else
{
print "$$name error:", $res->message,"\n";
return (0,"");
}
}
#sub : readheadfile
#input : $filename
#output : %head
sub readhead
{
my($filename) = @_;
my %ret;
open MYFILE,"<$filename"
or die "Can't open head for append: $!";
my $str;
my @stuff = <MYFILE>;
close(MYFILE);
foreach $str (@stuff) {
#print $str;
chomp $str;
if($str=~/(\w+): (\w+)/g)
{
my @sp = split (/:/,$str,2);
$ret{$sp[0]}=$sp[1];
}
}
return %ret;
}
当然,如果你懂得Perl编程的话,可以直接调用我的程序,完成狗狗里的所有动作,也可以改写成C++语言的程序。
声明:版权所有,不维护和回答问题,对使用者造成的损失不负责。如果狗狗程序发生改变,而导致程序失效,请自己关闭程序。本人对该版本不再升级,其他用户可以修改、学习、使用和发布。