Загрузка данных


/bin/sh <<'TB_CHECK'
date -u

echo 'Default and broad IPv4 routes:'
netstat -rn -f inet | awk '
  NR < 5 || $1 == "default" ||
  $1 == "0/1" || $1 == "128.0/1" ||
  $1 == "0.0.0.0/1" || $1 == "128.0.0.0/1"
'

for tb_name in my.vk.team www.apple.com; do
  echo "Corporate DNS, UDP: $tb_name"
  dig @172.21.0.1 "$tb_name" A \
    +time=4 +tries=1 +notcp +ignore +noall +comments +answer

  echo "Corporate DNS, TCP: $tb_name"
  dig +tcp @172.21.0.1 "$tb_name" A \
    +time=4 +tries=1 +noall +comments +answer
done

/usr/bin/perl <<'TB_PAC'
use strict;
use warnings;
$| = 1;

my $settings = qx{/usr/sbin/scutil --proxy};
my ($url) = $settings =~ /^\s*ProxyAutoConfigURLString\s*:\s*(\S+)\s*$/m;
unless (defined $url && $url =~ m{\A(https?)://([^/?#]+)}i) {
    print "No HTTP(S) PAC URL found; no fetch performed.\n";
    exit;
}
my ($scheme, $authority) = ($1, $2);
$authority =~ s/.*\@//;
unless ($authority =~ /\A(?:[A-Za-z0-9._-]+|\[[A-Fa-f0-9:.]+\])(?::[0-9]+)?\z/ &&
        $url !~ /[\x00-\x20\x7f]/) {
    print "PAC URL format not handled; no fetch performed.\n";
    exit;
}
print "PAC origin: $scheme://$authority (path/query omitted)\n";
$url =~ s/([\\"])/\\$1/g;
open(my $curl, '|-', '/usr/bin/curl', '-q', '--noproxy', '*',
     '--connect-timeout', '5', '--max-time', '8',
     '--max-filesize', '1048576', '--silent',
     '--output', '/dev/null', '--config', '-',
     '--write-out',
     'PAC ip=%{remote_ip} http=%{http_code} bytes=%{size_download} dns=%{time_namelookup} tcp=%{time_connect} total=%{time_total}\n')
    or die "Could not start PAC probe.\n";
print {$curl} "url = \"$url\"\n";
close($curl);
printf "PAC curl_exit=%d\n", $? >> 8;
TB_PAC

echo 'Corporate connection afterward:'
netstat -an -p tcp |
  awk '/194[.]186[.]63[.]/ && /ESTABLISHED/ {print}'
TB_CHECK