File tree Expand file tree Collapse file tree 4 files changed +17
-11
lines changed
Expand file tree Collapse file tree 4 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ if [[ $1 == '-r' ]]; then
55 RECURSE=1
66fi
77URL=${1?Usage: $0 [-r] <URL>}
8- read URL RETCODE NEWURL < <( curl -o /dev/null --silent --head --write-out " $URL %{http_code} %{redirect_url}\n" " $URL " )
9- echo $URL $RETCODE $NEWURL
8+ read URL RETCODE TTTL NEWURL < <( curl -o /dev/null --silent --head --write-out " $URL %{http_code} %{time_total } %{redirect_url}\n" " $URL " )
9+ echo $URL $RETCODE $TTTL $ NEWURL
1010if [[ $RECURSE == 1 && ( $RETCODE == ' 301' || $RETCODE == ' 302' ) ]]; then
1111 $0 -r $NEWURL
1212fi
Original file line number Diff line number Diff line change @@ -4,13 +4,13 @@ perl -MSocket -plane '
44 BEGIN {
55 %CACHE=();
66 sub gethost {
7- $ip = join( ".", unpack "C4", pack "N", $1) ;
7+ $ip = $1 ;
88 unless (defined $CACHE{$ip}) {
9- @name = gethostbyaddr(inet_aton($1 ),AF_INET);
10- $CACHE{$ip} = $name[0] ? $name[0] : $1 ;
9+ @name = gethostbyaddr(inet_aton($ip ),AF_INET);
10+ $CACHE{$ip} = $name[0] ? $name[0] : $ip ;
1111 }
1212 return $CACHE{$ip};
1313 }
1414 }
15- s/\b(([0-9]{1,3}\.){3}([0-9]{1,3}))\b/gethost($1)/eg;
15+ s/\b(([0-9]{1,3}\.){3}([0-9]{1,3}))\b/$1." ". gethost($1)/eg;
1616'
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ curl -s ipinfo.io/$1 | jq .
Original file line number Diff line number Diff line change 11# !/usr/bin/perl
22
3- while (<POSTQUEUE >) {
3+ while (<>) {
44 if (/ ^(\w +)(\* |\! )?\s / ) {
5+ $header = $_ ;
56 $queue_id = $1 ;
6- $_ = <POSTQUEUE >;
7+ $_ = <>;
78 chop ;
89 $msg = $_ ;
910
1011 if (/ ^\( .*(\d {3}) (\d .\d .\d ) .*\) $ / ) {
1112 $reply = $1 ;
1213 $error = $2 ;
1314
14- $_ = <POSTQUEUE >;
15+ $_ = <>;
1516 chop ;
1617 s /\s +// g ;
1718 $email = $_ ;
1819
1920 print " $queue_id $reply $error $email $msg \n " ;
21+ } elsif ($header =~ / MAILER-DAEMON/ ) {
22+ print " $queue_id -- MAILER-DAEMON\n " ;
23+ } else {
24+ print " $queue_id -- PARSE-ERROR\n " ;
2025 }
2126 }
2227}
23-
24- close (POSTQUEUE);
You can’t perform that action at this time.
0 commit comments