random/confusables.py

106 lines
4.1 KiB
Python
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python
# confusables - developed by acidvegas in python (https://git.acid.vegas/random)
'''
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 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𝞞𝝤Օ𝟢𝗢𝘖ОΟ𝟎𝐎𐊫𝙾𐐄𝟶𝑶𝚶𐓂𐐬𐓪',
'1':'𝚕𝟏𝟙𝟣𝟭𝟷',
'2':'Ƨ𝟐𝟤𝟮𝟸',
'3':'ƷȜЗӠ',
'4':'𝟒𝟜𝟦𝟰𝟺',
'5':'Ƽ',
'6':'б',
'7':'𐓒',
'8':'𐌚𝟖𝟠𝟪𝟴',
'9':'',
'A':'ΑАᎪᗅᴀꓮꭺA𐊠',
'B':'ΒВ𐊂𐊡𝐁𝐵𝑩𝔹𝖡𝗕𝘉𝘽𝚩𝜝𝝗𝞑',
'C':'СᏟᑕℂⅭ⊂ⲤꓚC𐊢𐐕',
'D':'ᎠᗞᗪⅮꓓꭰD𝐃𝐷𝑫𝔻𝖣𝗗𝘋𝘿𝙳',
'E':'ΕЕᎬ⋿ⴹꓰꭼE𐊆',
'F':'ϜᖴꓝꞘF𐊇𐊥𝟋',
'G':'ɢԌᏀᏳᏻꓖꮐG𝐆𝐺𝑮𝔾𝖦𝗚𝘎𝙂𝙶',
'H':'ʜΗНнᎻᕼⲎꓧH𐋏𝐇𝐻𝑯𝖧𝗛𝘏𝙃𝚮𝛨𝜢𝝜𝞖',
'J':'ͿЈᎫᒍᴊꓙꞲꭻJ𝐉𝐽𝑱𝕁𝖩𝗝𝙹',
'K':'ΚК',
'L':'ʟᏞᒪⅬⳐⳑꓡꮮL𐐛𐑃',
'M':'ΜϺМ𐊰𐌑𝐌𝑀𝑴𝕄𝖬𝗠𝘔𝙈𝙼𝚳𝛭𝜧𝝡𝞛',
'N':'ɴΝⲚꓠN',
'O':'OΟОՕ𐊒𐊫𐐄𐐬𐓂𐓪',
'P':'ΡРᏢᑭᴘᴩℙⲢꓑꮲP𐊕𝐏𝑃𝑷𝖯𝗣𝘗𝙋𝙿𝚸𝛲𝜬𝝦𝞠',
'Q':'𝐐𝑄𝑸𝖰𝗤𝘘𝙌𝚀',
'R':'ƦʀᎡᏒᖇᚱꓣꭱꮢR𐒴',
'S':'ЅՏ𐊖𐐠',
'T':'ΤТтᎢᴛ⊤⟙ⲦꓔꭲT𐊗𐊱𐌕',
'U':'Ս𐓎',
'V':'Ѵ٧۷',
'W':'Ԝ',
'X':'ΧХ𐊐𐊴𐌗𐌢',
'Y':'ΥϒУҮ𐊲',
'Z':'Ζ𐋵',
'a':'ɑαа𝐚𝑎𝒂𝕒𝖆𝖺𝗮𝘢𝙖𝚊𝛂𝛼𝜶𝝰𝞪',
'b':'ƄЬ𝐛𝑏𝒃𝖇𝖻𝗯𝘣𝙗𝚋',
'c':'ϲс𐐽𝐜𝑐𝒄𝕔𝖈𝖼𝗰𝘤𝙘𝚌',
'd':'ԁ𝐝𝑑𝒅𝒹𝓭𝖽𝗱𝘥𝙙𝚍',
'e':'еҽ𝐞𝕖𝖾𝗲𝚎',
'f':'',
'g':'ƍɡց𝐠𝑔𝒈𝕘𝖌𝗀𝗴𝘨𝙜𝚐',
'h':'һ𝒉𝕙𝗁𝗵𝘩𝙝𝚑',
'j':'ϳј𝐣𝚓',
'k':'𝐤𝑘𝒌𝕜𝖐𝗄𝗸𝘬𝙠𝚔',
'm':'m𝕞𝙢𝗺ⅿ',
'n':'ոռ𝗇𝗻𝘯𝙣𝚗',
'o':'OΟОՕ𐊒𐊫𐐄𐐬𐓂𐓪',
'p':'ρϱр𝑝𝕡𝗉𝗽𝘱𝙥𝚙𝛒𝜌𝝆𝞀𝞺',
'q':'ԛ𝐪𝕢𝗊𝗾𝘲𝙦𝚚',
'r':'г𝐫𝗋𝗿𝚛',
's':'ѕ𐑈',
't':'𝘁𝚝',
'u':'ʋυս𐓶',
'v':'νѵ',
'w':'ɯѡԝա',
'x':'×х𝐱𝑥𝒙𝔵𝕩𝖝𝗑𝘅𝘹𝙭𝚡',
'y':'ɣγуүỿ',
'z':'',
'z':'𝙯𝗓𝕫𝚣𝒛'
}
for i in range(30):
print(confuse('facebook'))