From a988e7f06c9bb18ce8d2bfe025c76bdfdb14e744 Mon Sep 17 00:00:00 2001 From: acidvegas Date: Mon, 19 Jun 2023 12:54:20 -0400 Subject: [PATCH] confuse.py added (props to wrk) --- scripts/python/confuse.py | 112 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 scripts/python/confuse.py diff --git a/scripts/python/confuse.py b/scripts/python/confuse.py new file mode 100644 index 0000000..6781eec --- /dev/null +++ b/scripts/python/confuse.py @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +# confusables - developed by acidvegas in python (https://git.acid.vegas/random) +# adapted as a weechat script by wrk + +''' +This script contains a dictionary of keyboard typable characters unicode variants that are very similar. +Other possible variants exist, for now we are only matching the ones that do not "look" like unicode. +This can be used to evade spam filtering by replacing characters with their similar unicode variants. + +Todo: + - Convert unicode characters into raw codepoints in the dictionary (Example: \u202e) + - Add variants for missing typable characters (iIl) + - Extend to more variants than already in the database + - Set different odds on character replacement for chance feature on the confuse function +''' + +import weechat +import random + +def confuse(data, chance=False): + '''chance set to True will give each replacable character a 50% chance of being replaced''' + confused = str() + for char in data: + if char in confusable and (not chance or random.choice((True,False))): + confused += random.choice(list(confusable[char])) + else: + confused += char + return confused + +confusable = { + ' ':'       ', + '.':'܂․.⡀', + '!':'ǃⵑ!', + '$':'$', + '%':'%', + '&':'ꝸ&', + ':':'ː˸։׃⁚∶ꓽ꞉︰:', + ';':';;', + '<':'ᐸ<', + '=':'⹀꓿=', + '>':'ᐳ>', + '?':'?', + '@':'@', + '0':'߀𝛰〇𐊒𝟬𝜪Oዐ𝞞𝝤ⵔՕ𝟢𝗢𝘖ⲞОΟଠ𝟎𝐎০୦O𐊫𝙾ꓳ𐐄𝟶𝑶𝚶𐓂௦౦೦ഠဝ၀ჿᴏᴑⲟ0o𐐬𐓪', + '1':'𝚕𝟏𝟙𝟣𝟭𝟷', + '2':'Ƨᒿ2𝟐𝟤𝟮𝟸', + '3':'ƷȜЗӠⳌꝪꞫ3', + '4':'Ꮞ𝟒𝟜𝟦𝟰𝟺', + '5':'Ƽ5', + '6':'бᏮⳒ6', + '7':'7𐓒', + '8':'8𐌚𝟖𝟠𝟪𝟴', + '9':'৭୨ⳊꝮ9', + 'A':'ΑАᎪᗅᴀꓮꭺA𐊠', + 'B':'ΒВᏴᗷꓐB𐊂𐊡𝐁𝐵𝑩𝔹𝖡𝗕𝘉𝘽𝚩𝜝𝝗𝞑', + 'C':'СᏟᑕℂⅭ⊂ⲤꓚC𐊢𐐕', + 'D':'ᎠᗞᗪⅮꓓꭰD𝐃𝐷𝑫𝔻𝖣𝗗𝘋𝘿𝙳', + 'E':'ΕЕᎬ⋿ⴹꓰꭼE𐊆', + 'F':'ϜᖴꓝꞘF𐊇𐊥𝟋', + 'G':'ɢԌᏀᏳᏻꓖꮐG𝐆𝐺𝑮𝔾𝖦𝗚𝘎𝙂𝙶', + 'H':'ʜΗНнᎻᕼⲎꓧH𐋏𝐇𝐻𝑯𝖧𝗛𝘏𝙃𝚮𝛨𝜢𝝜𝞖', + 'J':'ͿЈᎫᒍᴊꓙꞲꭻJ𝐉𝐽𝑱𝕁𝖩𝗝𝙹', + 'K':'ΚКᏦᛕKⲔꓗK', + 'L':'ʟᏞᒪⅬⳐⳑꓡꮮL𐐛𐑃', + 'M':'ΜϺМᎷᗰᛖⅯⲘꓟM𐊰𐌑𝐌𝑀𝑴𝕄𝖬𝗠𝘔𝙈𝙼𝚳𝛭𝜧𝝡𝞛', + 'N':'ɴΝⲚꓠN', + 'O':'OΟОՕ௦౦೦ഠဝ၀ჿዐᴏᴑⲞⲟⵔ〇ꓳ0Oo𐊒𐊫𐐄𐐬𐓂𐓪', + 'P':'ΡРᏢᑭᴘᴩℙⲢꓑꮲP𐊕𝐏𝑃𝑷𝖯𝗣𝘗𝙋𝙿𝚸𝛲𝜬𝝦𝞠', + 'Q':'ℚⵕQ𝐐𝑄𝑸𝖰𝗤𝘘𝙌𝚀', + 'R':'ƦʀᎡᏒᖇᚱꓣꭱꮢR𐒴', + 'S':'ЅՏᏕᏚꓢS𐊖𐐠', + 'T':'ΤТтᎢᴛ⊤⟙ⲦꓔꭲT𐊗𐊱𐌕', + 'U':'Սሀᑌ∪⋃ꓴU𐓎', + 'V':'Ѵ٧۷ᏙᐯⅤⴸꓦꛟV', + 'W':'ԜᎳᏔꓪW', + 'X':'ΧХ᙭ᚷⅩ╳ⲬⵝꓫꞳX𐊐𐊴𐌗𐌢', + 'Y':'ΥϒУҮᎩᎽⲨꓬY𐊲', + 'Z':'ΖᏃꓜZ𐋵', + 'a':'ɑαа⍺a𝐚𝑎𝒂𝕒𝖆𝖺𝗮𝘢𝙖𝚊𝛂𝛼𝜶𝝰𝞪', + 'b':'ƄЬᏏᑲᖯb𝐛𝑏𝒃𝖇𝖻𝗯𝘣𝙗𝚋', + 'c':'ϲсᴄⅽⲥꮯc𐐽𝐜𝑐𝒄𝕔𝖈𝖼𝗰𝘤𝙘𝚌', + 'd':'ԁᏧᑯⅆⅾꓒd𝐝𝑑𝒅𝒹𝓭𝖽𝗱𝘥𝙙𝚍', + 'e':'еҽ℮e𝐞𝕖𝖾𝗲𝚎', + 'f':'ẝꞙꬵf', + 'g':'ƍɡցᶃg𝐠𝑔𝒈𝕘𝖌𝗀𝗴𝘨𝙜𝚐', + 'h':'һᏂℎh𝒉𝕙𝗁𝗵𝘩𝙝𝚑', + 'j':'ϳјj𝐣𝚓', + 'k':'k𝐤𝑘𝒌𝕜𝖐𝗄𝗸𝘬𝙠𝚔', + 'm':'m𝕞𝙢𝗺ⅿ', + 'n':'ոռn𝗇𝗻𝘯𝙣𝚗', + 'o':'OΟОՕ௦౦೦ഠဝ၀ჿዐᴏᴑⲞⲟⵔ〇ꓳ0Oo𐊒𐊫𐐄𐐬𐓂𐓪', + 'p':'ρϱр⍴ⲣp𝑝𝕡𝗉𝗽𝘱𝙥𝚙𝛒𝜌𝝆𝞀𝞺', + 'q':'ԛq𝐪𝕢𝗊𝗾𝘲𝙦𝚚', + 'r':'гᴦⲅꭈꮁr𝐫𝗋𝗿𝚛', + 's':'ѕꜱꮪs𐑈', + 't':'t𝘁𝚝', + 'u':'ʋυսᴜꭒu𐓶', + 'v':'νѵᴠⅴ∨⋁ꮩv', + 'w':'ɯѡԝաᴡꮃw', + 'x':'×хⅹ⤫⤬⨯x𝐱𝑥𝒙𝔵𝕩𝖝𝗑𝘅𝘹𝙭𝚡', + 'y':'ɣγуүყỿꭚy', + 'z':'ᴢꮓz𝙯ᴢ𝗓𝕫ꮓ𝚣𝒛' +} + + +def cmd_confuse(data, buf, msg): + weechat.command(buf, f'/input send {confuse(msg)}') + + return weechat.WEECHAT_RC_OK + +if weechat.register('confuse', 'acidvegas & wrk', '1.0', 'ISC', 'confuse mfers', '', ''): + weechat.hook_command('confuse', 'confuse text', '', '', '', 'cmd_confuse', '') \ No newline at end of file