record ingress and egress
This commit is contained in:
parent
10afc73abd
commit
ad10ebe437
1 changed files with 10 additions and 1 deletions
|
|
@ -4,7 +4,10 @@ from scapy.all import ICMP, IP, Dot1Q, Ether, sendp, AsyncSniffer, wrpcap
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
a = AsyncSniffer(iface="enp5s0d1", filter="icmp")
|
a = AsyncSniffer(iface="enp5s0d1", filter="icmp")
|
||||||
|
b = AsyncSniffer(iface="enp2s0", filter="icmp")
|
||||||
a.start()
|
a.start()
|
||||||
|
b.start()
|
||||||
|
|
||||||
for i in tqdm(range(0, 4095)):
|
for i in tqdm(range(0, 4095)):
|
||||||
sendp(
|
sendp(
|
||||||
Ether(dst="00:02:c9:27:10:73", src="00:f0:cb:ef:e0:3b")
|
Ether(dst="00:02:c9:27:10:73", src="00:f0:cb:ef:e0:3b")
|
||||||
|
|
@ -16,7 +19,9 @@ for i in tqdm(range(0, 4095)):
|
||||||
)
|
)
|
||||||
print("Wrapping up and waiting for last packets")
|
print("Wrapping up and waiting for last packets")
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
||||||
plist = a.stop()
|
plist = a.stop()
|
||||||
|
plist_ingress = b.stop()
|
||||||
|
|
||||||
seen = [False for i in range(4095)]
|
seen = [False for i in range(4095)]
|
||||||
icmpid = [False for i in range(4095)]
|
icmpid = [False for i in range(4095)]
|
||||||
|
|
@ -56,6 +61,7 @@ import subprocess
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
|
|
||||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + "-test_all_vlans"
|
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + "-test_all_vlans"
|
||||||
log_dir = Path("./logs") / timestamp
|
log_dir = Path("./logs") / timestamp
|
||||||
|
|
@ -67,13 +73,16 @@ with open(log_dir / "seen_vlans.txt", "w") as f:
|
||||||
with open(log_dir / "seen_icmp_ids.txt", "w") as f:
|
with open(log_dir / "seen_icmp_ids.txt", "w") as f:
|
||||||
f.write(pprint(icmpid))
|
f.write(pprint(icmpid))
|
||||||
|
|
||||||
shutil.copy(Path("./script.py"), log_dir / "script.py")
|
shutil.copy(Path(sys.argv[0]), log_dir / sys.argv[0])
|
||||||
|
|
||||||
print(" - [x] script.py")
|
print(" - [x] script.py")
|
||||||
|
|
||||||
with open(log_dir / "egress.pcap", "wb") as file:
|
with open(log_dir / "egress.pcap", "wb") as file:
|
||||||
wrpcap(file, plist)
|
wrpcap(file, plist)
|
||||||
|
|
||||||
|
with open(log_dir / "ingress.pcap", "wb") as file:
|
||||||
|
wrpcap(file, plist_ingress)
|
||||||
|
|
||||||
print(" - [x] pcap")
|
print(" - [x] pcap")
|
||||||
|
|
||||||
cmd_config = ["ssh", "-o", "StrictHostKeyChecking=no", "root@192.168.42.6", "cli show config"]
|
cmd_config = ["ssh", "-o", "StrictHostKeyChecking=no", "root@192.168.42.6", "cli show config"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue