-
Notifications
You must be signed in to change notification settings - Fork 1
/
dns_client.cheat
110 lines (73 loc) · 2.77 KB
/
dns_client.cheat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
% dns, client, resolvectl, pushou
# Simple query
resolvectl query registry.iutbeziers.fr
# Reverse Query
resolvectl query 194.199.227.220
# Query MX SRV...
resolvectl --legend=<LEGEND> -t <TYPE_ENREG> query <DOMAIN_NAME>
# Full query options
resolvectl <RESOLVECTL_ORDERS>
# Statistics
resolvectl statistics
# dns per interface
resolvectl dns
# Get status
resolvectl status
# Get domain
resolvectl domain
# Debug systemd-resolved
sudo resolvectl log-level debug
sudo journalctl -f -u systemd-resolved.service
; default-route
# Set default-route state per physical interfaces
resolvectl default-route <PHY_NETWORK_INT> <TRUE_OR_FALSE>
$ TYPE_ENREG: echo 'A SOA ANY CNAME TXT MX AAAA SRV' | tr ' ' '\n'
$ LEGEND: echo 'yes no' | tr ' ' '\n'
$ TRUE_OR_FALSE: echo 'true false' | tr ' ' '\n'
$ PHY_NETWORK_INT: echo $(sudo ip link show|awk '{print $2}'|egrep '^en|^wl'|sed 's/://')| tr ' ' '\n'
& RESOLVECTL_ORDERS: echo 'query service openpgp tlsa status statistics reset-statistics flush-caches reset-server-features dns domain default-route llmnr
mdns dnsovertls dnssec nta revert log-level
% dns, client, dig , pushou
# Simple query
dig <FQDN>
# Reverse Query
dig -x <IP_ADDRESS>
# no recursion
dig +norec @a.root-servers.net. <FQDN>
# trace
dig +trace <FQDN>
# short
dig +short fr. NS
# focus on answer
dig www.umontpellier.fr +noall +answer
# dig DNS over Https
dig @8.8.8.8 +https www.google.fr
# lookup from file query.txt
dig -f query.txt +short
# get all record for a domain
dig +noall +answer umontpellier.fr <TYPE_ENREG>
# dig ipv6
dig -6 @2001:4860:4860::8888 google.com A
# cat dns.flags
curl https://gist.githubusercontent.com/pushou/ba35386d3b6122fbe20467ce1ef1822e/raw/0fae3721ab91e003a94d7b7221cf7d31c69cf8f8/dns-flag.txt
$ TYPE_ENREG: echo 'A SOA ANY CNAME TXT MX AAAA SRV' | tr ' ' '\n'
% dns,client, curl , pushou
# doh with curl dns-json
curl -H 'accept: application/dns-json' 'https://cloudflare-dns.com/dns-query?name=<FQDN>&type=<TYPE_ENREG>' | jq .
# doh with curl dns-message
curl -H 'accept: application/dns-message' 'https://dns.google/dns-query?dns=q80BAAABAAAAAAAAA3d3dwdleGFtcGxlA2NvbQAAAQAB' | hexdump -c
;# doh curl (not working)
;curl -v --doh-insecure --doh-url https://cloudflare-dns.com/dns-query https://github.com
% dns, q , pushou
# query q doh
q A www.umontpellier.fr @https://doh.dnswarden.com
# query q doh verbose mode
q -v A www.umontpellier.fr @https://cloudflare-dns.com/dns-query
# query q multiple type queries
q MX TXT umontpellier.fr
# query q reverse
q -x 194.199.227.80
$ TYPE_ENREG: echo 'A SOA CNAME TXT ANY MX AAAA SRV' | tr ' ' '\n'
$ LEGEND: echo 'yes no' | tr ' ' '\n'
$ TRUE_OR_FALSE: echo 'true false' | tr ' ' '\n'
$ PHY_NETWORK_INT: echo $(sudo ip link show|awk '{print $2}'|egrep '^en|^wl'|sed 's/://')| tr ' ' '\n'