Skip to content

Instantly share code, notes, and snippets.

@Habbie
Created July 5, 2024 14:10
Show Gist options
  • Save Habbie/f7d8a9d513908995f75254e87a5b7e38 to your computer and use it in GitHub Desktop.
Save Habbie/f7d8a9d513908995f75254e87a5b7e38 to your computer and use it in GitHub Desktop.
diff --git a/bitflipper.sh b/bitflipper.sh
index d243420..eb2f6b9 100755
--- a/bitflipper.sh
+++ b/bitflipper.sh
@@ -51,19 +51,19 @@ then
else
MTR_INTERFACE=""
fi
-echo "Executing mtr -4Tzbw ${MTR_INTERFACE} ${TARGET}"
-mtr -4Tzbw ${MTR_INTERFACE} ${TARGET} | tee -a $REPORT
+echo "Executing mtr -4Tzbw ${MTR_INTERFACE} ${TARGET%:*}"
+mtr -4Tzbw ${MTR_INTERFACE} ${TARGET%:*} | tee -a $REPORT
echo "(finished at $(date -Iseconds))"
-echo "Executing mtr -4zbw ${MTR_INTERFACE} ${TARGET}"
-mtr -4zbw ${MTR_INTERFACE} ${TARGET} | tee -a $REPORT
+echo "Executing mtr -4zbw ${MTR_INTERFACE} ${TARGET%:*}"
+mtr -4zbw ${MTR_INTERFACE} ${TARGET%:*} | tee -a $REPORT
echo "(finished at $(date -Iseconds))"
echo "Starting tcpdump in the background"
-tcpdump -i $OUTGOING_INTERFACE -s 0 -w $TARGET_PCAP -n host $TARGET and port 80 &
+tcpdump -i $OUTGOING_INTERFACE -s 0 -w $TARGET_PCAP -n host ${TARGET%:*} and port 8001 &
TCPDUMP=$!
sleep 1
-tail -f $TARGET_PCAP | tcpdump -r - -n -X src host $TARGET | grep -i '\(AA[^A ]AA\)\|\(CC[^C ]CC\)' &
+tail -f $TARGET_PCAP | tcpdump -r - -n -X src host ${TARGET%:*} | grep -i '\(AA[^A ]AA\)\|\(CC[^C ]CC\)' &
TCPDUMP_TAIL=$!
RUNNING=1
@@ -106,11 +106,11 @@ echo "Waiting 10 seconds to settle down the pcaps"
sleep 10
echo | tee -a $REPORT
echo "Finding packets with bitflips" | tee -a $REPORT
-if tcpdump -r $TARGET_PCAP -n -X src host $TARGET | grep -i '\(AA[^A ]AA\)\|\(CC[^C ]CC\)'
+if tcpdump -r $TARGET_PCAP -n -X src host ${TARGET%:*} | grep -i '\(AA[^A ]AA\)\|\(CC[^C ]CC\)'
then
echo "Bitflips found!" | tee -a $REPORT
echo | tee -a $REPORT
- tcpdump -r $TARGET_PCAP -n -X src host $TARGET | grep -B 10 -A 10 -i '\(AA[^A ]AA\)\|\(CC[^C ]CC\)' >> $REPORT
+ tcpdump -r $TARGET_PCAP -n -X src host ${TARGET%:*} | grep -B 10 -A 10 -i '\(AA[^A ]AA\)\|\(CC[^C ]CC\)' >> $REPORT
else
echo "NO bitflips found" | tee -a $REPORT
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment