Hi monks, I am stuck on the grab some information from a cookies use LWP & HTTP. I'd like to ask some help with my problem.
I use the WireShark to grap some information as follows:
username=engineer&password=ARC%24eng%26123HTTP/1.0 200 OK
Set-Cookie: sysauth=648493960F100A5A0297276EED3F9D15; path=/cgi-bin/lu
+ci/;stok=7D13FC47E626011E8534793B2C7DF288
Content-Type: text/html
Cache-Control: no-cache
Expires: 0
I need to split the "sysauth=****" from above. I am not familiar with Perl&LWP.
Codes as follows:
#!/usr/bin/perl
use warnings;
use strict;
use LWP;
use HTTP
my $browser = LWP::UserAgent->new;
$browser->agent('localbot');
$browser->credentials(
'http://192.168.1.1/cgi-bin/luci/engineer/advanced/diagnostics
+/upgrade/:80',
'testing',#<- the $realm
'engineer' => '1234'
);
my $cookie_jar = HTTP::Cookies->new(
file => "/some/where/cookies.lwp",
autosave => 1,
);
$browser = LWP::UserAgent->new;
$browser->cookie_jar( $cookie_jar );
Q1: Can I grab the information like above, how to modify this code?
Q2:If not, how to implement this?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.