
This time we have a series of ICMP (Ping) requests where the TTL has ben modified in such a way that each TTL can be translated to an ASCII value.

We can write a Python program to extract these TTL values and convert them to ASCII
import pyshark
# Define the source and destination IP addresses for filtering
src_ip = '192.168.228.67'
dst_ip = '192.168.228.253'
flag = []
# Load the pcap file and filter for ICMP traffic between the specified IPs
capture = pyshark.FileCapture('flag.pcapng', display_filter=f'ip.src == {src_ip} && ip.dst == {dst_ip} && icmp')
# Process packets and convert TTL values to ASCII
for packet in capture:
try:
# Ensure the packet is an ICMP Echo Request
if int(packet.icmp.type) == 8: # Echo Request
ttl_value = int(packet.ip.ttl)
# Convert TTL to ASCII character
ascii_char = chr(ttl_value)
flag.append(ascii_char)
# Print packet details
print(f"ICMP Echo Request from {packet.ip.src} to {packet.ip.dst}")
print(f"TTL: {ttl_value} (ASCII: '{ascii_char}')")
if hasattr(packet.icmp, 'seq'):
print(f"Sequence Number: {packet.icmp.seq}")
print("----")
except AttributeError:
# Skip packets without the required attributes
continue
# Print the reconstructed flag
print("Extracted Flag:", ''.join(flag))
# Close the capture
capture.close()
