Skip to content

Instantly share code, notes, and snippets.

@MegaApuTurkUltra
Created February 21, 2016 20:37
Show Gist options
  • Save MegaApuTurkUltra/73c337d47908abeebb0e to your computer and use it in GitHub Desktop.
Save MegaApuTurkUltra/73c337d47908abeebb0e to your computer and use it in GitHub Desktop.
How 2 git interwebz
<?php
$verbose = fopen('php://temp', 'w+');
function curl_boilerplate($curl) {
global $verbose;
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0");
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_COOKIEJAR, realpath("internetometer.cookies"));
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
curl_setopt($curl, CURLOPT_STDERR, $verbose);
curl_setopt($curl, CURLOPT_FORBID_REUSE, 1);
}
function curl_run($curl) {
global $verbose;
$res = curl_exec($curl);
rewind($verbose);
$contents = stream_get_contents($verbose);
echo $contents . "\n";
echo $contents;
rewind($verbose);
$header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
$header = substr($res, 0, $header_size);
$body = substr($res, $header_size);
var_dump($header, $body);
echo $header;
echo $body;
return $res;
}
$proxies = array(); // get some proxies here
$curl = curl_init();
for ($i = 0; $i < sizeof($proxies); $i++) {
echo "Running $i\n";
curl_boilerplate($curl);
curl_setopt($curl, CURLOPT_URL, "http://internetometer.com/give/MY_ID?rnd=" . mt_rand());
curl_setopt($curl, CURLOPT_PROXY, $proxies[$i]['ip'] . ":" . $proxies[$i]['port']);
if (strpos($proxies[$i]['type'], "socks") !== FALSE) {
curl_setopt($curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
} else {
curl_setopt($curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
}
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
curl_setopt($curl, CURLOPT_POST, 0);
$res = curl_run($curl);
if (strpos($res, "already given internets") !== FALSE) {
echo "Already given internets";
continue;
}
preg_match_all('|<input type=\'hidden\' name=\'key\' value=\'(.*)\'|U', $res, $matches);
if (sizeof($matches) < 2 || sizeof($matches[1]) < 1) {
echo "Can't find key field";
continue;
}
$key = $matches[1][0];
var_dump($key);
curl_boilerplate($curl);
curl_setopt($curl, CURLOPT_URL, "http://internetometer.com/give/MY_ID?rnd=" . mt_rand());
curl_setopt($curl, CURLOPT_PROXY, $proxies[$i]['ip'] . ":" . $proxies[$i]['port']);
if (strpos($proxies[$i]['type'], "socks") !== FALSE) {
curl_setopt($curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
} else {
curl_setopt($curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
}
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query(array(
"key" => $key
)));
$res = curl_run($curl);
echo "Success";
preg_match("/([0-9]+) internets/i", $res, $internets);
echo "You now have: " . $internets[1];
}
curl_close($curl);
echo "Exiting";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment