3 # l33t - auto l33t converter. Perl, Unix.
5 # This program converts text to l33t-speak. This is helpful to convert text
6 # that has been written in a formal and confusing manner, into text that
11 # USAGE: l33t [-abnuv] textfile
14 # l33t -b # basic-l33t
15 # l33t -n # normal-l33t (default)
16 # l33t -u # ultra-l33t
20 # man ls | l33t | more
24 # THANKS: Boyd Adamson
26 # COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
28 # This program is free software; you can redistribute it and/or
29 # modify it under the terms of the GNU General Public License
30 # as published by the Free Software Foundation; either version 2
31 # of the License, or (at your option) any later version.
33 # This program is distributed in the hope that it will be useful,
34 # but WITHOUT ANY WARRANTY; without even the implied warranty of
35 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 # GNU General Public License for more details.
38 # You should have received a copy of the GNU General Public License
39 # along with this program; if not, write to the Free Software Foundation,
40 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
42 # (http://www.gnu.org/copyleft/gpl.html)
44 # 16-Jun-2005 Brendan Gregg Created this.
50 # Command Line Arguments
52 &usage
() if $ARGV[0] eq "--help";
53 getopts
('abnuv') || &usage
();
55 $BASIC = 1 if $opt_b || $opt_a || $opt_u || $opt_n;
56 $NORMAL = 1 if $opt_n || $opt_a || $opt_u;
57 $ULTRA = 1 if $opt_u || $opt_a;
58 $VERBOSE = 1 if $opt_v || $opt_a;
59 if (($BASIC + $NORMAL + $ULTRA) == 0) {
63 @Superlatives = ("w00t!","haxx0r","l33t!","d00d");
79 # l33t - l33t the input variable.
80 # This function will write to the input variable,
84 $line = shift; # not my
88 basic_l33t
($line) if $BASIC;
89 normal_l33t
($line) if $NORMAL;
90 ultra_l33t
($line) if $ULTRA;
93 if ( int(rand(3)) == 0) {
94 $index = int(rand(@Superlatives));
95 $line .= " $Superlatives[$index]";
100 # basic_l33t - convert the argument string to basic l33t speak.
101 # this code is order dependant.
104 $line = shift; # not my
108 $line =~ s/\byou\b/int(rand(2))==0?"u":"you"/ieg;
109 $line =~ s/\bare\b/int(rand(2))==0?"r":"are"/ieg;
111 ### combo conversions
112 $line =~ s/s\b/int(rand(5))!=0?"z":"s"/eg;
113 $line =~ s/\bf/int(rand(2))==0?"ph":"f"/ieg;
115 foreach $char (split(//,$line)) {
117 ### character conversions
118 if ($char eq "a" && int(rand(4)) == 0) { $char = "4"; }
119 if ($char eq "e" && int(rand(3)) == 0) { $char = "3"; }
120 if ($char eq "l" && int(rand(3)) == 0) { $char = "1"; }
121 if ($char eq "o" && int(rand(3)) == 0) { $char = "0"; }
122 if ($char eq "s" && int(rand(4)) == 0) { $char = '5'; }
128 ### exclimation marks
129 if ($line !~ /^\s*$/) {
130 $line .= "!" x
int(rand(3));
134 # normal_l33t - convert the argument string to normal l33t speak.
135 # this code is order dependant.
138 $line = shift; # not my
142 $line =~ s/\broot\b/w00t/ig;
143 $line =~ s/\bfiles?\b/int(rand(2))==0?"warez":"files"/ieg;
145 ### combo conversions
146 $line =~ s/cks\b/int(rand(2))==0?"x":"cks"/eg;
147 $line =~ s/er\b/int(rand(2))==0?"or":"er"/eg;
149 foreach $char (split(//,$line)) {
152 ### character conversions
153 if ($char eq "a" && int(rand(4)) == 0) { $char = "@"; }
154 if ($char eq "s" && int(rand(4)) == 0) { $char = '$'; }
155 if ($char eq "s" && int(rand(6)) == 0) { $char = "z"; }
156 if ($char eq "t" && int(rand(4)) == 0) { $char = "7"; }
157 if (int(rand(3)) == 0) { $char = uc($char); }
163 ### exclimation marks
164 if ($line !~ /^\s*$/) {
166 $line .= "!" x
int(rand(3));
167 if (int(rand(6)) == 0) {
168 $line .= "!" x
int(rand(3));
169 $line .= "1" x
int(rand(3));
170 if (int(rand(8)) == 0) {
177 # ultra_l33t - convert the argument string to normal l33t speak.
178 # this code is order dependant.
181 $line = shift; # not my
185 $line =~ s/\broot\b/w00t/ig;
187 ### combo conversions
188 $line =~ s/\bf/int(rand(2))==0?"ph":"f"/eg;
190 foreach $char (split(//,$line)) {
193 ### character conversions
194 if ($char eq "b" && int(rand(4)) == 0) { $char = "8"; }
195 if ($char eq "c" && int(rand(6)) == 0) { $char = "("; }
196 if ($char eq "d" && int(rand(6)) == 0) { $char = "|)"; }
197 if ($char eq "h" && int(rand(8)) == 0) { $char = "|-|"; }
198 if ($char eq "i" && int(rand(4)) == 0) { $char = "1"; }
199 if ($char eq "k" && int(rand(6)) == 0) { $char = "|<"; }
200 if ($char eq "m" && int(rand(8)) == 0) { $char = "/\\/\\"; }
201 if ($char eq "n" && int(rand(8)) == 0) { $char = "|\\|"; }
202 if ($char eq "r" && int(rand(8)) == 0) { $char = "|2"; }
203 if ($char eq "v" && int(rand(8)) == 0) { $char = "\\/"; }
204 if ($char eq "w" && int(rand(8)) == 0) { $char = "\\/\\/"; }
205 if ($char eq "o" && int(rand(6)) == 0) { $char = "()"; }
206 if ($char eq "g" && int(rand(4)) == 0) { $char = "9"; }
207 if ($char eq "t" && int(rand(4)) == 0) { $char = "+"; }
208 if (int(rand(2)) == 0) { $char = uc($char); }
214 ### exclimation marks
215 if ($line !~ /^\s*$/) {
216 $line .= "!" x
int(rand(3));
220 # usage - print a usage and exit.
223 print "USAGE: l33t [-abnuv] [filename]\n";
225 print " l33t /etc/release\n";
226 print " date | l33t\n\n";
227 print " l33t -a # all\n";
228 print " l33t -b # basic-l33t\n";
229 print " l33t -n # normal-l33t (default)\n";
230 print " l33t -u # ultra-l33t\n";
231 print " l33t -v # verbose\n";