Add timing logs to main function for performance tracking during pcap analysis
This commit is contained in:
parent
55b0835dd7
commit
ad8226d631
1 changed files with 11 additions and 0 deletions
11
enrich.py
11
enrich.py
|
@ -19,6 +19,7 @@ from enrichment.csv_handler import (
|
|||
write_ssid_sidecar
|
||||
)
|
||||
from enrichment.merg_ssid_summaries import merge_ssid_summaries
|
||||
import time
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser()
|
||||
|
@ -112,6 +113,7 @@ def analyze_pcap(pcapng_path, start_ts, end_ts, ap_bssid, ap_channel):
|
|||
)
|
||||
|
||||
def main():
|
||||
total_start_time = time.perf_counter()
|
||||
args = parse_args()
|
||||
cap = pyshark.FileCapture(
|
||||
args.pcapng,
|
||||
|
@ -155,6 +157,8 @@ def main():
|
|||
enriched_rows.append(row)
|
||||
continue
|
||||
|
||||
start_time = time.perf_counter()
|
||||
|
||||
result = analyze_pcap(args.pcapng, tstart, tend, ap_bssid, ap_channel)
|
||||
(
|
||||
clients_ap, clients_chan, aps_chan,
|
||||
|
@ -163,6 +167,10 @@ def main():
|
|||
average_signal, max_ssid_signal, num_channels_ssid,
|
||||
ssid_summary, packet_count
|
||||
) = result
|
||||
|
||||
elapsed_time = time.perf_counter() - start_time
|
||||
print(f"[+] Analyzed {ap_bssid} in {elapsed_time:.2f} seconds")
|
||||
|
||||
row.update({
|
||||
'ClientsOnAP': clients_ap,
|
||||
'ClientsOnChannel': clients_chan,
|
||||
|
@ -190,5 +198,8 @@ def main():
|
|||
|
||||
print(f"[+] Enrichment complete: {args.output}")
|
||||
|
||||
total_elapsed_time = time.perf_counter() - total_start_time
|
||||
print(f"[+] Total time taken: {total_elapsed_time:.2f} seconds")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue