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


(
  for tb_target in 10.12.165.142 172.21.0.1; do
    tb_if=$(/sbin/route -n get "$tb_target" | awk '/interface:/{print $2}')
    if [ "$tb_if" != utun10 ]; then
      echo "Stop: $tb_target currently uses $tb_if, not utun10."
      exit 1
    fi
  done
  sudo -v || exit 1
  date -u
  netstat -an -p tcp | awk '/194[.]186[.]63[.]/ && /ESTABLISHED/ {print}'

  sudo -n /bin/sh <<'TB_CAPTURE' &
tb_pids=''
tb_cleanup() {
  trap - EXIT
  kill -INT $tb_pids 2>/dev/null || :
  sleep 1
  kill -KILL $tb_pids 2>/dev/null || :
  wait $tb_pids 2>/dev/null || :
}
trap tb_cleanup EXIT
trap 'exit 130' HUP INT TERM

/usr/sbin/tcpdump -p --immediate-mode -l -nn -tttt -S -K -i utun10 -y NULL -s 44 -c 30 'ip and tcp and host 10.12.165.142 and port 8443' &
tb_pids="$tb_pids $!"

/usr/sbin/tcpdump -p --immediate-mode -l -nn -tttt -q -K -i utun10 -y NULL -s 32 -c 20 'ip and udp and host 172.21.0.1 and port 53' &
tb_pids="$tb_pids $!"

/usr/sbin/tcpdump -p --immediate-mode -l -nn -tttt -S -K -i bridge0 -y EN10MB -s 54 -c 80 'ip and tcp and net 194.186.63.0/24 and port 443 and host 192.168.77.2' &
tb_pids="$tb_pids $!"

sleep 15
TB_CAPTURE
  tb_capture_job=$!
  sleep 2

  echo 'JSS TCP probe:'
  /usr/bin/nc -4 -n -z -v -G 6 -w 6 10.12.165.142 8443

  echo 'Corporate DNS probe:'
  /usr/bin/dig @172.21.0.1 jss.corp.mail.ru A +time=4 +tries=1 +notcp +ignore +noall +comments +answer

  netstat -an -p tcp | awk '/194[.]186[.]63[.]/ && /ESTABLISHED/ {print}'
  wait "$tb_capture_job"
  date -u
  for tb_target in 10.12.165.142 172.21.0.1; do
    /sbin/route -n get "$tb_target" | awk '/route to:|interface:/{print}'
  done
  echo 'Diagnostic finished; all packet captures stopped.'
)