weechat

- me personal weechat setup đŸ”ĩđŸŸĸ
git clone git://git.acid.vegas/weechat.git
Log | Files | Refs | Archive | README

confuse.py (5079B)

      1 # -*- coding: utf-8 -*-
      2 # confusables - developed by acidvegas in python (https://git.acid.vegas/random)
      3 # adapted as a weechat script by wrk
      4 
      5 '''
      6 This script contains a dictionary of keyboard typable characters unicode variants that are very similar.
      7 Other possible variants exist, for now we are only matching the ones that do not "look" like unicode.
      8 This can be used to evade spam filtering by replacing characters with their similar unicode variants.
      9 
     10 Todo:
     11         - Convert unicode characters into raw codepoints in the dictionary (Example: \u202e)
     12         - Add variants for missing typable characters (iIl)
     13         - Extend to more variants than already in the database
     14         - Set different odds on character replacement for chance feature on the confuse function
     15 '''
     16 
     17 import weechat
     18 import random
     19 
     20 def confuse(data, chance=False):
     21         '''chance set to True will give each replacable character a 50% chance of being replaced'''
     22         confused = str()
     23         for char in data:
     24                 if char in confusable and (not chance or random.choice((True,False))):
     25                         confused += random.choice(list(confusable[char]))
     26                 else:
     27                         confused += char
     28         return confused
     29 
     30 confusable = {
     31         ' ':'       ',
     32         '.':'܂․īŧŽâĄ€',
     33         '!':'Įƒâĩ‘īŧ',
     34         '$':'īŧ„',
     35         '%':'īŧ…',
     36         '&':'ꝸīŧ†',
     37         ':':'ː˸։׃⁚âˆļę“Ŋ꞉ī¸°īŧš',
     38         ';':'Ížīŧ›',
     39         '<':'ᐸīŧœ',
     40         '=':'⹀ę“ŋīŧ',
     41         '>':'áŗīŧž',
     42         '?':'īŧŸ',
     43         '@':'īŧ ',
     44         '0':'ß€đ›°ã€‡đŠ’đŸŦđœĒOዐ𝞞𝝤âĩ”Õ•đŸĸđ—ĸ𝘖ⲞОΟāŦ đŸŽđŽā§Ļā­Ļīŧ¯đŠĢ𝙾ę“ŗ𐐄đŸļđ‘ļđšļ𐓂ā¯ĻāąĻāŗĻā´ á€á€áƒŋᴏᴑⲟīŧīŊđŦđ“Ē',
     45         '1':'𝚕𝟏𝟙đŸŖ𝟭𝟷',
     46         '2':'Ƨá’ŋīŧ’đŸđŸ¤đŸŽđŸ¸',
     47         '3':'ÆˇČœĐ—Ķ âŗŒęĒęžĢīŧ“',
     48         '4':'Ꮞ𝟒𝟜đŸĻ𝟰đŸē',
     49         '5':'Æŧīŧ•',
     50         '6':'бᏮâŗ’īŧ–',
     51         '7':'īŧ—𐓒',
     52         '8':'īŧ˜đŒšđŸ–đŸ đŸĒ𝟴',
     53         '9':'ā§­ā­¨âŗŠęŽīŧ™',
     54         'A':'ΑАáŽĒᗅᴀꓮę­ēīŧĄđŠ ',
     55         'B':'ΒВᏴᗷꓐīŧĸ𐊂𐊡𝐁đĩ𝑩𝔹𝖡𝗕𝘉đ˜Ŋ𝚩𝜝𝝗𝞑',
     56         'C':'СᏟᑕℂⅭ⊂ⲤꓚīŧŖđŠĸ𐐕',
     57         'D':'Ꭰᗞá—ĒⅮꓓꭰīŧ¤đƒđˇđ‘Ģđ”ģđ–Ŗ𝗗𝘋đ˜ŋđ™ŗ',
     58         'E':'ΕЕáŽŦâ‹ŋⴹꓰę­ŧīŧĨ𐊆',
     59         'F':'Īœá–´ę“ęž˜īŧĻ𐊇đŠĨ𝟋',
     60         'G':'ÉĸԌᏀáŗáģꓖꮐīŧ§đ†đē𝑮𝔾đ–Ļ𝗚𝘎𝙂đ™ļ',
     61         'H':'ʜΗНĐŊáŽģá•ŧⲎꓧīŧ¨đ‹đ‡đģđ‘¯đ–§đ—›đ˜đ™ƒđšŽđ›¨đœĸ𝝜𝞖',
     62         'J':'ÍŋЈáŽĢᒍᴊꓙꞲę­ģīŧĒ𝐉đŊ𝑱𝕁𝖩𝗝𝙹',
     63         'K':'ΚКáĻᛕâ„ĒⲔꓗīŧĢ',
     64         'L':'ʟᏞá’Ēâ…Ŧâŗâŗ‘ꓥꎎīŧŦ𐐛𐑃',
     65         'M':'ΜĪēĐœáŽˇá—°á›–â…¯â˛˜ę“Ÿīŧ­đŠ°đŒ‘đŒđ‘€đ‘´đ•„đ–Ŧ𝗠𝘔𝙈đ™ŧđšŗ𝛭𝜧𝝡𝞛',
     66         'N':'ɴΝⲚꓠīŧŽ',
     67         'O':'OÎŸĐžÕ•ā¯ĻāąĻāŗĻā´ á€á€áƒŋዐᴏᴑⲞⲟâĩ”〇ę“ŗīŧīŧ¯īŊđŠ’đŠĢ𐐄đŦ𐓂đ“Ē',
     68         'P':'ÎĄĐ áĸᑭᴘᴩℙâ˛ĸꓑꮲīŧ°đŠ•đđ‘ƒđ‘ˇđ–¯đ—Ŗ𝘗𝙋đ™ŋ𝚸𝛲đœŦđĻ𝞠',
     69         'Q':'ℚâĩ•īŧąđđ‘„đ‘¸đ–°đ—¤đ˜˜đ™Œđš€',
     70         'R':'ÆĻʀᎡᏒᖇᚱę“Ŗę­ąęŽĸīŧ˛đ’´',
     71         'S':'Đ…Õá•ášę“ĸīŧŗ𐊖𐐠',
     72         'T':'ΤĐĸŅ‚áŽĸᴛ⊤⟙â˛Ļꓔꭲīŧ´đŠ—đŠąđŒ•',
     73         'U':'ՍሀᑌâˆĒ⋃ꓴīŧĩ𐓎',
     74         'V':'Ņ´Ų§Ûˇá™á¯â…¤â´¸ę“Ļꛟīŧļ',
     75         'W':'ԜáŽŗᏔę“Ēīŧˇ',
     76         'X':'ΧĐĨ᙭ᚷⅩâ•ŗâ˛Ŧâĩę“Ģęžŗīŧ¸đŠđŠ´đŒ—đŒĸ',
     77         'Y':'ÎĨĪ’ĐŖŌŽáŽŠáŽŊⲨę“ŦīŧšđŠ˛',
     78         'Z':'ΖᏃꓜīŧēđ‹ĩ',
     79         'a':'ɑαаâēīŊđšđ‘Žđ’‚đ•’đ–†đ–ē𝗮đ˜ĸ𝙖𝚊𝛂đ›ŧđœļ𝝰đžĒ',
     80         'b':'ƄĐŦáá‘˛á–¯īŊ‚đ›đ‘đ’ƒđ–‡đ–ģđ—¯đ˜Ŗ𝙗𝚋',
     81         'c':'Ī˛Ņá´„â…Ŋâ˛ĨęŽ¯īŊƒđŊ𝐜𝑐𝒄𝕔𝖈đ–ŧ𝗰𝘤𝙘𝚌',
     82         'd':'Ôá§á‘¯â…†â…žę“’īŊ„đđ‘‘đ’…đ’šđ“­đ–Ŋ𝗱đ˜Ĩ𝙙𝚍',
     83         'e':'ĐĩŌŊ℮īŊ…đžđ•–đ–žđ—˛đšŽ',
     84         'f':'áēęž™ęŦĩīŊ†',
     85         'g':'ÆÉĄÖáļƒīŊ‡đ đ‘”đ’ˆđ•˜đ–Œđ—€đ—´đ˜¨đ™œđš',
     86         'h':'ŌģᏂℎīŊˆđ’‰đ•™đ—đ—ĩ𝘩𝙝𝚑',
     87         'j':'ĪŗŅ˜īŊŠđŖ𝚓',
     88         'k':'īŊ‹đ¤đ‘˜đ’Œđ•œđ–đ—„đ—¸đ˜Ŧ𝙠𝚔',
     89         'm':'m𝕞đ™ĸđ—ēâ…ŋ',
     90         'n':'Õ¸ÕŧīŊŽđ—‡đ—ģđ˜¯đ™Ŗ𝚗',
     91         'o':'OÎŸĐžÕ•ā¯ĻāąĻāŗĻā´ á€á€áƒŋዐᴏᴑⲞⲟâĩ”〇ę“ŗīŧīŧ¯īŊđŠ’đŠĢ𐐄đŦ𐓂đ“Ē',
     92         'p':'ĪĪąŅ€â´â˛ŖīŊđ‘đ•Ąđ—‰đ—Ŋ𝘱đ™Ĩ𝚙𝛒𝜌𝝆𝞀đžē',
     93         'q':'ԛīŊ‘đĒđ•ĸ𝗊𝗾𝘲đ™Ļ𝚚',
     94         'r':'Đŗá´ĻⲅꭈꮁīŊ’đĢ𝗋đ—ŋ𝚛',
     95         's':'Ņ•ęœąęŽĒīŊ“đ‘ˆ',
     96         't':'īŊ”đ˜đš',
     97         'u':'ʋĪ…ÕŊᴜꭒīŊ•đ“ļ',
     98         'v':'ÎŊŅĩᴠⅴ∨⋁ꮩīŊ–',
     99         'w':'ɯŅĄÔÕĄá´ĄęŽƒīŊ—',
    100         'x':'×Ņ…â…šâ¤Ģâ¤Ŧ⨯īŊ˜đąđ‘Ĩ𝒙đ”ĩ𝕩𝖝𝗑𝘅𝘹𝙭𝚡',
    101         'y':'ÉŖÎŗŅƒŌ¯áƒ§áģŋꭚīŊ™',
    102         'z':'á´ĸꮓīŊšđ™¯á´ĸ𝗓đ•ĢꮓđšŖ𝒛'
    103 }
    104 
    105 
    106 def cmd_confuse(data, buf, msg):
    107     weechat.command(buf, f'/input send {confuse(msg)}')
    108 
    109     return weechat.WEECHAT_RC_OK
    110 
    111 if weechat.register('confuse', 'acidvegas & wrk', '1.0', 'ISC', 'confuse mfers', '', ''):
    112     weechat.hook_command('confuse', 'confuse text', '<text>', '', '', 'cmd_confuse', '')