⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 get_unique_ips.pl

📁 radius协议源码÷The Radius Stack will connect to a Radius Server. This stack implementation is built upo
💻 PL
字号:
#!/usr/bin/perl -wuse strict;use Data::Dumper;use constant DEBUG => 1;my %IPs;my $octet = '(\d){1,3}';my $combo = "($octet\\.$octet\\.$octet\\.$octet:\\d+)"; #IP:port#The only IP:port combos we want are the ones that are actually used#as endpoints, as determined on the IP layer.  (Spurious and irrevelant combos#can appear in the headers, for esoteric reasons.)#ipgrab prints the combos it finds by actually inspecting the IP layer#in this format:  [source_ip:source_port->destination_ip:destination_port].#Hence any combo truly used will either start or end with a square bracket.#!my $IP_address_regex = qr{[$combo|$combo]};my $IP_address_regex = qr{\[$combo};#because File::Find does not work as documentedmy $find_command = "find @ARGV -type f";print "Running find command $find_command\n" if DEBUG;open (FILES, "$find_command |")    or die "Could not run find command $find_command:  $!";while (<FILES>){    chomp;    &get_IPs ($_);}print Data::Dumper->Dump ([ \%IPs ], [ 'server_map' ]);sub get_IPs{    my $filename = shift();    print "Examining file $filename...\n" if DEBUG;    if (! sysopen (FILE, $filename, 0))    {	warn "Could not open file $filename";	return;    }    while (<FILE>)    {	my @matches;	print "Next line...\n" if (DEBUG == 2);	while (m/\G$IP_address_regex/g)	{	    print "Got match $1\n" if DEBUG;	    push @matches, $1;	    map { $IPs{$_} = '' unless exists $IPs{$_}; } @matches;	}    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -