Extension:Mails

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
Mails

Release status: stable

Implementation Special page
Description To create a random sheet of mails for spambots
Author(s) Hidalgo Rionda (Hsilamot Talk)
Version 1.1.84 (03 Dec 2007)
MediaWiki 1.10.0
Download From Author's Site
Parameters $wgMailsTotal

$wgMailsURand $wgMailsURandMin $wgMailsURandMax $wgMailsDRand $wgMailsDRandMin $wgMailsDRandMax $wgMailsTldRand $wgMailsTlds $wgMailsTld

Example here

[edit] What can this extension do?

Create a random sheet of mails for Spam bots with personalizable settings, very personalizable

[edit] Usage

Just link as any other page [[Special:Mails]]

[edit] Installation

Just unzip the content and add

require_once( "{$IP}/extensions/Mails/Mails.php" );

To your LocalSettings.php.

[edit] Parameters

$wgMailsTotal = 1024;

Total Mail addresses to generate

$wgMailsURand = true;

Number of Chars in mail address are random?

$wgMailsURandMin = 5;

if $wgMailsURand is true then this is the minimum chars in the Mail Address

$wgMailsURandMax = 12;

If $wgMailsURand is true then this is the maximum chars in the Mail Address, if false then this is the exact number of chars

$wgMailsDRand = true;

Number of Chars in mail domain address are random?

$wgMailsDRandMin = 5;

if $wgMailsDRand is true then this is the minimum chars in the Mail Domain Address

$wgMailsDRandMax = 12;

If $wgMailsDRand is true then this is the maximum chars in the Mail Domain Address, if false then this is the exact number of chars

$wgMailsTldRand = true;

Should the TLD be random ?

$wgMailsTlds = array("com", "net", "org", "us", "co.uk", "com.mx", "org.mx",);

If $wgMailsTldRand is true this is the list that will be used to select from the TLD's

$wgMailsTld = "com";

if $wgMailsTldRand is false this is the tld used in the Mails

[edit] Changes to LocalSettings.php

require_once( "{$IP}/extensions/Mails/Mails.php" );

[edit] Code

In Mails Folder are three files

Mails.php

<?php
if (!defined('MEDIAWIKI')) die();
# Not a valid entry point, skip unless MEDIAWIKI is defined
/**
 * Add random Mails to bother SPAM Bots who look for Html in mails
 */
 
$wgExtensionCredits['specialpage'][] = array(
        'name' => 'Mails 1.1.84',
        'author' => 'Hidalgo Rionda',
        'url' => 'http://www.mediawiki.org/wiki/Extension:Mails',
        'description' => 'Simple random Mails Generator, Those mails are for Spam bots.',
);
 
$wgAutoloadClasses['Mails'] = dirname(__FILE__) . '/Mails_body.php';
$wgSpecialPages['Mails'] = 'Mails';
$wgExtensionFunctions[] = 'efLoadeaMails';
 
 
function efLoadeaMails() {
        global $wgLang, $wgMessageCache;
        $f= dirname( __FILE__ ) . '/Mails.i18n.php';
        include( $f );
        foreach( efMails() as $lang => $messagess ) {
                $wgMessageCache->addMessages( $messagess , $lang );
        }
}
?>

Mails.i18n.php

<?php
if (!defined('MEDIAWIKI')) die();
function efMails() {
        $messages = array(
                'en' => array(
                        'mails' => 'Mails',
                        'mails-welcome' => 'Welcome, next i will generate a lot of random mails for those bots who look for Spam, remember: the mails does not exist, are Random.',
                        'mails-startnow' => 'Mailing list',
                        'mails-goodbye' => 'Hope you enjoy',
                        'mails-title' => 'Mailing List',
                ),
                'es' => array(
                        'mails' => 'Correos',
                        'mails-welcome' => 'Bienvenido, voy a generar un montón de correos al azar, son para bots que buscan correos para andar spam, no existen ¿ok?.',
                        'mails-startnow' => 'Lista de correo',
                        'mails-goodbye' => 'Espero disfrutes',
                        'mails-title' => 'Lista de Correo',
                ),
        );
        return $messages;
}
?>

