Also close bug
[filters.git] / spammer
CommitLineData
bf033f2d 1#!/usr/bin/perl
2# Talk like a spammer. Copyright 2002 by Joey Hess <joeyh@debian.org>
3# Licensed under the GPL.
4#
5# Doesn't always generate proper engrish, but then neither do
6# spammers.
7
8sub c {
9 return $_[rand @_];
10}
11
12sub line_of_yelling {
13 my @lines=split(/\n/, shift);
14 my $n=rand @lines;
15 $lines[$n] = uc($lines[$n]);
16 return join("\n", @lines);
17}
18
19sub for_free {
20 return c(qw(100% completely totally absolutely))." ".c(qw(f F))."ree";
21}
22
23my $hits=0;
24
25if (rand > 0.75) {
26 $hits++;
27 $spam .= "Dear Friend, ";
28}
29elsif (rand > 0.9) {
30 $hits++;
31 $spam .= "Below is the result of your feedback form".c(qw{: . ..})."\n";
32}
33elsif (rand > 0.75) {
34 $hits++;
35 $spam .= "This message is not spam!\n";
36}
37
38while (<>) {
39 # Try to trigger spam trappers. Keep count of the number of unique
40 # ones triggered.
41 @results = (
42 s/^(Subject:\s+.*)/$1. ' ' x (rand(20) + 40) . rand(1000000)/eig,
43 s/free\b/for_free()/eig,
44 s/(email|message|e-mail|mail)\b/$1 (sent in compliance with regulations)/i,
45 s/(join|register|order|apply)/$1 today/ig,
46 s/money/big bucks/i,
47 s/check\b/check or money order/i,
48 s/(amazing|atonishing|neat|interesting)/AMAZING/ig,
49 s/guarantee\b/GUARANTEE/ig,
50 s/(profits|money)/PROFITS/ig,
51 s/(no questions asked|quiet|confidential|secret)\b/NO QUESTIONS ASKED/ig,
52 s/refund\b/full refund/i,
53 s/free\b/FREE/ig,
54 s/\b(full|complete|fully)\b/100% GUARANTEED/ig,
55 s/(spam|UCE)\b/c(qw(bulk direct mass))." email"/eig,
56 s/spammer/businessman/ig,
57 s/(call|phone|contact)\b/CALL NOW/ig,
58 s/business\b/online business/ig,
59 s/online\b/online business opportunities/ig,
60 s/number\b/social security number/ig,
61 s/addresses\b/addresses on cd/ig,
62 s/cdrom\b/addresses on cd/ig,
63 s/click\b/click here/ig,
64 s/viagra/c('VIAGRA', 'natural viagra', 'herbal viagra')/eig,
65 s/\btraffic\b/rand > 0.6 ? 'more web traffic' : 'traffic'/eig,
66 s/targeted/targeted traffic/ig,
67 s/limited/LIMITED TIME OFFER/ig,
68 s/buy\b/buy direct/ig,
69 s/profit\b/PURE PROFIT/ig,
70 s/opportunity/once in a lifetime opportunity/ig,
71 s/stock\b/STOCK PICK/ig,
72 s/access\b/INSTANT ACCESS/ig,
73 s/(diploma|credential)s?/college diploma$a/ig,
74 s/(penis|breast)/larger $1/ig,
75 s/\b(work|job)\b/home employment/ig,
76 s/experience\b/no experience needed!/ig,
77 s/printer\b/printer (toner cartridge)/ig,
78 s/(income|money|savings?)\b/you income/ig,
79 s/(amazing|amazed|atonished|interesting)/be amazed/ig,
80 s/(\$\d+\.?\d*)/for only $1!/ig,
81 s/natural/completly natural/ig,
82 s/obligation/no obligation/ig,
83 s/vacation\b/c(qw(dream special free))." vacation"/eig,
84 s/sign up\b/sign up today/ig,
85 s/cell (phone)?\b/free cell phone/ig,
86 s/(offer|trial|membership|website|quote|installation|sample|dvd|preview|leads)\b/free $1/ig,
87 s/\bvalue/outstanding value/ig,
88 s/shipping/shopping spree/ig,
89 s/winning/WINNING/ig,
90 s/winner\b/WINNER/ig,
91 s/promotion\b/special promotion/ig,
92 s/password\b/free password/ig,
93 s/\bcash\b/extra cash/ig,
94 s/cancel\b/cancel at any time/ig,
95 s/\bearn\b/earn up to/ig,
96 s/(movies|pics|photos|videos)/c(qw(hundreds thousands millions tons))." of $1"/eig,
97 s/\bporn\b/free porn/ig,
98 s/\blegal\b/c(qw(absolutely perfectly totall 100%))." legal"/eig,
99 s/(drugs|medications|pharmacy)/online $1/ig,
100 s/asset/hidden asset/ig,
101 s/\bsave\b/save thousands/ig,
102 s/partner/marketing partner/ig,
103 s/unlimited/UNLIMITED/ig,
104 s/\bprice\b/low price/ig,
105 s/galleries\b/huge galleries/ig,
106 # Convert phone numbers to 800 numbers.
107 s/(?:(?:1-)?[0-9]{3}-)?([0-9]{3}-[0-9]{4})/"1-".c(800,888)."-$1"/eg,
108 # de-http:// urls
109 s/http:\/\///ig,
110 );
111
112 # Merge result table into an overall results table that counts each
113 # item at most once.
114 for ($x=0; $x < $#results; $x++) {
115 if ($results[$x]) {
116 $overallresults[$x]=1;
117 }
118 }
119
120 # Cute things that don't cause real hits.
121 s/\.(com|org|net|edu)\b/".".c(qw(info biz name))/eig;
122 s/([Ee])nglish/${1}ngrish/g if rand > 0.66;
123 $spam .= $_;
124}
125
126$hits += $_ foreach @overallresults;
127
128if (rand > 0.5) {
129 # random line breaks make spam look
130 # more professional
131 # or is it just written in Notepad?
132 $spam =~ s/ /rand > 0.95 ? "\n" : " "/eg;
133}
134elsif (rand > 0.75) {
135 # I write my spam in MS WORD!
136 $spam =~ s/\n/ /g;
137}
138else {
139 $spam=line_of_yelling($spam);
140}
141
142if (rand > 0.8 || $hits < 5) {
143 $spam .= "\nThis is a ".c(qw(one 1))." time ".c(qw(email e-mail offer)).c(qw(! .));
144 $hits++;
145}
146
147if (rand > 0.7 || $hits < 5) {
148 $spam .= "\n" . c('-' x 78, '~' x 70, '---', '', '', '', "\n\n\n\n") . "\n" .
149 c('To remove your address from ', 'To be removed from', 'To get off from',
150 'To unsubscribe from', 'To receive no further notices on',
151 'If you did not opt in for', 'To be removed from future mailings to') .
152 " " .
153 c('this mailing list', 'these mails') . " " .
154 c('please ', '') .
155 c('reply', 'send an email', 'write back') . " " .
156 c('with a subject of', 'and put in the subject the word') . " " .
157 c("REMOVE", '"remove"') .
158 c(qw(! . .)) . "\n";
159 $hits++;
160}
161
162# Desperate to make it look like a spam now, I insert arbitrary
163# junk.
164while ($hits < 5) {
165 if (rand > 0.66) {
166 $spam=line_of_yelling($spam);
167 $hits++;
168 }
169 elsif (rand > 0.5) {
170 # Insert a spam phrase after the end of a sentence.
171 @spam_phrases = ('FREE CONSULATATION', 'INSTANT ACCESS',
172 'PURE PROFIT', 'STOCK PICK', 'VIAGRA', 'WINNER',
173 'WINNING', 'LIMITED TIME OFFER', 'extra cash',
174 'CALL NOW', 'once in a lifetime opportunity',
175 'cancel at any time', 'no experience needed',
176 'no obligation', 'save millions', 'be amazed',
177 for_free());
178 $hits += $spam =~ s/\.\s+([A-Z])/". ".ucfirst(c(@spam_phrases)). "! $1"/es;
179 }
180 elsif (rand > 0.75) {
181 # large hexadecimal block
182 my @hex = ('A'..'F', 0..9);
183 for (1..70 + rand(9)) {
184 $spam .= $hex[rand @hex];
185 }
186 $spam .= "\n";
187 $hits++;
188 }
189 elsif (rand > 0.75) {
190 $spam .= c("SSPLTM ", "{%RAND%} ");
191 $hits++;
192 }
193}
194
195$spam =~ s/\n/\r\n/g;
196print "$spam\n";
This page took 0.0214 seconds and 4 git commands to generate.