Compare commits
2 commits
3f27473357
...
7be1550278
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7be1550278 | ||
![]() |
e0e6bd6a99 |
2 changed files with 31 additions and 21 deletions
11
enrich.py
11
enrich.py
|
@ -393,9 +393,12 @@ def analyze_pcap(pcapng_path, start_ts, end_ts, ap_bssid, ap_channel):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
ssid_hidden_status[ssid] = hidden_ssid
|
ssid_hidden_status[ssid] = hidden_ssid
|
||||||
if ssid not in ssid_encryption_status:
|
# Store all observed values
|
||||||
ssid_encryption_status[ssid] = is_open
|
if ssid in ssid_encryption_status:
|
||||||
|
ssid_encryption_status[ssid].append(is_open)
|
||||||
|
else:
|
||||||
|
ssid_encryption_status[ssid] = [is_open]
|
||||||
|
|
||||||
ssid_packet_counts[ssid] += 1
|
ssid_packet_counts[ssid] += 1
|
||||||
|
|
||||||
bssid = getattr(wlan, 'bssid', '').lower()
|
bssid = getattr(wlan, 'bssid', '').lower()
|
||||||
|
@ -434,7 +437,7 @@ def analyze_pcap(pcapng_path, start_ts, end_ts, ap_bssid, ap_channel):
|
||||||
ssid_summary.append({
|
ssid_summary.append({
|
||||||
'SSID': ssid,
|
'SSID': ssid,
|
||||||
'Hidden': ssid_hidden_status.get(ssid, False),
|
'Hidden': ssid_hidden_status.get(ssid, False),
|
||||||
'Open': ssid_encryption_status.get(ssid, True),
|
'Open': all(ssid_encryption_status.get(ssid, [True])),
|
||||||
'BSSID_Count': len(bssids),
|
'BSSID_Count': len(bssids),
|
||||||
'BSSIDs': ";".join(sorted(bssids)),
|
'BSSIDs': ";".join(sorted(bssids)),
|
||||||
'Avg_Signal': mean(signals) if signals else 0,
|
'Avg_Signal': mean(signals) if signals else 0,
|
||||||
|
|
41
runtest.sh
41
runtest.sh
|
@ -71,29 +71,36 @@ run_iperf() {
|
||||||
local tmp_err
|
local tmp_err
|
||||||
tmp_err=$(mktemp)
|
tmp_err=$(mktemp)
|
||||||
|
|
||||||
local result
|
local tmp_json
|
||||||
result=$(iperf3 "${args[@]}" 2>"$tmp_err" | jq -r '
|
tmp_json=$(mktemp)
|
||||||
if .error then
|
|
||||||
"iperf3-error"
|
|
||||||
elif has("end") | not then
|
|
||||||
"no-end"
|
|
||||||
elif .end | has("sum_received") then
|
|
||||||
.end.sum_received.bits_per_second
|
|
||||||
elif .end | has("sum") then
|
|
||||||
.end.sum.bits_per_second
|
|
||||||
else
|
|
||||||
"unexpected-format"
|
|
||||||
end' || echo "execution-failed")
|
|
||||||
|
|
||||||
if [[ "$result" == "iperf3-error" || "$result" == "no-end" || "$result" == "unexpected-format" || "$result" == "execution-failed" ]]; then
|
local result
|
||||||
echo "$(date -Iseconds),iperf $mode $direction to $target failed with '$result'" >>"$FAILURE_LOG"
|
result=$(iperf3 "${args[@]}" -J >"$tmp_json" 2>"$tmp_err")
|
||||||
|
|
||||||
|
parsed=$(jq -r '
|
||||||
|
if .error then
|
||||||
|
"iperf3-error"
|
||||||
|
elif has("end") | not then
|
||||||
|
"no-end"
|
||||||
|
elif .end | has("sum_received") then
|
||||||
|
.end.sum_received.bits_per_second
|
||||||
|
elif .end | has("sum") then
|
||||||
|
.end.sum.bits_per_second
|
||||||
|
else
|
||||||
|
"unexpected-format"
|
||||||
|
end' "$tmp_json" || echo "execution-failed")
|
||||||
|
|
||||||
|
if [[ "$parsed" == "iperf3-error" || "$parsed" == "no-end" || "$parsed" == "unexpected-format" || "$parsed" == "execution-failed" ]]; then
|
||||||
|
timestamp=$(date -Iseconds)
|
||||||
|
echo "$timestamp,iperf $mode $direction to $target failed with '$parsed'" >>"$FAILURE_LOG"
|
||||||
echo "[stderr] $(cat "$tmp_err")" >>"$FAILURE_LOG"
|
echo "[stderr] $(cat "$tmp_err")" >>"$FAILURE_LOG"
|
||||||
|
echo "[json] $(cat "$tmp_json")" >>"$FAILURE_LOG"
|
||||||
echo "0"
|
echo "0"
|
||||||
else
|
else
|
||||||
echo "$result"
|
echo "$parsed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f "$tmp_err"
|
rm -f "$tmp_err" "$tmp_json"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start test email
|
# Start test email
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue