#/usr/bin/perl -W #made by: ev1lut10n #a simple tool for sysadmin to autoresolve all domains on his server use Socket; sub getdomains() { system("rm -f domain_lists.txt"); open(PROSES_MYSQL, "ls /var/named |"); while () { $tampilan_proses = $_; $tampilan_proses=str_replace('.db','', $tampilan_proses); $p=length($tampilan_proses); if($p>5) { system("echo '$tampilan_proses'>> domain_lists.txt"); } } close(PROSES_MYSQL); } sub autoresolve() { open(PASSWORD, "; @lines2 = sort(@lines2); my($pass); foreach $pass (@lines2) { print $pass; chomp($pass); $p=length($pass); if($p>5) { eval { $address = inet_ntoa(inet_aton($pass)); }; print $pass." resolved as : ".$address."\n"; } } close(PASSWORD); } sub str_replace { eval { my $replace_this = shift; my $with_this = shift; my $string = shift; my $length = length($string); my $target = length($replace_this); for(my $i=0; $i<$length - $target + 1; $i++) { if(substr($string,$i,$target) eq $replace_this) { $string = substr($string,0,$i) . $with_this . substr($string,$i+$target); return $string; #Comment this if you what a global replace } } return $string; } } getdomains(); autoresolve();