Prihlásiť sa Odoslať Novinky :: FAQ :: Rozšírené vyhľadávanie :: Napísali o nás :: Ankety
Main Menu
· Home
· 
· FAQ
· 
· Diskusia
· 











Main Menu
· Domov

Moduly
· AvantGo
· Downloads
· FAQ
· News
· Recommend Us
· Reviews
· Search
· Sections
· Stats
· Topics
· Top List
· Web Links
· Forum

Jazyk
Výber jazykovej mutácie:



The time now is 03.03.2024 - 17:49


Skript na vypisanie IP smerovanych cez SIX

Post new topic Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
 
Author Message
Robert
Post subject: Skript na vypisanie IP smerovanych cez SIX  PostPosted: 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";
}
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
andyproxis
Post subject: RE: Skript na vypisanie IP smerovanych cez SIX  PostPosted: 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
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
All times are GMT
Post new topic Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
 
Jump to:  

Powered by PNphpBB2 © 2003-2005 The PNphpBB Group
Credits

(C) SKFree 2002-2010: Powered by POSTNUKE. Môžete prebera? naše správy vo formáte XML(RSS)