CI / Format and clippy (push) Successful in 1m13s
CI / Dependency audit (push) Successful in 13s
CI / Tests (Linux) (push) Successful in 1m35s
Release / Create release (push) Successful in 7s
CI / Check desktop app (Linux) (push) Successful in 3m19s
Release / CLI (linux-aarch64) (push) Successful in 1m3s
Release / CLI (linux-x86_64) (push) Successful in 1m28s
Release / Desktop app (linux-aarch64) (push) Successful in 7m16s
Release / Desktop app (linux-x86_64) (push) Successful in 10m17s
Release / Desktop app (windows) (push) Successful in 4m54s
Completes the English-only standardization for code, comments, scripts and CI templates (UI/CLI-facing strings stay bilingual pt-BR/en, untouched). Covers the remaining crates/, apps/gui/ui/ and apps/gui/src-tauri/ comments, .gitea/ workflow and template comments, .githooks/ hooks, and the scripts/ source comments for the files already renamed in a prior commit (check.sh, generate-logo.py, install-hooks.sh). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VAyr8d7HuAdUGB6aA5xmDD
84 lines
2.5 KiB
Rust
84 lines
2.5 KiB
Rust
//! Integration test: writes frames with `PcapWriter`, reads them back with
|
|
//! `PcapReader`, and verifies `Engine::analyze_pcap` reconstructs the AP and handshake.
|
|
//!
|
|
|
|
mod common;
|
|
|
|
use sabia_core::engine::Engine;
|
|
use sabia_core::pcapreader::PcapReader;
|
|
use sabia_core::pcapwriter::PcapWriter;
|
|
|
|
#[test]
|
|
fn writes_and_reads_back_identical_frames() {
|
|
let dir = tempfile::tempdir().expect("tempdir");
|
|
let path = dir.path().join("captura.pcap");
|
|
|
|
let beacon = common::radiotap_wrap(
|
|
&common::beacon_frame(common::ap(), "PcapRede", 1, &[2]),
|
|
2412,
|
|
-30,
|
|
);
|
|
let probe = common::radiotap_wrap(&common::probe_request(common::sta(), "PcapRede"), 2412, -45);
|
|
|
|
{
|
|
let mut writer = PcapWriter::create(&path).expect("create");
|
|
writer.write_frame(&beacon).expect("write beacon");
|
|
writer.write_frame(&probe).expect("write probe");
|
|
writer.flush().expect("flush");
|
|
}
|
|
|
|
let mut reader = PcapReader::open(&path).expect("open");
|
|
assert!(reader.supports_80211());
|
|
|
|
let f1 = reader
|
|
.next_frame()
|
|
.expect("read 1")
|
|
.expect("frame 1 presente");
|
|
assert_eq!(f1.data, beacon);
|
|
|
|
let f2 = reader
|
|
.next_frame()
|
|
.expect("read 2")
|
|
.expect("frame 2 presente");
|
|
assert_eq!(f2.data, probe);
|
|
|
|
assert!(reader.next_frame().expect("read 3").is_none());
|
|
}
|
|
|
|
#[test]
|
|
fn analyze_pcap_finds_networks_and_handshake() {
|
|
let dir = tempfile::tempdir().expect("tempdir");
|
|
let pcap_path = dir.path().join("sessao.pcap");
|
|
let audit_path = dir.path().join("audit.log");
|
|
|
|
let beacon = common::radiotap_wrap(
|
|
&common::beacon_frame(common::ap(), "PcapHandshake", 3, &[2]),
|
|
2422,
|
|
-38,
|
|
);
|
|
let (f1, f2) = common::handshake_radiotap_frames("PcapHandshake", "senha-pcap", 2, false);
|
|
|
|
{
|
|
let mut writer = PcapWriter::create(&pcap_path).expect("create");
|
|
writer.write_frame(&beacon).expect("write beacon");
|
|
writer.write_frame(&f1).expect("write msg1");
|
|
writer.write_frame(&f2).expect("write msg2");
|
|
writer.flush().expect("flush");
|
|
}
|
|
|
|
let engine = Engine::with_audit_path(&audit_path);
|
|
let snapshot = engine.analyze_pcap(&pcap_path).expect("analyze_pcap");
|
|
|
|
assert_eq!(snapshot.access_points.len(), 1);
|
|
assert_eq!(
|
|
snapshot.access_points[0].ssid.as_deref(),
|
|
Some("PcapHandshake")
|
|
);
|
|
|
|
assert_eq!(snapshot.handshakes.len(), 1);
|
|
let hs = &snapshot.handshakes[0];
|
|
assert_eq!(hs.ssid.as_deref(), Some("PcapHandshake"));
|
|
assert!(hs.complete);
|
|
assert!(hs.crackable);
|
|
}
|