
ANNOUNCE: Net::RawIP 0.03 released
Good day.
The perl module Net::RawIP 0.03 just released.I have announce about
0.02 version.
Thanks all for interest and suggestions.
If you don't remember or don't knew about Net::RawIP before:
Net::RawIP is a perl module can to manipulate raw IP packets,
with an optional feature for manipulating Ethernet headers.
Net::RawIP can be used for easy writing low level programms
which can manipulate raw IP packets directly from Perl.
Changes from 0.02 to 0.03:
- port to Linux with glibc
- port to Alpha Linux
- port to Solaris
- port to FreeBSD
- fix memory leaks
- fix problems with gcc 2.7.2.1
- implemented manipulate IP and TCP options
- implemented generic subclass for generic ip datagramms
After week if you do not fing big bugs I'll upload Net::RawIP 0.03 to CPAN
Homepage of Net::RawIP: http://www.*-*-*.com/
Just one small example.
ipopt_traceroute.pl
-----------------------
#!/usr/bin/perl
# This script use IP option called "record route" for emulate traceroute.
# Unfortunately max size of ip options is only 40 bytes and we can see
# just 9 hops, other hops will be ignored ;(
use Net::RawIP;
require 'getopts.pl';
Getopts('i:s:d:');
die "Usage $0 -i <interface> -d <dest host> -s <your host>"
unless ($opt_d && $opt_d && $opt_s);
$a = new Net::RawIP ({icmp =>{}});
$a->set({ip => {saddr => $opt_s,
daddr => $opt_d},
icmp => {type => 8, id => $$}
});
$data = "\5".("\0" x 37);
$a->optset(ip => {type => [(7)],data =>[($data)] });
$device = $opt_i;
$filt = "ip proto \\icmp and dst host $opt_s";
$size = 1500;
$tout = 30;
$pcap = $a->pcapinit($device,$filt,$size,$tout);
$i =0;
if(fork){
Quote:
}
else{
sleep 1;
$a->set({icmp => {sequence => $i,data => timem()}});
$a->send(1,1);
Quote:
}
sub dmp{
$a->bset(substr($_[2],14));
$opt = ($a->optget(ip => {type => [(7)] } ))[2];
$opt = substr($opt,2);
$j = 0;
last unless $site;
printf(" -> ") if $j;
printf("\n") if $j == 4;
printf("%u.%u.%u.%u",unpack("C4",pack("N",$site)));
$j++;
}
printf("\n");
Quote:
}
--------------------
I'll be glad if you find my work interesting.
----------------------Alchevsk Linux User Group-----------------------
UNIX is user friendly. It's just selective who the friends are.
Linux is like wigwam - no windows, no gates, apache inside.