Friday, May 14, 2010

www.attackvector.org

Attack Vector

↑ Grab this Headline Animator

Thursday, May 13, 2010

Wow...

I totally forgot that this was even here.. lol.

I recommend visiting the blog that this one spawned.


Check it out..

Friday, May 2, 2008

ICMP Ping using Net::RawIP

This uses Net::RawIP to send an ICMP packet to the destination host and waits for a response. It operates exactly like 'ping', minus all of the other cool features. ;-)

#!/usr/bin/perl
use Socket;
use Sys::Hostname;
use Net::RawIP qw(:pcap);

$host = hostname();
$addr = inet_ntoa(scalar gethostbyname($host || 'localhost'));

$i = 0;
$dest = $ARGV[0];

$packet = new Net::RawIP ({
icmp => {}
});

$packet->set({
ip => {
saddr => $addr,
daddr => $dest,
},

icmp => {
type => 8,
id => $$
},
});

$device = "eth0";
$filt = "ip proto \\icmp and dst host $addr";
$pcap = $packet->pcapinit($device,$filt,'1500','30');

if(fork) {
loop $pcap,-1,\&sniff,\@packet;
} else {

for(;;){
$packet->set({
icmp => {
sequence => $i,
data => timem()
}
});

$packet->send(1,1);
$i++;
sleep 1;
}
}

sub sniff{
$time = timem();
$packet->bset(substr($_[2],14));

@ar = $packet->get({
ip => [qw(ttl)],
icmp => [qw(sequence data)]
});

printf("%u bytes from %s: icmp_seq=%u ttl=%u time=%4.1fms\n",
length($ar[2])+8,$ARGV[0],$ar[1],$ar[0],($time-$ar[2])*1000);
}