Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $sites = array('[redacted]');
- shuffle($sites);
- $api_key = '[redacted]';
- function PostToHost($data) {
- $fp = fsockopen("www.stopforumspam.com",80);
- fputs($fp, "POST /add.php HTTP/1.1\n" );
- fputs($fp, "Host: www.stopforumspam.com\n" );
- fputs($fp, "Content-type: application/x-www-form-urlencoded\n" );
- fputs($fp, "Content-length: ".strlen($data)."\n" );
- fputs($fp, "Connection: close\n\n" );
- fputs($fp, $data);
- fclose($fp);
- }
- function curl_get($url, $refuseblank = false) {
- $ch = curl_init ();
- curl_setopt ( $ch, CURLOPT_URL, $url);
- curl_setopt ( $ch, CURLOPT_FOLLOWLOCATION, 1 );
- curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
- curl_setopt ( $ch, CURLOPT_ENCODING, "" );
- curl_setopt ( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)" );
- if (defined('SERVER_LOGIN')) { //my test server requires a login
- curl_setopt($ch, CURLOPT_USERPWD, SERVER_LOGIN);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- }
- $out = '';
- if ($refuseblank) {
- while ($out == '') {
- $out = curl_exec ($ch);
- }
- } else {
- $out = curl_exec($ch);
- }
- curl_close($ch);
- return $out;
- }
- $spamurls = array();
- $i = 0;
- $spamcounts = array();
- foreach ($sites as $url) {
- $spamcounts[$url] = array();
- $sitecount = 0;
- $continue = true;
- echo 'Trying site ' . $url . "\n";
- //get number of registered users
- $site = curl_get($url);
- while ($continue) {
- $data = curl_get($url . '/spam.php?salt=' . time());
- if (!strstr($data, '<?xml')) {
- echo 'Site could not be harvested. Check that it is working properly.' . "\n";
- $continue = false;
- break;
- }
- $xml = new SimpleXMLElement($data);
- if (!isset($xml->user)) {
- $continue = false;
- break;
- }
- foreach ($xml->user as $user) {
- $username = (string)$user->username;
- $email = (string)$user->email;
- $ip = (string)$user->ip;
- $evidence = (string)$user->evidence;
- $resp = posttohost('username=' . rawurlencode($username) . '&ip_addr=' . rawurlencode($ip) . '&evidence=' . rawurlencode($evidence) . '&email=' . rawurlencode($email) . '&api_key=' . $api_key);
- $i++;
- $sitecount++;
- if ($sitecount % 10 == 0) {
- echo ' -> ' . $sitecount . ' entries...' . "\n";
- }
- //any URLs?
- $lines = explode("\n", $evidence);
- foreach ($lines as $line) {
- if (strpos($line, 'http') === 0) {
- $spamurls[] = $line;
- }
- if (strpos($line, 'Registered: ') === 0) {
- preg_match('%(\d+) (.*?) (\d+)%', $line, $matches);
- $timestamp = $matches[0];
- if (isset($spamcounts[$url][$timestamp])) {
- $spamcounts[$url][$timestamp]++;
- } else {
- $spamcounts[$url][$timestamp] = 1;
- }
- }
- }
- }
- }
- if (isset($spamcounts[$url])) {
- $data = file_get_contents('stats.txt');
- foreach ($spamcounts[$url] as $timestamp => $count) {
- $data .= $url . ',' . $timestamp . ',' . $count . "\n";
- }
- file_put_contents('stats.txt', $data);
- }
- echo ' -> ' . $sitecount . ' entries for that site' . "\n";
- }
- echo $i . ' entries processed.' . "\n";
- //record any new spam urls
- $existingspamurls = explode("\n", file_get_contents('spamurls.txt'));
- $spamurls = array_unique(array_merge($existingspamurls, $spamurls));
- file_put_contents('spamurls.txt', implode("\n", $spamurls));
- unset($spamurls, $existingspamurls);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement