mirror of
https://github.com/rfc1036/whois.git
synced 2026-01-03 06:15:17 +00:00
28 lines
605 B
Perl
Executable File
28 lines
605 B
Perl
Executable File
#!/usr/bin/perl
|
|
|
|
use warnings;
|
|
use strict;
|
|
|
|
while (<STDIN>) {
|
|
chomp;
|
|
s/^\s*(.+)\s*$/$1/;
|
|
s/\s*#.*$//;
|
|
next if /^$/;
|
|
|
|
my ($fh, $fl, $lh, $ll, $s, $f, $l);
|
|
if (($fh, $fl, $lh, $ll, $s) =
|
|
/^(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+([\w\.-]+)$/) {
|
|
$f = ($fh << 16) + $fl;
|
|
$l = ($lh << 16) + $ll;
|
|
|
|
my $server = ($s =~ /\./) ? $s : "whois.$s.net";
|
|
print qq({ $f, $l,\t"$server" },\t/* $fh.$fl $lh.$ll */\n);
|
|
} elsif (($f, $l, $s) = /^(\d+)\s+(\d+)\s+([\w\.-]+)$/) {
|
|
my $server = ($s =~ /\./) ? $s : "whois.$s.net";
|
|
print qq({ ${f}u, ${l}u,\t"$server" },\n);
|
|
} else {
|
|
die "format error: $_";
|
|
}
|
|
}
|
|
|