#!/usr/bin/perl #This is a pretty damned cool little script! Use but don't abuse! #find out the last word that was looked up system("touch freenames"); system("sort freenames > freetmp; rm -f freenames; mv freetmp freenames"); system("tail freenames > tailname"); open("final", "tailname"); chomp(@tailed = ); print "Figuring out where to start\n"; print "Picking up at $tailed[9]\n"; close(final); #clean up unneeded file system("rm -f tailname"); #Find out what wordlist to use print "Type the name of the wordlist to use\n"; $list = ; chomp($list); #open up our wordlist /usr/dict/english is best! open(dict, "$list") || die("Couldn't open $list: $1"); chomp(@list = ); chomp($tailed[9]); #get rid of the .com, .net, .org for comparison @good = split(/\./, $tailed[9]); chomp($good[0]); #compare the last found domain against our wordlist for($i=0;$list[$i] ne $good[0] && $list[$i] ne "" && $good[0] ne "";) { shift(@list); #pull already processed words out of the array print "$list[$i] <-> $good[0]\n"} print "Done parsing list!\n"; print "Beginning hostname lookup routine.\n"; #------------------------------------------------------------------# #here's the meat/tofu of the program foreach $domain (@list){ intercom(); #see if the .com is available #busy signal routine for( $i=0; $words[0] eq "*" && $i<200; $i++ ){ intercom(); print "Busy! .com request denied: Retry number $i\n";} happyday(); #look ma, i caught one! internet(); #see if the .net is available #busy signal routine for( $i=0; $words[0] eq "*" && $i<200; $i++){ internet(); print "Busy! .net request denied: Retry number $i\n";} happyday(); #is it available? is it a happy day? interorg(); #try the .org last...best? #is it "busy?" - internic loves to deny for( $i=0; $words[0] eq "*" && $i<200; $i++){ interorg(); print "Busy! .org request denied: Retry number $i\n";} happyday(); #is today the day?! } #-----------------------------------------------------------------# sub intercom{ $domain2 = $domain . ".com"; #try .com first system("whois $domain2 > dname"); #throw whois output to a file open(fh, "dname"); @result = ; #read results of whois into an array close(fh); @words = split(/\s/, $result[0]); #get the first word of whois output } sub internet{ $domain2 = $domain . ".net"; #try .net next system("whois $domain2 > dname"); #into the file you go! open(fh, "dname"); @result = ; #bitch the results into our array close(fh); @words = split(/\s/, $result[0]); #grab first word } sub interorg{ #interorg just doesn't have the same ring to it! $domain2 = $domain . ".org"; system("whois $domain2 > dname"); #gee I think i've explained... open(fh, "dname"); @result = ; #you know what this does... close(fh); @words = split(/\s/, $result[0]); #duh.. } sub happyday{ if( $words[0] eq "No" ){ #if it equals No, the domain is available open(output, ">>freenames"); #append it to our list print output "$domain2\n"; close(output); print "$domain2 is available!\n";} }