How do I send a message using ping?
2 answers
How about ping -p pattern
? Please be aware that not all versions ping
support -p
.
You can specify up to 16 "pad" bytes to fill the packet you send. This is useful for diagnosing data-dependent problems in the network. For example -p ff will populate the sent packet with everyone.
eg. ping -p 486920686572652e www.example.com
where 486920686572652e = Hi here.
+7
source to share
#!/bin/python3
import sys, subprocess
text = sys.argv[1]
target = sys.argv[2]
if len(text)>16:
print("Text too long!")
exit()
enctext = r''.join( hex(ord(c)).split("x")[1] for c in text )
subprocess.check_output(["ping", "-p", enctext, "-c", "1", target])
Maybe this piece of code is helpful for someone
+2
source to share