
richsark
User
Jun 16, 2009, 6:48 AM
Post #2 of 16
(4508 views)
|
Re: [richsark] Modify perl script with report and count
[In reply to]
|
Can't Post
|
|
Hello, I have this:
$report .= (join",",$domain_name,map{scalar(()=$txt=~/\s+IN\s+$_.*/g)}(qr/./,qr/A/,qr#CNAME#,qr#MX#,qr#TXT#,qr#SRV#,qr#PTR#,qr#OTHER#))."\n"; which I incorporated like so:#!perl -w my @revlist = `./exportdomain.exe -u 123 -p 123 -o srs`; shift @revlist; my $report = ""; my @domains; my @includes; foreach(@revlist) { next unless /(.*?),(.*)$/; my $domain_name = $1; push @domains, $domain_name; print "Checking $domain_name\n"; my $txt = `./grabzoneext.exe -u 111 -p 111 -n $domain_name -o srs 2>&1`; $txt =~ s/[\r\n]+/\n/gs; my $prefix = ($txt =~ /ParameterName=Prefix[^\r\n]+?[\r\n]+(.*?)(?:OptionType|ParameterName|$)/si) ? $1 : 0; my $postfix = ($txt =~ /ParameterName=Postfix[^\r\n]+?[\r\n]+(.*?)(?:OptionType|ParameterName|$)/si) ? $1 : 0; my $include = ($txt =~ /\$INCLUDE\s*([^\r\n]+?)[\r\n]/si) ? $1 : 0; # if you don't want to print domains without prefix or postfix uncomment the next line # next unless $prefix || $postfix; $report .= (join",",$domain_name,map{scalar(()=$txt=~/\s+IN\s+$_.*/g)}(qr/./,qr/A/,qr#CNAME#,qr#MX#,qr#TXT#,qr#SRV#,qr#PTR#,qr#OTHER#))."\n"; push @includes, [$domain_name, $include] if $include; } open(my $out, ">domain-inspection-6-2-09.txt") or die "Could not open output: $!\n"; print $out "Summary -- domains found = ".scalar(@domains); print $report; print $out "\n\nSummary -- \$INCLUDEs:\n"; print $out "\$INCLUDE ".$_->[1]." found in domain ".$_->[0]."\n" foreach (@includes); print $out "\nFull Report:\n"; print $out "domain,#records,#A,#CNAME,#MX,#TXT,#SRV,#PTR,#OTHER\n"; print $out $report; close($out); The domain-inspection-6-2-09.txt looks like this now: Summary -- domains found = 3 Summary -- $INCLUDEs: Full Report: sark-usa.rich.net,3,0,3,0,0,0,0,0 uk.rtyur.com,0,0,0,0,0,0,0,0 cmgdr.sarkie.net,0,0,0,0,0,0,0,0 Still need help... help me add a header line under each one to easier reference, also I could not get a separate domain.txt file when content is found. I was expecting something like sark-usa.rich.net.txt In that text file I would have rtre100CLIP.rich.net. IN CNAME CPYIP.dcf.gis.sarkie.com. gtre10wrLIP.rich.net. IN CNAME SIL101CLIP.dcf.gis.sarkie.com. gtred1d0LIP.rich.net. IN CNAME SL102CLIP.dcf.gis.sarkie.com. Thanks
(This post was edited by richsark on Jun 16, 2009, 9:09 AM)
|