From ea3f8f01bbbf7ae7a31537b2438d81b384f357f3 Mon Sep 17 00:00:00 2001 From: sinavir Date: Wed, 18 Feb 2026 10:38:19 +0100 Subject: [PATCH] test vlans no capture --- test_vlans_no_capture.py | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 test_vlans_no_capture.py diff --git a/test_vlans_no_capture.py b/test_vlans_no_capture.py new file mode 100644 index 0000000..3f7a302 --- /dev/null +++ b/test_vlans_no_capture.py @@ -0,0 +1,42 @@ +from time import sleep + +from scapy.all import ICMP, IP, Dot1Q, Ether, sendp, AsyncSniffer, wrpcap, conf +from tqdm import tqdm + +conf.pcap = True + +for i in tqdm(range(1, 4095)): + sendp( + Ether(dst="00:02:c9:27:10:73", src="00:f0:cb:ef:e0:3b") + / Dot1Q(vlan=i) + / IP(dst="10.0.45.45", src="10.0.45.5") + / ICMP(id=i), + iface="enp2s0", + verbose=False, + ) +print("Collecting :") +import subprocess +from datetime import datetime +from pathlib import Path +import shutil +import sys + +timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + "-test_all_vlans_no_capture" +log_dir = Path("./logs") / timestamp +log_dir.mkdir(parents=True, exist_ok=True) + +shutil.copy(Path(sys.argv[0]), log_dir / sys.argv[0]) + +print(" - [x] script.py") + +cmd_config = ["ssh", "-o", "StrictHostKeyChecking=no", "root@192.168.42.6", "cli show config"] +cmd_rsi = ["ssh", "-o", "StrictHostKeyChecking=no", "root@192.168.42.6", "cli request support information"] + +result = subprocess.run(cmd_config, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) + +with open(log_dir / "config.txt", "w") as f: + f.write(result.stdout) + +print(" - [x] config") + +print("Finished, saved to", log_dir)