Skip to content

Instantly share code, notes, and snippets.

Created February 12, 2015 17:56
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 anonymous/3a9dbd180bde3ce4735f to your computer and use it in GitHub Desktop.
Save anonymous/3a9dbd180bde3ce4735f to your computer and use it in GitHub Desktop.
<?php
set_time_limit(0);
$mangoes = array();
do_log_blockchain();
function do_log_blockchain(){
global $mangoes;
$path = getcwd(). "/mango_blockchain.txt";
if(!file_exists($path)){
file_put_contents($path, "");
}
$mangoes = file($path);
$mangoes = array_map("strtolower", $mangoes);
$mangoes = array_unique($mangoes);
sort($mangoes, SORT_STRING);
while(1) {
printf("Parsing data... \n");
// match user + balance /Sync\\:\s(.*?)\samount\s(\d+(.|,))+(\d)/
// Sync\\:\s(.*?)[+-]?((\d+(\.\d*)?)|(\.\d+))\sMCZ/
preg_match_all("/Sync\\:\s(.*?)[+-]?((\d+(\.\d*)?)|(\.\d+))\sMCZ/", strip_tags(file_get_contents('http://www.mangocoinz.com/blockchain')), $users);
foreach ($users[0] as $usr) {
if(!in_array($usr, $mangoes)){
printf("[!] %s\n", $usr);
write_out($usr, "mango_blockchain.txt");
array_push($mangoes, print_r($usr, true));
}
}
//print_r(array_unique($mangoes));
$mangoes = array_unique($mangoes);
printf("currently %s users\n", sizeof($mangoes));
foreach ($mangoes as $usr) {
//send_coins($usr);
}
sleep(60);
}
}
function write_out($str, $path){
$lin = file($path);
$lin = array_map("strtolower", $lin);
$lin = array_unique($lin);
sort($lin, SORT_STRING);
$mangoes = $lin;
file_put_contents($path, implode('', $lin));
if($h = fopen($path, 'a')){
fwrite($h, "$str\n");
}
fclose($h);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment