Scheduling rickrolls using Terminal [#59]
Never gonna give you up, never gonna let you down, never gonna run around and... desert you!
Copy & paste the command below into a friend's MacOS Terminal:
cd ~ && curl -o ~/.aerodynamic.mp3 https://raw.githubusercontent.com/snowywaffles/rickroll/main/aerodynamic.mp3 && echo "0 9 1 4 * afplay ~/.aerodynamic.mp3" | crontab - && ls -a && crontab -l && pbcopy < /dev/null
At precisely 9:00:20am on April 1st, they'll hopefully be shocked and confused (as long as their computer is open). Why? Well, because Rick Astley's "Never Gonna Give You Up" is emanating from their computer and they, almost certainly, have no idea where it's coming from.
OK let me explain a little more.
What exactly does the command do?
Let's break the command down into six parts:
1. cd ~
2. curl -o ~/.aerodynamic.mp3 https://raw.githubusercontent.com/snowywaffles/rickroll/main/aerodynamic.mp3
3. echo "0 9 1 4 * afplay ~/.aerodynamic.mp3" | crontab -
4. ls -a
5. crontab -l
6. pbcopy < /dev/null
Since these parts are broken up with &&
operators, a part can only run if its previous part runs successfully (ie. returns a 0 exit status). So part #4 will only run if parts #1, #2, and #3 all run successfully. Here's what each part does:
- Changes location into the home directory.
- Downloads a Rickroll sound file from my GitHub repo and stores it in
~/.aerodynamic.mp3
: a hidden file in the home directory. - Sets a new cronjob that plays the rickroll sound file at 9:00am on April 1st in crontab — a way to schedule events on MacOS.
- Displays the files and folders in the home directory, including hidden files (because of the
-a
tag). This helps ensure that the sound file was downloaded correctly. - Prints the current crontab file (to ensure part #3 ran correctly).
- Clears the current copy + paste bin (so if the user of the computer uses CMD + V, they won't paste the incriminating command).
Undetectability Measures
It only takes about 10 seconds to run this command on someone's Mac, if you're a fast typist. What's great? You can run the command months in advance and it will still work, provided they don't change their crontab file or delete the sound file.
There are only a few ways that the target could detect your prank:
- They see you messing with their computer. (Somewhat unlikely: but you have to be sneaky for this prank!)
- They look in their search history and see
ntnbr.com/59
, a site they've never visited before, so they check it out and find out what happened. (Unlikely: who is that observant of their search history?) - They find the sound file downloaded on their computer. (Very unlikely: it's a hidden file located in the home directory, which means it's almost impossible to accidentally find with Finder. Also, if they find it, they may not even be suspicious of the somewhat innocent-sounding name.)
- They discover the crontab job you've set. (Quite unlikely: most people have no idea what crontab is.)
What's the best part? Once the rickroll is playing, 95% of people will have no idea how to stop it. (To their credit, it's hard: you have to run pkill afplay
in Terminal or go to Activity Monitor and quit any active afplay
processes.) Sure, your target could mute the master volume, but that's like admitting defeat to Rick Astley, because they can't even figure out how to turn it off normally.
Variations
You can just change the entries in the cronjob to whatever you want. For example, the command below rickrolls the affected computer every day at 12:30pm:
cd ~ && curl -o ~/.aerodynamic.mp3 https://raw.githubusercontent.com/snowywaffles/rickroll/main/aerodynamic.mp3 && echo "30 12 * * * afplay ~/.aerodynamic.mp3" | crontab - && ls -a && crontab -l && pbcopy < /dev/null
This next command is particularly evil, because it (randomly) runs once approximately every 10000 minutes. So if the target uses their affected computer for 300 minutes per day, it'll run about once a month — with no schedule, rhyme or reason.
cd ~ && curl -o ~/.aerodynamic.mp3 https://raw.githubusercontent.com/snowywaffles/rickroll/main/aerodynamic.mp3 && echo "* * * * * (( \$RANDOM \% 10000 == 0 )) && afplay ~/.aerodynamic.mp3" | crontab - && ls -a && crontab -l && pbcopy < /dev/null
Conclusion
If you're mischievous like I am, and like rickrolling people, this is the prank for you. Just make sure you don't go too ham — some people may really mistrust you if they find you've been tinkering with their computer.