root/psad/tags/psad-2.1.2/whois/make_ip6_del.pl

Revision 1560, 0.7 kB (checked in by mbr, 3 years ago)

added missed files from whois-4.7.13

  • Property svn:executable set to *
Line 
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 while (<>) {
6         chomp;
7         s/^\s*(.*)\s*$/$1/;
8         s/\s*#.*$//;
9         next if /^$/;
10
11         die "invalid line:\n$_\n"
12                 if not m#^([\da-fA-F]{4}):([\da-fA-F]{1,4})::/(\d+)\s+([\w\.]+)$#;
13         my $len = $3; my $s = $4;
14         my $i1 = $1; my $i2 = $2;
15         my $net = (hex($i1) << 16) + hex $i2;
16
17         if (0) { # just some code to help me visually aggregate networks
18                 my $bs = unpack('B32', pack('N', $net));
19                 $bs =~ s/(.{8})/$1 /g;
20                 print "${i1}:${i2}::/$len\t$bs $s\n";
21                 next;
22         }
23
24         print qq|{ ${net}UL, $len, "|;
25         if ($s =~ /\./) {
26                 print $s;
27         } elsif ($s eq '6to4') {
28                 print "\\x0A";
29         } elsif ($s eq 'UNALLOCATED') {
30                 print "\\006";
31         } else {
32                 print $s =~ /\./ ? $s : "whois.$s.net";
33         }
34         print qq|" },\n|;
35 }
36
Note: See TracBrowser for help on using the browser.