cndns

From nat, 4 Years ago, written in Bash, viewed 252 times.
URL https://code.nat.moe/view/ea748981 Embed
Download Paste or View Raw
  1. #!/bin/bash
  2.  
  3. [ -z "$2" ] && echo "usage: $0 <query> <ns> [timeout=5]" && exit 1
  4.  
  5. { sleep 1; dig $1 @$2 > /dev/null; } &
  6.  
  7. timeout ${3:-5} tcpdump -nvi any src port 53 and src $2 2>&1 \
  8.   | grep '>' \
  9.   | tail -n1 \
  10.   | cut -d':' -f2 \
  11.   | tr ' ' '\n' \
  12.   | sed '$d; 1,3d' \
  13.   | while read n; do {
  14.     read qt; read rslt
  15.     echo "$n,$qt,$rslt"
  16.   }; done

Reply to "cndns"

Here you can reply to the paste above

captcha