-
-
Save rlafranchi/0b488a9b2d7fb615688a29c0e76591d3 to your computer and use it in GitHub Desktop.
Mr. Robot Season 2 easter egg website email alert cronjob
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
<?php | |
ini_set('max_execution_time', 300); | |
/** | |
* Mr. Robot Season 2 easter egg website email alert cronjob | |
* (Note: requires your PHP to be able to send emails (of course)!) | |
* | |
* 1. Download this script. Browser download: https://gist.github.com/eyecatchup/f5f5929f57b22fc1b37ef516d675ac92/download/ | |
* Or, for the console users: | |
* # wget --no-check-certificate https://gist.github.com/eyecatchup/f5f5929f57b22fc1b37ef516d675ac92/raw/watchRobot.cron.php | |
* | |
* 2. Set the value for the variable $notifyEmailAddress to your email address. | |
* | |
* 3. Create a new cronjob (for a Windows Xampp stack alternative see: http://stackoverflow.com/a/4231634/624466). | |
* On your console, type: | |
* # crontab -e | |
* | |
* 4. Paste the following (adjust script/logfile path): | |
* 0 * * * * php /absolute/path/to/script.php >> /absolute/path/to/cronjob.log | |
* | |
* Exit crontab and you're all set. You'll get an email as soon as there's a new Mr. Robot EE site to checkout. | |
*/ | |
/** | |
* CHANGE THIS TO YOUR EMAIL ADDRESS !!! | |
*/ | |
$notifyEmailAddress = '[email protected]'; | |
/** | |
* NO NEED FOR CHANGES BELOW | |
*/ | |
$base = '192.251.68.'; | |
$bits = range(241, 248); | |
array_push($bits, 252); | |
function getHttpResponse($url) { | |
$ch = curl_init($url); | |
curl_setopt_array($ch, array( | |
CURLOPT_RETURNTRANSFER => 1, | |
CURLOPT_CONNECTTIMEOUT => 30, | |
CURLOPT_FOLLOWLOCATION => 1, | |
CURLOPT_MAXREDIRS => 3, | |
CURLOPT_SSL_VERIFYPEER => 0, | |
)); | |
$response = curl_exec($ch); | |
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); | |
curl_close($ch); | |
return 200 == (int)$httpCode ? $response : false; | |
} | |
foreach ($bits as $bit) { | |
$addr = $base . $bit; | |
$resp = getHttpResponse($addr); | |
if ($resp && trim($resp) !== sprintf('i%d.bxjyb2jvda.net', $bit)) { | |
$msg = 'Strike! A new Mr. Robot easter egg site is online: ' . $addr; | |
mail($notifyEmailAddress, 'Mr. Robot Easter Egg Website Alert', $msg); | |
echo $msg . PHP_EOL; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment