Skip to content

Commit 8a5d3bd

Browse files
committed
Improved dns regs
1 parent 143d8fa commit 8a5d3bd

File tree

1 file changed

+18
-41
lines changed

1 file changed

+18
-41
lines changed

reconftw.sh

+18-41
Original file line numberDiff line numberDiff line change
@@ -1170,28 +1170,26 @@ function sub_dns() {
11701170
if [[ ! -f "$called_fn_dir/.${FUNCNAME[0]}" ]] || [[ $DIFF == true ]]; then
11711171
start_subfunc "${FUNCNAME[0]}" "Running: DNS Subdomain Enumeration and PTR search"
11721172

1173-
if [[ $AXIOM != true ]]; then
1174-
if [[ -s "subdomains/subdomains.txt" ]]; then
1175-
dnsx -r "$resolvers_trusted" -recon -silent -retry 3 -json \
1176-
-o "subdomains/subdomains_dnsregs.json" <"subdomains/subdomains.txt" 2>>"$LOGFILE" >/dev/null
1177-
fi
1178-
1179-
if [[ -s "subdomains/subdomains_dnsregs.json" ]]; then
1180-
# Extract various DNS records and process them
1181-
jq -r --arg domain "$domain" '.. | strings | select(test("\\." + $domain + "$"))' <"subdomains/subdomains_dnsregs.json" |
1182-
grep -E '^([a-zA-Z0-9][-a-zA-Z0-9]*\.)+[a-zA-Z]{2,}$' |
1183-
sort -u | anew -q .tmp/subdomains_dns.txt
1184-
1185-
jq -r '.. | strings | select(test("^(\\d{1,3}\\.){3}\\d{1,3}$|^[0-9a-fA-F:]+$"))' <"subdomains/subdomains_dnsregs.json" |
1186-
sort -u | hakip2host | awk '{print $3}' | unfurl -u domains |
1187-
sed -e 's/^\*\.//' -e 's/\.$//' -e '/\./!d' | grep "\.$domain$" |
1188-
grep -E '^([a-zA-Z0-9][-a-zA-Z0-9]*\.)+[a-zA-Z]{2,}$' | sort -u |
1189-
anew -q .tmp/subdomains_dns.txt
1173+
if [[ -s "subdomains/subdomains.txt" ]]; then
1174+
dnsx -r "$resolvers_trusted" -recon -silent -retry 3 -json \
1175+
-o "subdomains/subdomains_dnsregs.json" <"subdomains/subdomains.txt" 2>>"$LOGFILE" >/dev/null
1176+
fi
1177+
if [[ -s "subdomains/subdomains_dnsregs.json" ]]; then
1178+
# Extract various DNS records and process them
1179+
jq -r --arg domain "$domain" '.. | strings | select(test("\\." + $domain + "$"))' <"subdomains/subdomains_dnsregs.json" |
1180+
grep -E '^([a-zA-Z0-9][-a-zA-Z0-9]*\.)+[a-zA-Z]{2,}$' |
1181+
sort -u | anew -q .tmp/subdomains_dns.txt
11901182

1191-
jq -r 'select(.host) |"\(.host) - \((.a // [])[])", "\(.host) - \((.aaaa // [])[])"' <"subdomains/subdomains_dnsregs.json" |
1192-
grep -E ' - [0-9a-fA-F:.]+$' | sort -u | anew -q "subdomains/subdomains_ips.txt"
1193-
fi
1183+
jq -r '.. | strings | select(test("^(\\d{1,3}\\.){3}\\d{1,3}$|^[0-9a-fA-F:]+$"))' <"subdomains/subdomains_dnsregs.json" |
1184+
sort -u | hakip2host | awk '{print $3}' | unfurl -u domains |
1185+
sed -e 's/^\*\.//' -e 's/\.$//' -e '/\./!d' | grep "\.$domain$" |
1186+
grep -E '^([a-zA-Z0-9][-a-zA-Z0-9]*\.)+[a-zA-Z]{2,}$' | sort -u |
1187+
anew -q .tmp/subdomains_dns.txt
11941188

1189+
jq -r 'select(.host) |"\(.host) - \((.a // [])[])", "\(.host) - \((.aaaa // [])[])"' <"subdomains/subdomains_dnsregs.json" |
1190+
grep -E ' - [0-9a-fA-F:.]+$' | sort -u | anew -q "subdomains/subdomains_ips.txt"
1191+
fi
1192+
if [[ $AXIOM != true ]]; then
11951193
if ! resolvers_update_quick_local; then
11961194
printf "%b[!] Failed to update resolvers.%b\n" "$bred" "$reset"
11971195
fi
@@ -1204,27 +1202,6 @@ function sub_dns() {
12041202
2>>"$LOGFILE" >/dev/null
12051203
fi
12061204
else
1207-
if [[ -s "subdomains/subdomains.txt" ]]; then
1208-
axiom-scan "subdomains/subdomains.txt" -m dnsx -recon -retry 3 -json \
1209-
-o "subdomains/subdomains_dnsregs.json" "$AXIOM_EXTRA_ARGS" 2>>"$LOGFILE" >/dev/null
1210-
fi
1211-
1212-
if [[ -s "subdomains/subdomains_dnsregs.json" ]]; then
1213-
# Extract various DNS records and process them
1214-
jq -r --arg domain "$domain" '.. | strings | select(test("\\." + $domain + "$"))' <"subdomains/subdomains_dnsregs.json" |
1215-
grep -E '^([a-zA-Z0-9][-a-zA-Z0-9]*\.)+[a-zA-Z]{2,}$' |
1216-
sort -u | anew -q .tmp/subdomains_dns.txt
1217-
1218-
jq -r '.. | strings | select(test("^(\\d{1,3}\\.){3}\\d{1,3}$|^[0-9a-fA-F:]+$"))' <"subdomains/subdomains_dnsregs.json" |
1219-
sort -u | hakip2host | awk '{print $3}' | unfurl -u domains |
1220-
sed -e 's/^\*\.//' -e 's/\.$//' -e '/\./!d' | grep "\.$domain$" |
1221-
grep -E '^([a-zA-Z0-9][-a-zA-Z0-9]*\.)+[a-zA-Z]{2,}$' | sort -u |
1222-
anew -q .tmp/subdomains_dns.txt
1223-
1224-
jq -r 'select(.host) |"\(.host) - \((.a // [])[])", "\(.host) - \((.aaaa // [])[])"' <"subdomains/subdomains_dnsregs.json" |
1225-
grep -E ' - [0-9a-fA-F:.]+$' | sort -u | anew -q "subdomains/subdomains_ips.txt"
1226-
fi
1227-
12281205
if ! resolvers_update_quick_axiom; then
12291206
printf "%b[!] Failed to update resolvers.%b\n" "$bred" "$reset"
12301207
fi

0 commit comments

Comments
 (0)