[NETFRAME] Net::Frame issue
GomoR
gomor at gomor.org
Tue Nov 24 08:47:49 CET 2009
On Tue, Nov 24, 2009 at 12:57:15AM +0100, Roman Pierce wrote:
> Dear gomor,
> my name is Roman.
Hi,
next time, please ask to netframe mailing list:
http://lists.gomor.org/mailman/listinfo/netframe
> Actually I'm really interested in the security field and I'm developing my
> first security oriented scripts.
> I've two questions for you.
> 1) I wrote this simple subroutine to determine if an UDP port is open or
> closed and I'm actually using NetPacket::IP and NetPacket::ICMP.
> I would like to replace the little piece of code by using your
> Net::Frame::Layer::IPv4 and ICMPv4, but I'm encountering a problem.
> Here is the first code:
>
> #!/usr/bin/perl
# Always add that
use strict;
use warnings;
> use IO::Select;
> use IO::Socket;
> use NetPacket::IP;
> use NetPacket::ICMP;
>
> sub checkudp {
[..]
> if ( $readhandle == $icmps ) {
>
> $icmps -> recv($raw, $maxlen, 0);
>
> $ip = NetPacket::IP -> decode($raw);
> $icmp = NetPacket::ICMP -> decode($ip -> {data});
# Try with that
use Net::Frame::Simple;
$icmp = Net::Frame::Simple->new(raw => $raw, firstLayer => 'ICMPv4');
$type = $icmp->ref->{ICMPv4}->type;
$code = $icmp->ref->{ICMPv4}->code;
> if ($type == 3 && ($code == 1 || $code == 2 || $code == 9 ||
> $code == 10 || $code == 13)) { return 0; } # Filtered (ICMP Reply)
> else { return 2; } # Closed
>
> }
>
> }
[..]
> Can you help me ?
> Thanks you really
>
>
> PS. You wrote the Net::Packet::CDP, but i cannot find a
> Net::Frame::Layer::CDP implementation. Shall i use this module instead to
> generate CDP packet, together with Net::Frame::Layer::ETH and LLC ?
Currently, you cannot combine Net::Packet with Net::Frame. Or it will
be hard to do. And I don't have written Net::Frame::Layer::CDP either.
Regards,
--
^ ___ ___ http://www.GomoR.org/ <-+
| / __ |__/ Research Engineer |
| \__/ | \ ---[ zsh$ alias psed='perl -pe ' ]--- |
+--> Net::Frame <=> http://search.cpan.org/~gomor/ <---+
More information about the netframe
mailing list