Created
October 22, 2017 16:04
-
-
Save boina-n/623bde7d791fcd0618a767bda96835a8 to your computer and use it in GitHub Desktop.
DNS debug Notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zone "toto-tr.fr.rt" { | |
type master; | |
masters { 20.20.20.20; }; | |
file "slaves/db.toto-tr.fr.rt"; | |
}; | |
#Replace this : | |
(^[a-z0-9\-]+(\.[a-z0-9\-]+)*) | |
#By this: | |
zone "\1" {\n\ttype master;\n\tmasters { 20.20.20.20; };\n\tfile "slaves/db.\1";\n};\n | |
cat data.fqdn | while read p ; do echo -e "zone "$p" {\n\ttype slave;\n\tmasters { 41.223.142.3; };\n\tfile "slaves/db.$p";\n};\n" ; done | |
cat /tmp/data |grep ^Z | rev | tr -d \$Z |rev |cut -d : -f 1 > /tmp/data.fqdn | |
cat /tmp/data.fqdn | grep arpa | sort |uniq | while read p ; do echo -e "zone "$p" {\n\ttype slave;\n\tmasters { 41.223.142.4; };\n\tfile \"slaves/db.$p\";\n};\n" ; done > /usr/local/progs/named/etc/rev.conf | |
cat /tmp/data.fqdn | grep -v arpa | sort |uniq | while read p ; do echo -e "zone "$p" {\n\ttype slave;\n\tmasters { 41.223.142.4; };\n\tfile \"slaves/db.$p\";\n};\n" ; done > /usr/local/progs/named/etc/autozones.conf | |
cat /tmp/data.fqdn | grep arpa | sort |uniq | while read p ; do echo -e "zone "$p" {\n\ttype slave;\n\tmasters { 127.0.0.1; };\n\tfile \"slaves/db.$p\";\n};\n" ; done > /usr/local/progs/bind-9.9.7-P3-TCP3sec-nossl-rrl-xtds-ipv6-64bits/etc/rev.conf | |
cat /tmp/data.fqdn | grep -v arpa | sort |uniq | while read p ; do echo -e "zone "$p" {\n\ttype slave;\n\tmasters { 127.0.0.1; };\n\tfile \"slaves/db.$p\";\n};\n" ; done > /usr/local/progs/bind-9.9.7-P3-TCP3sec-nossl-rrl-xtds-ipv6-64bits/etc/autozones.conf | |
tcpdump -nni eth0 port 53 -w /tmp/dns.`hostname`-`date +%Y%m%d`-NBO.pcap -C 100M | |
## debugging | |
cat /var/log/daemon.log | grep "FORMERR" > formerr.txt | |
cat /tmp/formerr.txt |awk -F" " '{print $09}' | awk -F"#" '{print $1}' |sort |uniq -c|sort -rn > /tmp/IP.txt | |
tcpdump -vvv -i any src 80.80.80.80 -w toto.pcap | |
### | |
# PCAP CLEANER | |
### | |
tshark -R 'udp.dstport== 53 || tcp.dstport==53' -r pcaps/dns-traffic.pcap -w pcaps/dns-traffic_.ok.pcap | |
ls | while read p ; do tshark -R 'udp.dstport== 53 || tcp.dstport==53' -r $p -w ok.$p ; done | |
### | |
# Xshell session generator. | |
### | |
cat hosts.txt | while read p | |
do | |
var=($( echo $p | awk '{print $1" "$2 }')) | |
sed s/Host=.*/Host=${var[1]}/g templates.xsh > ${var[0]}.xsh | |
echo $p | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment