Added the supa1337 filter for complete unreadability.

This commit is contained in:
Jeremy Fincher 2004-02-06 16:30:35 +00:00
parent a7c2f24a1d
commit ede140bcde

View File

@ -77,7 +77,8 @@ class Filter(callbacks.Privmsg):
return msg return msg
_filterCommands = ['jeffk', 'leet', 'rot13', 'hexlify', 'binary', 'lithp', _filterCommands = ['jeffk', 'leet', 'rot13', 'hexlify', 'binary', 'lithp',
'scramble', 'morse', 'reverse', 'colorize', 'squish'] 'scramble', 'morse', 'reverse', 'colorize', 'squish',
'supa1337']
def outfilter(self, irc, msg, args, channel): def outfilter(self, irc, msg, args, channel):
"""[<channel>] [<command>] """[<channel>] [<command>]
@ -186,12 +187,12 @@ class Filter(callbacks.Privmsg):
irc.reply(text) irc.reply(text)
_leettrans = string.maketrans('oOaAeElBTiIts', '004433187!1+5') _leettrans = string.maketrans('oOaAeElBTiIts', '004433187!1+5')
_leetres = ((re.compile(r'\b(?:(?:[yY][o0O][oO0uU])|u)\b'), 'j00'), _leetres = [(re.compile(r'\b(?:(?:[yY][o0O][oO0uU])|u)\b'), 'j00'),
(re.compile(r'fear'), 'ph33r'), (re.compile(r'fear'), 'ph33r'),
(re.compile(r'[aA][tT][eE]'), '8'), (re.compile(r'[aA][tT][eE]'), '8'),
(re.compile(r'[aA][tT]'), '@'), (re.compile(r'[aA][tT]'), '@'),
(re.compile(r'[sS]\b'), 'z'), (re.compile(r'[sS]\b'), 'z'),
(re.compile(r'x'), '><'),) (re.compile(r'x'), '><'),]
def leet(self, irc, msg, args): def leet(self, irc, msg, args):
"""<text> """<text>
@ -203,6 +204,23 @@ class Filter(callbacks.Privmsg):
s = s.translate(self._leettrans) s = s.translate(self._leettrans)
irc.reply(s) irc.reply(s)
_supaleetreplacers = [('xX', '><'), ('kK', '|<'), ('rR', '|2'),
('hH', '|-|'), ('L', '|_'), ('uU', '|_|'),
('O', '()'), ('nN', '|\\|'), ('mM', '/\\/\\'),
('G', '6'), ('Ss', '$'), ('i', ';'), ('aA', '/-\\'),
('eE', '3'), ('t', '+'), ('T', '7'), ('l', '1'),
('D', '|)'), ('B', '|3'), ('I', ']['), ('Vv', '\\/'),
('wW', '\\/\\/'), ('d', 'c|'), ('b', '|>'),
('c', '<'), ('h', '|n'),]
def supa1337(self, irc, msg, args):
s = privmsgs.getArgs(args)
for (r, sub) in self._leetres:
s = re.sub(r, sub, s)
for (letters, replacement) in self._supaleetreplacers:
for letter in letters:
s = s.replace(letter, replacement)
irc.reply(s)
_scrambleRe = re.compile(r'(?:\b|(?![a-zA-Z]))([a-zA-Z])([a-zA-Z]*)' _scrambleRe = re.compile(r'(?:\b|(?![a-zA-Z]))([a-zA-Z])([a-zA-Z]*)'
r'([a-zA-Z])(?:\b|(?![a-zA-Z]))') r'([a-zA-Z])(?:\b|(?![a-zA-Z]))')
def scramble(self, irc, msg, args): def scramble(self, irc, msg, args):