Echo Chamber
Author: @JohnHammond#6971 Is anyone there? Is anyone there? I'm sending myself the flag! I'm sending myself the flag!
Last updated
Author: @JohnHammond#6971 Is anyone there? Is anyone there? I'm sending myself the flag! I'm sending myself the flag!
Last updated
import subprocess
# Run tshark command to extract the first 2 bytes of data from each packet
command = ["tshark", "-r", "echo_chamber.pcap", "-T", "fields", "-e", "data"]
result = subprocess.run(command, capture_output=True, text=True)
# Process the output to get only the first 2 bytes of each line
extracted_bytes = [line[:2] for line in result.stdout.splitlines() if line]
with open("extracted_bytes.txt", "w") as file:
for byte_pair in extracted_bytes:
file.write(f"{byte_pair}\n")
print("Data successfully written to extracted_bytes.txt")with open("extracted_bytes.txt", "r") as file:
lines = file.readlines()
# Keep only the odd-indexed lines (0, 2, 4...) which correspond to 1st, 3rd, 5th... lines
filtered_lines = [line for i, line in enumerate(lines) if i % 2 == 0]
with open("extracted_bytes.txt", "w") as file:
file.writelines(filtered_lines)
print("Every alternate line removed from extracted_bytes.txt")