On Tue, 25 Jul 2000, Taco Scargo wrote:
> Could you send me the script ?
See below...
-Tom
> Thanks !
>
> Taco Scargo
---------------------------------
> If you can install OpenSSL and Net::SSLeay I've got a perl script (robot)
> that will download and parse all of the information on the "active
> domains" pages from https://rr-n1-tor.opensrs.net/~vpop/resellers/
----------------------------------------------------------------
#!/usr/bin/perl
#
# short (too short) script to grab all the completed order (-c option)
# or active domains (-a option) from
# https://rr-n1-tor.opensrs.net/~vpop/resellers/
#
# Will _not_ go past the 400 active domain page "boundary" at this point
#
# Released to the public domain by Tom Brown, [EMAIL PROTECTED]
# (but I'd still like to have my name in the comments if you use it. :-)
#
# given the -c parameter, it will dump all the completed orders to
# a file: opensrs.completed
# (one order per line)
#
# given the -c parameter, it will dump up to the first 10 pages of
# active domains... it'll dump the domains (one perl line) from each page
# to opensrs.active.X where X is the page number.
#
# (the reason it won't go past 10 pages is because the OpenSRS folks
# use a different format for those links...)
#
use strict;
use Net::SSLeay qw(get_https post_https sslcat make_headers make_form) ;
use vars qw($opt_c $opt_a);
use Getopt::Std;
getopts('ca');
die "you really need to pick an action: -c and/or -a" unless($opt_a or $opt_c);
my $HOSTNAME="rr-n1-tor.opensrs.net";
my $URI="/~vpop/resellers/index.cgi";
my $USERID="your.opensrs.id";
my $PASS="your.opensrs.web.password";
my $headers=make_headers( 'User-Agent' => 'baremetal Reconciller');
my ($page, $response, %reply_headers)
= post_https($HOSTNAME, 443, $URI, $headers,
make_form(
'username' => $USERID,
'password' => $PASS,
'action' => 'login'
));
foreach (keys %reply_headers) {
printf "header: %s: %s\n", $_, $reply_headers{$_};
}
my $cookie = $reply_headers{'SET-COOKIE'} or die "can't get auth cookie!";
print "cookie set to $cookie\n";
$headers .= make_headers( Cookie => $cookie );
if ($opt_c) {
($page, $response, %reply_headers)
= post_https($HOSTNAME, 443, $URI, $headers,
make_form(
'action' => 'view_completed'
));
open F, ">opensrs.completed";
my $count=0;
while ($page =~
m#<tr>.*?action=edit_order&id=\d+">([a-zA-Z\-\.0-9]+)</a></td>\s*<td>(.*?)</td>\s*<td>(.*?)</td>\s*<td><i>(.*?)</i></td>.*?</tr>#gs
) {
my ($dom,$type,$date,$email) = ($1,$2,$3,$4);
print F "$dom, $type, $date, $email\n";
$count++;
}
close F;
print "$count completed orders parsed out\n";
}
if ($opt_a) {
my @fetchpages = '0';
while (defined(my $fetchpage = shift(@fetchpages))) {
($page, $response, %reply_headers)
= post_https($HOSTNAME, 443, $URI, $headers,
make_form(
action => 'view_domains',
orderby => 'createdate',
page => $fetchpage
));
die "whoa, request failed: $response" unless ($response);
if ($fetchpage eq '0') { # how many more?
my %tmphash = ();
while ($page =~ m#view_domains&orderby=createdate&page=(\d+)"#g ) {
$tmphash{$1} = 1 unless ($1 eq 0);
}
push(@fetchpages, keys(%tmphash));
printf "%d more pages scheduled for loading\n", $#fetchpages+1;
}
print "fetched page $fetchpage\n";
open F, ">opensrs.active.$fetchpage";
while ($page =~ m#<tr>\s*<td nowrap>(.*?)</td>\s*<td
nowrap>(.*?)</td>\s*.*?action=view_domain&name=(.*?)">.*?</tr>#gs) {
print F "$3: $1: $2\n";
}
close F;
}
}