The time now is 29.04.2025 - 21:11 |
|
|
|
|
Author |
Message |
|
Post subject: Skript na vypisanie IP smerovanych cez SIX
Posted: 15.12.2005 - 00:04 #26427
|
|
Majster
Joined: Okt 19, 2003
Posts: 2339
Location: Bratislava
|
|
Velmi stary skript, ktory stale funguje, ale vykonanie trva velmo dlho (15-20min).
#!/usr/bin/perl
require 5.004;
use IO::Socket;
sub GetNeighbors {
my $remote_host = "www.six.sk";
my $remote_port = 80;
my $socket = IO::Socket::INET->new(PeerAddr => $remote_host,
PeerPort => $remote_port,
Proto => "tcp",
Type => SOCK_STREAM)
or return -1;
my $line;
my @neighbors = ();
print $socket "GET /lg.html HTTP/1.0\n";
print $socket "Referer: http://www.six.sk\n";
print $socket "Host: www.six.sk:80\n";
print $socket "\n";
while ($line = <$socket>) {
if ($line =~ /<option value=\"(.+)\">/) {
push @neighbors, $1;
}
}
close $socket;
return @neighbors;
}
sub normalize {
$route = shift;
unless ($route =~ /\//) {
$route =~ /^(\d+)\./;
$prefix = $1;
if ($prefix <128) {
$route .= '/8';
}
elsif ($prefix < 192) {
$route .= '/16';
}
elsif ($prefix < 240) {
$route .= '/24';
}
}
return $route;
}
sub GetRoutes {
my $neighbor = shift;
my $remote_host = "www.six.sk";
my $remote_port = 80;
my $socket = IO::Socket::INET->new(PeerAddr => $remote_host,
PeerPort => $remote_port,
Proto => "tcp",
Type => SOCK_STREAM)
or return -1;
my $line;
my $pre = 0;
my @routes = ();
my $query = "query=routes&isp=$neighbor&addr=";
my $length = length($query);
print $socket "POST /cgi-bin/nph-lg HTTP/1.0\n";
print $socket "Referer: http://www.six.sk/lg.html\n";
print $socket "Host: www.six.sk:80\n";
print $socket "Content-Length: $length\n";
print $socket "\n";
print $socket "$query\n";
while ($line = <$socket>) {
if ($line =~ /^<pre>/) {
$pre = 1;
next;
}
if ($pre && $line =~ /^\*..(\S+)/) {
$route = normalize($1);
push @routes, $route;
next;
}
if ($line =~ /^<\/pre>/) {
$pre = 0;
next;
}
}
close $socket;
return @routes;
}
# collect all neighbors
@neighbors = GetNeighbors();
# collect all routes through the neighbors
foreach $neighbor (@neighbors) {
push @groutes, GetRoutes($neighbor);
}
# print out all the routes
foreach $route (@groutes) {
print "$route\n";
} |
|
|
|
|
 |
|
Post subject: RE: Skript na vypisanie IP smerovanych cez SIX
Posted: 17.05.2008 - 10:39 #64964
|
|
Basic
Joined: Máj 17, 2008
Posts: 17
|
|
vie mi niekto potvrdit, ci tento skript este bezi ? resp. ma niekto lepsie riesenie ?
potrebujem mat aktualnu databazu ip rozsahov smerovanych do sixu - aby som vedel znackovat packety podla toho ci su SIX resp. zbytok internetu...
vdaka za feedback |
|
|
|
|
 |
|
All times are GMT
|
|
|
|
|
Powered by PNphpBB2 © 2003-2005 The PNphpBB Group Credits |
|
|