getdomain.pl
getdomain.pl
---- cut here
#!/usr/bin/perl
# GetDomain By Nfin8 / Invisible Evil
# Questions /msg i-e or /msg i^e
#
# Retrieve command line arguments.
my($inputfile, $domain) = @ARGV;
usage() if (!defined($inputfile) || !defined($domain));
# Open and preprocess the input file.
open(INFILE, "<$inputfile") or die("Cannot open file $inputfile for reading!\n");
my(@lines) =
# Initialize main data structure.
my(%hash) = {};
my($key) = "";
foreach (@lines) {
$key = (split(/\ /))[0];
chop($key);
next if ((($key =~ tr/.//) < 1) ||
(uc($domain) ne uc(((split(/\./, $key))[-1]))) ||
($key =~ m/root-server/i));
$hash{$key}++;
}
# Close input file and output data structure to STDOUT.
close(INFILE);
foreach (sort(keys(%hash))) {
print "$_\n";
}
sub usage {
print("\n\ngetdomain:\n");
print("Usage: getdomain [inputfile] [search]\n\n");
print("Where [search] is one of \'com\', \'edu\', \'gov\', \'mil\' or \'net\'.\n\n");
exit(0);
}
0;
---- cut here - end of script -----
To use the script above all you need to do is copy between the lines above
and name it getdomain.pl, now copy it into the unix os and type
chmod +x getdomain.pl
Now it is ready to run with the command lines above.
No comments:
Post a Comment