Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/gawk -f
- # netstat -tan | this
- {
- split($5,a,/:/);
- if ( a[1] ~! /^[$0]\.0\.0\.0/ ) {
- cmd="host "a[1];
- cmd | getline;
- # bad fix, bad bug?
- #delay(30000, 2);
- #name=dnsptr(a[1]);
- #service=dnsserv(a[2]);
- pure=$NF;
- isit=$4;
- #close(cmd);
- if ( isit == "alias" ) {
- print $_;
- cmd | getline;
- print "-",$_;
- real=$5;
- } else {
- close(cmd);
- # this regexp is against 2(SERVFAIL) or 3(NXDOMAIN) or ..
- if ( pure ~ /[0-9]\([A-Z]+\)/ ) {
- cmd="whois "a[1]" | grep -Ei '(netname|owner)'";
- cmd | getline;
- #delay(30000, 3);
- real=$NF;
- if ( real == "reached" ) {
- real="bug";
- }
- } else {
- real="";
- }
- }
- close(cmd);
- print a[1],pure,real,a[2];
- }
- }
Add Comment
Please, Sign In to add comment