1
mirror of git://git.acid.vegas/random.git synced 2024-12-04 21:46:40 +00:00
This commit is contained in:
Dionysus 2023-05-13 00:36:16 -04:00
parent 8cde9a65ee
commit f654c9f56f
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE

View File

@ -5,14 +5,21 @@
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):
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:
if char in confusable and (not chance or random.choice((True,False))):
confused += random.choice(list(confusable[char]))
else:
confused += char
@ -32,11 +39,11 @@ confusable = {
'>':'',
'?':'',
'@':'',
'0':'OΟОՕ𐊒𐊫𐐄𐐬𐓂𐓪',
'1':'lı',
'0':'߀𝛰𐊒𝟬𝜪O𝞞𝝤Օ𝟢𝗢𝘖ОΟ𝟎𝐎𐊫𝙾𐐄𝟶𝑶𝚶𐓂𐐬𐓪',
'1':'𝚕𝟏𝟙𝟣𝟭𝟷',
'2':'Ƨ𝟐𝟤𝟮𝟸',
'3':'ƷȜЗӠ',
'4':'',
'4':'𝟒𝟜𝟦𝟰𝟺',
'5':'Ƽ',
'6':'б',
'7':'𐓒',
@ -50,7 +57,7 @@ confusable = {
'F':'ϜᖴꓝꞘF𐊇𐊥𝟋',
'G':'ɢԌᏀᏳᏻꓖꮐG𝐆𝐺𝑮𝔾𝖦𝗚𝘎𝙂𝙶',
'H':'ʜΗНнᎻᕼⲎꓧH𐋏𝐇𝐻𝑯𝖧𝗛𝘏𝙃𝚮𝛨𝜢𝝜𝞖',
'J':'ͿЈᎫᒍᴊꓙꞲꭻJ𝐉 𝐽 𝑱𝕁𝖩𝗝 𝙹',
'J':'ͿЈᎫᒍᴊꓙꞲꭻJ𝐉𝐽𝑱𝕁𝖩𝗝𝙹',
'K':'ΚК',
'L':'ʟᏞᒪⅬⳐⳑꓡꮮL𐐛𐑃',
'M':'ΜϺМ𐊰𐌑𝐌𝑀𝑴𝕄𝖬𝗠𝘔𝙈𝙼𝚳𝛭𝜧𝝡𝞛',
@ -73,11 +80,11 @@ confusable = {
'd':'ԁ𝐝𝑑𝒅𝒹𝓭𝖽𝗱𝘥𝙙𝚍',
'e':'еҽ𝐞𝕖𝖾𝗲𝚎',
'f':'',
'g':'ƍɡց𝐠𝑔𝒈𝓰𝔤𝕘𝖌𝗀𝗴𝘨𝙜𝚐',
'g':'ƍɡց𝐠𝑔𝒈𝕘𝖌𝗀𝗴𝘨𝙜𝚐',
'h':'һ𝒉𝕙𝗁𝗵𝘩𝙝𝚑',
'j':'ϳј𝐣𝚓',
'k':'𝐤𝑘𝒌𝕜𝖐𝗄𝗸𝘬𝙠𝚔',
'm':'',
'm':'m𝕞𝙢𝗺ⅿ',
'n':'ոռ𝗇𝗻𝘯𝙣𝚗',
'o':'OΟОՕ𐊒𐊫𐐄𐐬𐓂𐓪',
'p':'ρϱр𝑝𝕡𝗉𝗽𝘱𝙥𝚙𝛒𝜌𝝆𝞀𝞺',
@ -91,4 +98,5 @@ confusable = {
'x':'×х𝐱𝑥𝒙𝔵𝕩𝖝𝗑𝘅𝘹𝙭𝚡',
'y':'ɣγуүỿ',
'z':''
'z':'𝙯𝗓𝕫𝚣𝒛'
}