(store)
| 59 | |
| 60 | |
| 61 | def test_load_roundtrip(store): |
| 62 | _seed_memory() |
| 63 | store.save_session("mypcap") |
| 64 | |
| 65 | # Wipe memory to confirm load repopulates it |
| 66 | memory.packet_db = {} |
| 67 | memory.lan_hosts = {} |
| 68 | memory.destination_hosts = {} |
| 69 | memory.possible_tor_traffic = [] |
| 70 | memory.possible_mal_traffic = [] |
| 71 | |
| 72 | store.load_session("mypcap") |
| 73 | |
| 74 | assert "1.2.3.4/5.6.7.8/443" in memory.packet_db |
| 75 | session = memory.packet_db["1.2.3.4/5.6.7.8/443"] |
| 76 | assert session.Ethernet["src"] == "aa:bb:cc:dd:ee:ff" |
| 77 | assert session.Payload["forward"] == ["hello"] |
| 78 | assert session.covert is False |
| 79 | assert session.file_signatures == ["PDF"] |
| 80 | |
| 81 | assert "aa:bb:cc:dd:ee:ff" in memory.lan_hosts |
| 82 | host = memory.lan_hosts["aa:bb:cc:dd:ee:ff"] |
| 83 | assert host.ip == "1.2.3.4" |
| 84 | assert host.device_vendor == "Acme" |
| 85 | |
| 86 | assert "5.6.7.8" in memory.destination_hosts |
| 87 | dst = memory.destination_hosts["5.6.7.8"] |
| 88 | assert dst.domain_name == "example.com" |
| 89 | assert dst.mac == "11:22:33:44:55:66" |
| 90 | |
| 91 | assert memory.possible_tor_traffic == ["1.2.3.4/5.6.7.8/443"] |
| 92 | assert memory.possible_mal_traffic == ["1.2.3.4/5.6.7.8/443"] |
| 93 | |
| 94 | |
| 95 | def test_save_overwrites_existing(store): |
nothing calls this directly
no test coverage detected