Ubuntu netcat

From richud.com
Jump to navigation Jump to search

Netcat / nc

Fantastic little program!

network dump of a partition


#netcat listens on port 7000, any data it receives is gunzipped and piped to dd which writes it to partition, in this case partition 4
nc -l -p 7000 | gzip -dfc | dd of=/dev/sda4
#dd reads in the test.raw raw image from current path, gzips it up and pipes it to netcat which connects to IP on port 7000
dd if=test.raw | gzip -cf | nc 7000 -q 10

network dump qcow2 image to hdd

Dump a qemu .qcow2 VM over network to another pc. Mount the qcow2 image with nbd and dump as a block device via dd. Very fast!


sudo -i
qemu-nbd -c /dev/nbd0 kodi.qcow2
dd if=/dev/nbd0 | gzip -cf | nc 7000 -q 10


sudo -i
nc -l -p 7000 | gzip -dfc | dd of=/dev/sda