[原创]用perl模拟http上网认证客户端
2009-05-13 01:46:30来源:未知 阅读 ()
需要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系统共享上网问题! 2009-05-13
- putty使用ssh2登录*nix 下openssh的注意事项 2009-05-13
- freebsd6+openvpn+nat转发共享上网无痛设置 2009-05-13
- pure-ftpd+mysql用户认证安装 2009-05-13
- dhcp租约文件中的语句 2009-05-13
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash