Extension:Mails

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear action run.svg
Mails
Release status: stable
Mails.png
Implementation Special page
Description To create a random sheet of mails for spambots
Author(s) Hidalgo Rionda (Hsilamottalk)
Latest version 1.1.84 (2007-12-03)
MediaWiki 1.10.0
License No license specified
Download From Author's Site
Example here
Parameters

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

$wgMailsTld
Translate the Mails extension if it is available at translatewiki.net
Check usage and version matrix.

What can this extension do?[edit]

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

Usage[edit]

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

Installation[edit]

Just unzip the content and add

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

To your LocalSettings.php.

Parameters[edit]

$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

Changes to LocalSettings.php[edit]

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

Code[edit]

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 mandar 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" ) );
	}
}
?>

See also[edit]

Also in Links Version

Other languages: English  • español