Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

NetPacket::TCP and "options" field
I'm using NetPacket::TCP to examine network packets. Everything seems
to be working, except I can't get anything out of the "options" field.
For example, $tcp->{options} is always empty. Has anyone had any
success with this module? I'm wondering if I need to further unpack
this field or something.

Thanks.

Report this thread to moderator Post Follow-up to this message
Old Post
eugk007@gmail.com
02-16-05 08:57 AM


Re: NetPacket::TCP and "options" field
eugk007@gmail.com wrote:
> I'm using NetPacket::TCP to examine network packets. Everything seems
> to be working, except I can't get anything out of the "options"
field.
> For example, $tcp->{options} is always empty. Has anyone had any
> success with this module? I'm wondering if I need to further unpack
> this field or something.
>
> Thanks.

I don't know how to do it with NetPacket, but with Net::Packet,
it is easy:

# To build a TCP SYN packet with MSS=1460 option
# (padding is done auto):
my $tcp = Net::Packet::TCP->new(
dst => 22,
options => "\x02\x04\x05\xb4",
);

# To display options field:
print unpack('H*', $frame->l4->options), "\n";

--
^  ___  ___    FreeBSD Network - http://www.GomoR.org/ <-+
| / __ |__/     Security Engineer, searching for work    |
| \__/ |  \     ---[ zsh$ alias psed='perl -pe ' ]---    |
+-->  Net::Packet <=> http://search.cpan.org/~gomor/  <--+

----- End forwarded message -----

Report this thread to moderator Post Follow-up to this message
Old Post
gomor-usenet@gomor.org
02-16-05 08:57 PM


Re: NetPacket::TCP and "options" field
Thanks, that's interesting. Unpacking it like that might also work for
NetPacket. But would you normally recommend the Net::Packet modules
instead? Are there any significant differences/advantages?

----- End forwarded message -----

Report this thread to moderator Post Follow-up to this message
Old Post
-eugk-
02-17-05 01:57 AM


Re: NetPacket::TCP and "options" field
-eugk- wrote:
> Thanks, that's interesting. Unpacking it like that might
> also  work  for  NetPacket.  But  would   you   normally
> recommend the Net::Packet modules instead? Are there any
> significant differences/advantages?
>
> ----- End forwarded message -----

Yes,  there  are  differences,   advantages,   and   maybe
divantages also ;)

When  you  use  Net::Packet,  you  do  not  need  to   use
Net::Pcap. All the gory details  of Net::Pcap  are  hidden
behind the  related  object  (Net::Packet::Dump).  Network
interface information (dev, ip,  ip6,  mac)   is  gathered
automatically, so you do not need  to  bother  with  them.

Also, when you create a Net::Packet::Frame object, you put
in it all wanted layers (Layer2, Layer3, Layer4, Lauer7).

Each time you create an object from a layer, some defaults
values are set. For example,  a  Net::Packet::IPv4  object
will have the source ip address set to the default network
interface from your system.

I suggest you take a look  at  these  perldoc  (SYNOPSIS).
This is better to look at the code  than  to  do  a  long
and boring speech ;)

http://search.cpan.org/~gomor/Net-P...Packet/Frame.pm
http://search.cpan.org/~gomor/Net-P.../Packet/Dump.pm

--
^  ___  ___    FreeBSD Network - http://www.GomoR.org/ <-+
| / __ |__/     Security Engineer, searching for work    |
| \__/ |  \     ---[ zsh$ alias psed='perl -pe ' ]---    |
+-->  Net::Packet <=> http://search.cpan.org/~gomor/  <--+

----- End forwarded message -----

Report this thread to moderator Post Follow-up to this message
Old Post
gomor-usenet@gomor.org
02-17-05 09:00 PM


Re: NetPacket::TCP and "options" field
eugk007@gmail.com wrote:
> I'm using NetPacket::TCP to examine network packets. Everything seems
> to be working, except I can't get anything out of the "options"
field.
> For example, $tcp->{options} is always empty. Has anyone had any
> success with this module? I'm wondering if I need to further unpack
> this field or something.
>
> Thanks.

I don't know how to do it with NetPacket, but with Net::Packet,
it is easy:

# To build a TCP SYN packet with MSS=1460 option
# (padding is done auto):
my $tcp = Net::Packet::TCP->new(
dst => 22,
options => "\x02\x04\x05\xb4",
);

# To display options field:
print unpack('H*', $frame->l4->options), "\n";

--
^  ___  ___    FreeBSD Network - http://www.GomoR.org/ <-+
| / __ |__/     Security Engineer, searching for work    |
| \__/ |  \     ---[ zsh$ alias psed='perl -pe ' ]---    |
+-->  Net::Packet <=> http://search.cpan.org/~gomor/  <--+

----- End forwarded message -----

Report this thread to moderator Post Follow-up to this message
Old Post
gomor-usenet@gomor.org
02-21-05 08:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Modules archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 03:50 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.