#!/usr/bin/perl # # opensrs.sslbot revision 2001.04.03 # # short script to grab all active domains from # https://rr-n1-tor.opensrs.net/~vpop/resellers/ # # Released to the public domain by Tom Brown, tbrown@baremetal.com # (but I'd still like to have my name in the comments if you use it. :-) # (additional work done by bill@daze.net) # (patched again in jan 2001, tbrown@baremetal.com to match # OpenSRS search-active-domains RWI changes) # (patched 2001.04.03, bill@daze.net to match # OpenSRS search-active-domains RWI page link changes) # # it will scan the pages of active domains... # and dump the domains (one per line) # to the file: $RPT_PATH/$RPT_NAME.YYYYMMDD # # (set the variables RPT_PATH and RPT_NAME below :-) my $USERID="XXX"; # your reseller id my $PASS="XXXX"; # your reseller password my $RPT_PATH=""; # report file path my $RPT_NAME="opensrs.active"; # report filename (timestamp is appended) ################################################# use strict; use Net::SSLeay qw(get_https post_https sslcat make_headers make_form) ; use vars qw($opt_c $opt_a $opt_d); use Getopt::Std; getopts('cad'); # REDUNDANT -c = completed orders # NO LONGER SUPPORTED -a = active domains # -d = debugging on die "completed orders page is no longer supported." if ($opt_c); warn "this script only supports active domains, so -a is redundant\n" if ($opt_a); my $HOSTNAME="rr-n1-tor.opensrs.net"; my $URI="/~vpop/resellers/index"; my $ACTION="view_domains"; # used to be view_active ... my $init_cookie = 'CheckCookie=CheckCookie'; # really should load the login page my $AGENT='baremetal Reconciller'; my $headers=make_headers( 'User-Agent' => $AGENT, Cookie => $init_cookie ); 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{$_}; } print "\n$page\n" if $opt_d; my $cookie = $reply_headers{'SET-COOKIE'} or die "can't get auth cookie!"; print "cookie set to $cookie\n"; $headers=make_headers( 'User-Agent' => $AGENT, Cookie => $cookie ); # open the output file with date stamp my ($day, $month, $year) = (localtime)[3,4,5]; my $filedate = sprintf("%04d%02d%02d", $year+1900, $month+1, $day); open F, ">$RPT_PATH" . $RPT_NAME . ".$filedate"; my $prior_line = ''; my @fetchpages = ('0'); my %validpages = (0=>1); while (defined(my $fetchpage = shift(@fetchpages))) { ($page, $response, %reply_headers) = post_https($HOSTNAME, 443, $URI, $headers, "action=view_domains&orderby=createdate&domain=&page=$fetchpage&name=&alpha=&from_day_c=All&from_day_x=All&from_month_c=All&from_month_x=All&from_year_x=All&from_year_c=All&to_day_c=All&to_day_x=All&to_month_c=All&to_month_x=All&to_year_x=All&to_year_c=All" ); die "whoa, request failed: $response" unless ($response); print "\npage $fetchpage is: $page\n\n" if ($opt_d); while ($page =~ m#&page=(\d+)#g) { # changed 20010403 blg my $p = $1; if (!defined($validpages{$p})) { push(@fetchpages,$p); # schedule it $validpages{$p} = 1; # record the fact it is scheduled } } print "fetched page $fetchpage\n"; $page =~ s/^.* END HEADER -->//s; # throw away page header... print "stripped header\n" if ($opt_d); my $found = 0; # note the embedded action below is not $ACTION it is the singular form # reg exp while ($page =~ m#