Привет, Гость ( Вход | Регистрация )


[ Каскадный ] · Стандартный · Линейный+

> Logon na server ASP iz Perl script

Gesha
post Понедельник, 13 Мая 2002, 17:24
Сообщение #1


Опытный кинолюбитель
***

Группа: Мемберы
Сообщений: 390
Регистрация: 10 Апр '02
Откуда: NY, NY, USA



2 Юзер   Цитировать


V silu obstoyatel'stv vinuzhden zapolnyat' mnogo form
Reshil avtomatizirovat' process - no ne mogu sdelat' logon na server
Vot kod scripta - imya servera, login i pasw - real'nie
----------------------------------------------------------------
#!/usr/bin/perl -w

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common qw(POST);
use HTTP::Response;
use URI::Heuristic;
use HTTP::Cookies;

my $raw_url = 'www.************.com/admin';

open( OUTPUT, ">request.res") || die "File request.res can't be opened";
my $url = URI::Heuristic::uf_urlstr($raw_url);
$| = 1; # to flush next line
my $ua = LWP::UserAgent->new();

my $init_req = HTTP::Request->new(GET => $url);

my $response = $ua->request($init_req);
if ($response->is_error())
{
printf " %s\n", $response->status_line;
}
else
{
$init_cookie= HTTP::Cookies->new;
$init_cookie->extract_cookies($response);
$content = $response->as_string;
print OUTPUT $content;
}

$| = 1;
$login_req = POST 'http://www.**************.com/admin/index.asp',
[ UserName => '++++++++',
Password => '@@@@@@@@@',
action => 'Login'];
$init_cookie->add_cookie_header($login_req);

$req_txt = $login_req->as_string();
print OUTPUT $req_txt;

$response = $ua->request($login_req);
if ($response->is_error())
{
printf " %s\n", $response->status_line;
}
else
{
$content = $response->as_string;
print OUTPUT $content;
}
----------------------------------------------------------------
Vot kakoi otvet ya poluchayu:
http://www.*************.com/admin/admin_dblist.asp
Content-Length: 57
Content-Type: application/x-www-form-urlencoded
Cookie: ASPSESSIONIDGGGGGYQC=AJGDNIGANJLGIDMIKACNFKEI
Cookie2: $Version=1

UserName=+++++++++&Password=@@@@@@@@@@@&action=Login
HTTP/1.1 302 (Found) Object moved
Cache-Control: private
Connection: Keep-Alive
Date: Wed, 08 May 2002 16:59:39 GMT
Location: index.asp
Server: Microsoft-IIS/5.0
Content-Length: 130
Content-Type: text/html
Expires: Wed, 08 May 2002 16:59:40 GMT
Client-Date: Wed, 08 May 2002 16:48:47 GMT
Client-Peer: 209.125.209.156:80
Title: Object moved

<head><title>Object moved</title></head>
<body><h1>Object Moved</h1>This object may be found <a HREF="admin_dblist.asp">here</a>.</body>

-------------------------------------------------------------
Vopros - chego emu escho nado - mozhet kto znaet po kakomu printsipu on fil'truet request?

[This message has been edited by Gesha (edited 13 May 2002).]

User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topicStart Poll
Ответов
SerG_DivX
post Понедельник, 13 Мая 2002, 21:09
Сообщение #2


Опытный кинолюбитель
***

Группа: Мемберы
Сообщений: 256
Регистрация: 14 Мая '01
Откуда: Estonia, Tallinn



2 Юзер   Цитировать


Dlja avtomaticheskogo zapolnenija form sushestvuet programka - RoboForm (ochen udobnaja)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic
Gesha   Logon na server ASP iz Perl script   Понедельник, 13 Мая 2002, 17:24
SerG_DivX   Dlja avtomaticheskogo zapolnenija form sushestvuet...   Понедельник, 13 Мая 2002, 21:09


Reply to this topicTopic OptionsStart new topic
1 пользователей читают эту тему (1 гостей и 0 скрытых пользователей)
здесь находятся:
 

Lo-Fi Версия CMSBlog Сейчас: Воскресенье, 04 Мая 2025, 15:35