summaryrefslogtreecommitdiffstats
path: root/solve/solve
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2024-04-01 20:39:11 +0200
committerLouis Burda <quent.burda@gmail.com>2024-04-01 20:39:11 +0200
commitaa75093e0e43ece27948812c0cecf46894c846a2 (patch)
treef23e505bdbd2223dc3b2f1b8f57b6b50f0d39fa7 /solve/solve
downloadcscg2024-for2-master.tar.gz
cscg2024-for2-master.zip
Add solutionHEADmaster
Diffstat (limited to 'solve/solve')
-rwxr-xr-xsolve/solve12
1 files changed, 12 insertions, 0 deletions
diff --git a/solve/solve b/solve/solve
new file mode 100755
index 0000000..5365871
--- /dev/null
+++ b/solve/solve
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+from base64 import b64decode
+import subprocess
+import requests
+import re
+
+packet_filter = "ip.src_host == 192.168.178.21 && ip.dst_host == 45.142.177.160 && tcp.flags.syn == 1"
+cmd = f"tshark -nr intro-forensics-2.pcapng -Y '{packet_filter}' -T fields -e tcp.dstport"
+ports = subprocess.check_output(cmd, shell=True).decode().split("\n")
+ports = b"".join([int.to_bytes(int(p), 2, "big") for p in ports if p.strip() != ""])
+print(ports.decode())