PDA

Просмотр полной версии : Reverse ip на перле


grinay
16.04.2007, 07:40
Хы был пример на пхп но в силу дальнейшего моего проэкта все надо переписывать на перл.
Вот решил выложить)

#!/usr/bin/perl
use strict;
use LWP::UserAgent;
print "Enter domain:";
my $str=<STDIN>;
chomp $str;
my $browser = LWP::UserAgent->new;
my $url = 'http://www.seologs.com/ip-domains.html';
my $response = $browser->post($url,['domainname' => $str]);
my $data=$response->content;
while($data=~/(?<=\))([-\s\w\.]*)(?=<br>)/ig){
print $1."\n";
}

Isis
16.04.2007, 08:11
Оо, что-то я замечаю плавный переход пхп на перл =\

flipper
16.04.2007, 08:17
Помнится в *nix есть команда:
nslookup antichat.ru

grinay
16.04.2007, 09:06
Хреного тебе помниться.

KSURi
16.04.2007, 09:24
Еще несколько скриптов по сабжу:
By dni:

#!/usr/bin/perl
#Reverse IP script.
#Written by dni
#shouts to oto, leetskeet, uNK
#irc.bluehell.org #r00t

use LWP::UserAgent;
while (!$ARGV[0]) {
print "Usage: $0 IP \n"; exit;}
$a = 1;
$ua = new LWP::UserAgent(timeout => 15, agent => "Mozilla/5.0 (x11; u; linux i686; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7)" );

$req = $ua->get('http://whois.webhosting.info/' . $ARGV[0] . '?pi=1&ob=SLD&oo=ASC');
if (!($req->is_success)) {

die $req->status_line; }
else {
$output = $req->as_string;
until ($output =~ /(.*?)IP\sDetails\s-\sN\/A\./) {
$req = $ua->get('http://whois.webhosting.info/' . $ARGV[0] . '?pi=' . $a . '&ob=SLD&oo=ASC');
if (!($req->is_success)) { die $req->status_line; }
$output = $req->as_string;

while ($output =~ /<td><a\shref=\"http:\/\/whois.webhosting.info\/(.*?)\">/g){
my($crap,$yes)=split(/info\/(.*?)\.\"\>/,$&);
print "$yes\n";
}
sleep 5;
$a++;
}
print "Done!\n";
}

By me:

sub ddbGetCookies
{
my $ua=LWP::UserAgent->new(timeout => 7,
cookie_jar => {});
my $response=$ua->post($ddb.'cgi-bin/login.cgi',
[user => $ddbLogin,
pass => $ddbPassword,
action => 'login',
'1action' => 'GetByDomain',
domain=>'....'],
Referer=>$ddb . 'cgi-bin/login.cgi');
$response->is_success || die 'Ddb login failed';
$ua->cookie_jar;
}

sub ddbExtractTargets
{
my $ua=LWP::UserAgent->new(timeout => 7,
cookie_jar => shift);
my $response=$ua->get($ddb . shift,
Referer => $ddb);
$response->is_success || die 'Ddb request failed';
foreach(split("\n", $response->content))
{
if(/<b>there are <a href=\"(.+?)\">\d+ domains<\/a>/)
{
$response=$ua->get($ddb . $1,
Referer => $ddb);
$response->is_success || die 'Ddb request failed';
my @results=();
foreach(split("\n",$response->content)) { push(@results,$1) if /<b><a href=\"(.+?)\" class=text12 target=_blank>/ }
return @results;
}
}
}

pento
16.04.2007, 09:36
Хреного тебе помниться.
Это почему?

$ nslookup antichat.ru
...
Non-authoritative answer:
Name: antichat.ru
Address: 89.108.80.80

Чем твой скрипт отличается от этого?

grinay
16.04.2007, 09:49
Спроси у кого нить более умнее меня))))

grinay
17.04.2007, 01:02
По поводу скрипта от днй http://whois.webhosting.info/ стоит ограничение на количество запросов потому я его и не стал включать в скрипт