[原创]用perl模拟http上网认证客户端

2009-05-13 01:46:30来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折


               
                需要perl的LWP包,可以到CPAN上下载。
安装顺序
Compress-Zlib-1.34.tar.gz
HTML-Tagset-3.04.tar.gz
HTML-Parser-3.45.tar.gz
URI-1.35.tar.gz
libwww-perl-5.803.tar.gz
所有包的安装方法都相同,如下
#perl Makefile.PL
#make
#make test
#make install
代码很简单,3个url要根据自己那里的服务器做修改。
#!/usr/bin/perl  -wt
# License
#
# re-perl is copyright u0u0
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
#Version  0.1        2005.6.5
require HTTP::Request;   
require HTTP::Response;   
require HTTP::Headers;   
require LWP;
#######################
$id='99999999999';       #阳光卡号
$passwd='999999';       #密码
$ip='172.24.6.32';       #本机ip
#######################
&init;
&main;
sub init{
  $ua = LWP::UserAgent->new;
  $header = new HTTP::Headers
    User-Agent=>'Mozilla/4.0 (compatible; MSIE5.0; Windows NT 5.0)',
    Content_Type=>"application/x-www-form-urlencoded",
    Accept=>"text/html";
}
sub login{
my $url="http://172.31.130.251/servlet/scpservlet.UserDataReqLoginServlet";
$loginconten="id=$id&inputpassword=&servicetype=201%2B&ip=$ip&password=$passwd&languagetype=0&operatingSystem=1&httpIp=211.95.166.57&RadiusVision=1&Domain=uestc";
$request = HTTP::Request->new(POST=>$url,$header,$loginconten);
$response = $ua->request($request);
print $response->content;
}
sub refresh{
my $url="http://172.31.130.251/ClientProcess.jsp";
$loginconten="MsgType=100&ISNNO=1000&LocalIP=$ip
&UserName=$id&olduserip=$ip&httpIp=211.95.166.57&isPNP=False";
$request = HTTP::Request->new(GET=>$url,$header,$loginconten);
$response = $ua->request($request);

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:m0n0wall之初体验

下一篇:这里可以做成一个FreeBSD技术学习的blog