MCPcopy
hub / github.com/srixivas/PcapXray / test_load_roundtrip

Function test_load_roundtrip

Test/test_sqlite_store.py:61–92  ·  view source on GitHub ↗
(store)

Source from the content-addressed store, hash-verified

59
60
61def 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
95def test_save_overwrites_existing(store):

Callers

nothing calls this directly

Calls 3

_seed_memoryFunction · 0.85
save_sessionMethod · 0.80
load_sessionMethod · 0.80

Tested by

no test coverage detected