[wls81@cnsz040318 f5httpconsole]$ tail -f error.20130819.log
[Mon Aug 19 14:21:31 2013] [error] [client 10.13.44.176] malformed header from script. Bad header=\xc1\xac\xbd\xd3\xca\xa7\xb0\xdc: f5login
[Mon Aug 19 14:21:38 2013] [error] [client 10.13.44.176] malformed header from script. Bad header=\xc1\xac\xbd\xd3\xca\xa7\xb0\xdc: f5login
[Mon Aug 19 14:22:22 2013] [error] [client 10.13.44.176] malformed header from script. Bad header=\xc1\xac\xbd\xd3\xca\xa7\xb0\xdc: f5login
[Mon Aug 19 14:35:31 2013] [error] [client 10.13.44.176] malformed header from script. Bad header=\xc1\xac\xbd\xd3\xca\xa7\xb0\xdc: f5login
[Mon Aug 19 18:17:22 2013] [error] [client 10.13.44.176] malformed header from script. Bad header=\xc1\xac\xbd\xd3\xca\xa7\xb0\xdc: f5login
[Mon Aug 19 18:17:37 2013] [error] [client 10.13.44.176] malformed header from script. Bad header=\xc1\xac\xbd\xd3\xca\xa7\xb0\xdc: f5login
[Mon Aug 19 18:17:46 2013] [error] [client 10.13.44.176] malformed header from script. Bad header=\xc1\xac\xbd\xd3\xca\xa7\xb0\xdc: f5login
[Mon Aug 19 18:27:21 2013] [error] [client 10.13.44.176] malformed header from script. Bad header=\xc1\xac\xbd\xd3\xca\xa7\xb0\xdc: f5login
[Mon Aug 19 18:27:23 2013] [error] [client 10.13.44.176] malformed header from script. Bad header=\xc1\xac\xbd\xd3\xca\xa7\xb0\xdc: f5login
[Mon Aug 19 18:27:24 2013] [error] [client 10.13.44.176] malformed header from script. Bad header=\xc1\xac\xbd\xd3\xca\xa7\xb0\xdc: f5login
[Mon Aug 19 18:28:49 2013] [error] [client 10.13.44.176] malformed header from script. Bad header=\xc1\xac\xbd\xd3\xca\xa7\xb0\xdc: f5login
^[[A[Mon Aug 19 18:33:18 2013] [error] [client 10.13.44.176] malformed header from script. Bad header=\xc1\xac\xbd\xd3\xca\xa7\xb0\xdc: f5login
[Mon Aug 19 18:33:35 2013] [error] [client 10.13.44.176] malformed header from script. Bad header=\xc1\xac\xbd\xd3\xca\xa7\xb0\xdc: f5login
perl代码如下:
[wls81@cnsz040318 cgi-bin]$ vi f5login
#!/usr/bin/perlnew
use lib ('/wls/apache/appsystems/admconsole/lib/');
#use strict;
use warnings;
use File::Basename;
use CGI qw(:standard);
use Cwd 'abs_path';
use HttpMan;
use CommonConfig;
use Data:umper;
use LWP::UserAgent;
use Crypt::SSLeay;
use HTTP::Cookies;
use Utils;
use IO::File;
my $host=param('host');
my $url = 'https://$host/tmui/login.jsp';
# 获得COOKIE
my $cookie_file = "/tmp/lwp_cookies.txt";
my $cookie_jar = HTTP::Cookies->new(file => $cookie_file,autosave => 1,ignore_discard => 1);
my $ua = LWP::UserAgent->new;
$ua->ssl_opts(verify_hostname=>0);
$ua->cookie_jar($cookie_jar);
$ua->timeout( 15 );
my $response = $ua->get( $url );
my $cookie;
if ( $response->is_success ) {
my $cookie_jar = HTTP::Cookies->new;
$cookie_jar->extract_cookies($response);
$cookie_temp = $cookie_jar->as_string();
}
my $header = HTTP::Headers->new();
$header->header('Accept' => 'image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*');
$header->header('Referer' => "https://$host/tmui/login.jsp"
$header->header('Accept-Language' =>'zh-CN');
$header->header('User-Agent' =>'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)');
$header->header('Content-Type' =>'application/x-www-form-urlencoded');
$header->header('Accept-Encoding' =>'gzip, deflate');
$header->header('Host' => $host);
$header->header('Content-Length' =>'29');
$header->header('Connection' =>'Keep-Alive');
$header->header('Cache-Control' =>'no-cache');
$header->header('Cookie' => $cookie_temp);
my $post_data = 'username=admin&passwd=Ig5Fbi9';
my $request = HTTP::Request->new('POST', $url,$header,$post_data);
my $response1 = $ua->request($request);
if($response1 -> is_success){
my $hh = $response1 -> headers_as_string;
#$hh=~s/^Client-SSL-.*\s+//igm;
print( "Content-Type: text/html\r\n" );
print('Status:' .$response1->status_line ."\r\n"
print("Set-Cookie:BACK_END_HOST=$hostATH=/\r\n"
print("Set-Cookie:type=f5; PATH=/\r\n"
print "$hh";
print("\r\n\r\n"
print $response1->content;
print "连接成功\n";
# print $response1 -> as_string() . "\n";
}else{
print "连接失败\n";
}