Hey, i am getting this error while try to craft a TCP/IP frame by using modules like Net:Frame. The error is:
Can't call method "payload" on an undefined value at /opt/ActivePerl-5.10/site/lib/Net/Frame/Layer/IPv4.pm line 251.
My code
my $target = '172.28.89.120';
my $port = '22';
use Net::Frame::Device;
use Net::Write::Layer3;
use Net::Frame::Simple;
use Net::Frame::Dump::Online;
use Net::Frame::Layer::IPv4;
use Net::Frame::Layer::TCP;
my $oDevice = Net::Frame::Device->new(target => $target);
my $ip4 = Net::Frame::Layer::IPv4->new(
src => '172.28.89.120',
#src => $oDevice->ip,
dst => $target,
);
my $tcp = Net::Frame::Layer::TCP->new(
dst => $port,
options => "\x02\x04\x54\x0b",
payload => 'rrrr'
);
my $oWrite = Net::Write::Layer3->new(dst => $target);
my $oDump = Net::Frame::Dump::Online->new(dev => $oDevice->dev);
$oDump->start;
my $oSimple = Net::Frame::Simple->new(
layers => [ $ip4, $tcp ],
);
$i=0;
while ($i<10)
{
$oWrite->open;
$oSimple->send($oWrite);
$oWrite->close;
$i++;
}
until ($oDump->timeout) {
if (my $recv = $oSimple->recv($oDump)) {
print "RECV:\n".$recv->print."\n";
last;
}
}
$oDump->stop;
This was working perfectly earlier but all of a sudden it started giving error though i have not chnaged the code. Please help !!
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.