Mails_body.php

<?php
if (!defined('MEDIAWIKI')) die();
class Mails extends SpecialPage {
        function __construct() {
                SpecialPage::SpecialPage("Mails", '', true);
        }
        function execute( $par ) {
                global $wgRequest, $wgOut, $wgMailsTotal, $wgMailsURand, $wgMailsURandMin, $wgMailsURandMax, $wgMailsDRand, $wgMailsDRandMin, $wgMailsDRandMax, $wgMailsTldRand, $wgMailsTlds, $wgMailsTld;
                if (!$wgMailsTotal) { $wgMailsTotal = 1024; }
                if (!$wgMailsURand) { $wgMailsURand = true; }
                if (!$wgMailsURandMin) { $wgMailsURandMin = 5; }
                if (!$wgMailsURandMax) { $wgMailsURandMax = 12; }
                if (!$wgMailsDRand) { $wgMailsDRand = true; }
                if (!$wgMailsDRandMin) { $wgMailsDRandMin = 5; }
                if (!$wgMailsDRandMax) { $wgMailsDRandMax = 12; }
                if (!$wgMailsTldRand) { $wgMailsTldRand = true; }
                if (!$wgMailsTlds) { $wgMailsTlds = array("com", "net", "org", "us", "co.uk", "com.mx", "org.mx",); }
                if (!$wgMailsTld) { $wgMailsTld = "com"; }
                $fname = "SpecialMails::execute";
                $this->setHeaders();
                # Do stuff
                $wgOut->addWikiText( wfMsg( 'Mails-welcome' ) );
                $wgOut->addHTML( wfMsg( 'Mails-startnow' ) );
                $Actual = 0;
                while ($Actual < $wgMailsTotal) {
                        $mailg = "";
                        if ($wgMailsURand == true) {
                                $Hechos = 0;
                                $PorHacer = rand($wgMailsURandMin,$wgMailsURandMax);
                                while ($Hechos < $PorHacer) {
                                        $mailg .= chr(rand(97,122));
                                        $Hechos = $Hechos + 1;
                                }
                        }
                        else {
                                $Hechos = 0;
                                while ($Hechos < $wgMailsURandMax) {
                                        $mailg .= chr(rand(97,122));
                                        $Hechos = $Hechos + 1;
                                }
                        }
                        $mailg .= "@";
                        if ($wgMailsDRand == true) {
                                $Hechos = 0;
                                $PorHacer = rand($wgMailsDRandMin,$wgMailsDRandMax);
                                while ($Hechos < $PorHacer) {
                                        $mailg .= chr(rand(97,122));
                                        $Hechos = $Hechos + 1;
                                }
                        }
                        else {
                                $Hechos = 0;
                                while ($Hechos < $wgMailsDRandMax) {
                                        $mailg .= chr(rand(97,122));
                                        $Hechos = $Hechos + 1;
                                }
                        }
                        if ($wgMailsTldRand == true) {
                                $Totales = 0;
                                foreach( $wgMailsTlds as $currenteado ) {
                                        $Totales = $Totales + 1;
                                        $TLDA[$Totales] = $currenteado;
                                }
                                $mailg .= ".".$TLDA[rand(1,$Totales)];
                        }
                        else {
                                $mailg .= ".".$wgMailsTld;
                        }
                        $wgOut->addHTML(", <a href=\"mailto:".$mailg."\">".$mailg."</a>");
                        $Actual = $Actual + 1;
                }
                $wgOut->addWikiText( wfMsg( 'Mails-goodbye' ) );
                # Output
                $wgOut->setPagetitle( wfMsg( "Mails-title" ) );
        }
}
?>

[edit] See also

Also in Links Version

Personal tools