Snort mailing list archives
Re: how to convert sql ipsrc hdrs to quad notation
From: Brian <bmc () snort org>
Date: Fri, 12 Oct 2001 17:13:15 -0400
According to Frontgate Lab:
Hi, does anyone have a script that converts these to dotted quad notation? can you at least guide me in the direction of writting such a script? ie the math behind it < where do i find it?
If you wanted to do this in perl... To convert to an int: #!/usr/bin/perl my $ddip = $ARGV[0]; my @bytelist = split /\./, $ddip; my $packedip = $bytelist[3] + ($bytelist[2]*256) + ($bytelist[1]*65536) + ($bytelist[0]*16777216); print "$packedip\n"; To convert from an int: #!/usr/bin/perl use Socket; if (@ARGV) { $ip = $ARGV[0]; } else {$ip = <STDIN>; } $ip = inet_ntoa(pack("V", $ip)); $ip =~ s/(\d+).(\d+).(\d+).(\d+)/$4.$3.$2.$1/g; print "$ip\n"; -brian _______________________________________________ Snort-users mailing list Snort-users () lists sourceforge net Go to this URL to change user options or unsubscribe: https://lists.sourceforge.net/lists/listinfo/snort-users Snort-users list archive: http://www.geocrawler.com/redir-sf.php3?list=snort-users
Current thread:
- how to convert sql ipsrc hdrs to quad notation Frontgate Lab (Oct 12)
- Re: how to convert sql ipsrc hdrs to quad notation Andrew R. Baker (Oct 12)
- Re: how to convert sql ipsrc hdrs to quad notation Brian (Oct 12)
- <Possible follow-ups>
- RE: how to convert sql ipsrc hdrs to quad notation Mayers, Philip J (Oct 14)