一个LWP的求助

1 view
Skip to first unread message

lemontv

unread,
Feb 25, 2010, 3:34:35 AM2/25/10
to PerlChina Mongers 讨论组
#!/usr/bin/perl

use strict;
use warnings;
use LWP;
use LWP::ConnCache;
use HTTP::Cookies;

my $url = 'http://www.renren.com/PLogin.do';
my $url2 = 'http://upload.renren.com/ReplyPost.do?thread=330492221';
my $url3 = 'http://group.renren.com/GetThread.do?
id=330492221&tribeId=283371586';
my $browser = LWP::UserAgent->new();
$browser->agent("Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.2)
Gecko/20100115 Firefox/3.6 GTB7.0");
$browser->cookie_jar(HTTP::Cookies->new());
$browser->conn_cache(LWP::ConnCache->new());
push @{$browser->requests_redirectable}, 'POST';
my $response = $browser->post($url,[
'email'=>'xxxx',
'password'=>'xxxx',
'origURL'=>'http://www.renren.com/Home.do',
'domain'=>'renren.com'],
);
my $resp = $browser->get($url3);
my $ak;
my $ac;
my $tsc_a;
my $groupAuTime;
my $at;
if($resp->content=~/name="ak" value="(\w+)"/){
$ak = $1;
}
if($resp->content=~/id="ac" value="(\w+)"/){
$ac = $1;
}
if($resp->content=~/id="tsc_a" value="(\w+)"/){
$tsc_a = $1;
}
if($resp->content=~/name="groupAuTime" value="(\w+)"/){
$groupAuTime = $1;
$at = $groupAuTime;
$at=~s/b/2/g;
}
#print "ak=$ak\nac=$ac\ntsc=$tsc_a\nGAT=$groupAuTime\n";
#print $resp->content;
$resp = $browser->post($url2,[
'body'=>'52000',
'citeid'=>'0',
'citename'=>'',
'submit'=>'',
'theFile'=>['bk.jpg'],
'ak'=>"$ak",
'tsc'=>"$tsc_a",
'ac'=>"$ac",
'groupAuTime'=>"$groupAuTime",
'at'=>"$at",
'tribeId'=>'283371586',
'curpage'=>'0',
],
'Content_Type'=>'form-data'
);
#print $resp->content;
print $resp->status_line;

人人品牌专区的自动回帖代码
'email'=>'xxxx',
'password'=>'xxxx',
帐号密码我就不提供了。
下面的是测试的目标贴
http://group.renren.com/GetThrea ... p;tribeId=283371586

经过一些抓包分析,发现可能是theFile有问题,浏览器发送的包theFile的值是空的,但我搞不定这个,有人帮忙看看么?
分析了一下,觉得有可能是回帖时候有些javascript没处理,javascript不懂,有没有人帮忙看看?

陈臻

unread,
Feb 25, 2010, 8:59:48 PM2/25/10
to perl...@googlegroups.com
勿作恶

> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
> 要向此网上论坛发帖,请发送电子邮件至 perl...@googlegroups.com
> 要取消订阅此网上论坛,请发送电子邮件至 perlchina+...@googlegroups.com
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>
>

--
-
http://www.54chen.com
http://twitter.com/54chen

Qiang (James)

unread,
Feb 26, 2010, 12:10:15 AM2/26/10
to perl...@googlegroups.com
lemontv wrote:

>
> 经过一些抓包分析,发现可能是theFile有问题,浏览器发送的包theFile的值是空的,但我搞不定这个,有人帮忙看看么?
> 分析了一下,觉得有可能是回帖时候有些javascript没处理,javascript不懂,有没有人帮忙看看?
>

如果有 js,你就把 js 的逻辑读懂,看往哪提交或加什么参数就行了。js 也不是
那么难读。

Qiang(James)

xsir317

unread,
Feb 26, 2010, 1:28:44 AM2/26/10
to perl...@googlegroups.com
firefox装一个Live Http Headers看看你发帖的时候提交的请求是什么样的,然后用脚本原样提交个请求。。。
 
不用管页面js~
 
有的页面js还真的是很难读懂,尤其是用了一些你不熟悉的js框架的时候。。。
2010-02-26


发件人: Qiang (James)
发送时间: 2010-02-26  13:10:26
抄送:
主题: Re: [PerlChina] 一个LWP的求助

zhihua zheng

unread,
Feb 27, 2010, 11:27:56 PM2/27/10
to perl...@googlegroups.com
有图片做验证码的,怎么搞定?多谢了!

Fangyuan

unread,
Feb 28, 2010, 2:20:34 AM2/28/10
to PerlChina Mongers 讨论组
去猜这个图片呗,有些麻烦

On Feb 28, 12:27 pm, zhihua zheng <zhihua.zh...@gmail.com> wrote:
> 有图片做验证码的,怎么搞定?多谢了!
>

> >http://group.renren.com/GetThrea... p;tribeId=283371586

lemontv

unread,
Feb 28, 2010, 2:42:29 AM2/28/10
to PerlChina Mongers 讨论组
我也在研究这个,你也在搞?

On 2月28日, 下午12时27分, zhihua zheng <zhihua.zh...@gmail.com> wrote:
> 有图片做验证码的,怎么搞定?多谢了!
>

> >http://group.renren.com/GetThrea... p;tribeId=283371586

lemontv

unread,
Feb 28, 2010, 2:44:53 AM2/28/10
to PerlChina Mongers 讨论组
谢谢,问题已经解决了,添加了一行Referer。

zhihua zheng

unread,
Feb 28, 2010, 8:40:52 PM2/28/10
to perl...@googlegroups.com
不是麻烦,是成功率极低,有没有别的办法?

2010/2/28 Fangyuan <chengfan...@gmail.com>
Reply all
Reply to author
Forward
0 new messages