Sending a file over icmp with hping

hping3 10.0.2.254 --icmp --sign MSGID1 -d 50 -c 1 --file a_file
you need to start a listening hping on the reciever: hping3 --listen 10.0.2.254 -I eth0 --sign MSGID1 then you can send your file: hping3 10.0.2.254 --icmp --sign MSGID1 -d 50 -c 1 --file a_file
Sample Output
SENDER:
  root@hdc3:/tmp # cat a_file 
this is a file...
and some data...

  root@hdc3:/tmp # hping3 10.0.2.254 --icmp --sign MSGID1 -d 50 -c 1 --file a_file
HPING 10.0.2.254 (eth0 10.0.2.254): icmp mode set, 28 headers + 50 data bytes
[main] memlockall(): Success
Warning: can't disable memory paging!
len=78 ip=10.0.2.254 ttl=64 id=48083 icmp_seq=0 rtt=0.3 ms

--- 10.0.2.254 hping statistic ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.3/0.3/0.3 ms
  root@hdc3:/tmp # 

RECIEVER:
root@monitor:/home/hadace # hping3 --listen 10.0.2.254 -I eth0 --sign MSGID1
hping3 listen mode
[main] memlockall(): Success
Warning: can't disable memory paging!
this is a file...
and some data...

this is a file...
and some data...

^C
---  hping statistic ---
0 packets transmitted, 0 packets received, 0% packet loss
round-trip min/avg/max = 0.0/0.0/0.0 ms
root@monitor:/home/hadace # 

11
By: hadace
2013-10-23 14:01:01

These Might Interest You


  • -2
    tcpdump -n -v tcp or udp or icmp and not port 22
    opexxx · 2009-09-04 09:23:52 0
  • This command is jsut for the main IP settings of ndd. if you need ip6 or icmp edit the text within the egrep inclusion area. Felix001 - www.Fir3net.com Show Sample Output


    0
    for i in `ndd /dev/ip \? | awk '{ print $1 }' | egrep -v "ip6|status|icmp|igmp|\?"` ; do echo $i `ndd -get /dev/ip $i` ; done | grep -v \?
    felix001 · 2010-02-15 12:32:33 0
  • sending packet by ping if sending more high packet root needed... Show Sample Output


    -3
    sudo ping -f -c 999 -s 4500 target.com
    gunslinger_ · 2010-07-11 16:38:44 0
  • This is useful for sending data between 2 computers that you have shell access to. Uses tar compression during transfer. Files are compressed & uncompressed automatically. Note the trailing dash on the listening side that makes netcat listen to stdin for data. on the listening side: sudo nc -lp 2022 | sudo tar -xvf - explanation: open netcat to -l listen on -p port 2022, take the data stream and pipe to tar -x extract, -v verbose, -f using file filename - means "stdin" on the sending side: tar -cvzf - ./*| nc -w 3 name_of_listening_host 2022 explanation: compress all files in current dir using tar -c create, -v verbose, -f using file, - filename - here means "stdout" because we're tar -c instead of tar -x, -w3 wait 3 seconds on stream termination and then end the connection to the listening host name_of_listening_host, on port 2022


    -2
    on the listening side: sudo nc -lp 2022 | sudo tar -xvf - and on the sending side: tar -cvzf - ./*| nc -w 3 name_of_listening_host 2022
    smcpherson · 2009-03-27 09:59:33 7

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: