random

- collection of un-sorted bollocks
git clone git://git.acid.vegas/random.git
Log | Files | Refs | Archive

commit f654c9f56f0466d360601f654edcf61a49a1986f
parent 8cde9a65eef032bff0e280bb6a61a3e736802bd6
Author: acidvegas <acid.vegas@acid.vegas>
Date: Sat, 13 May 2023 00:36:16 -0400

Updated

Diffstat:
Mconfusables.py | 24++++++++++++++++--------

1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/confusables.py b/confusables.py
@@ -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ΟОՕ௦౦೦ഠဝ၀ჿዐᴏᴑⲞⲟⵔ〇ꓳ0Oo𐊒𐊫𐐄𐐬𐓂𐓪',
-	'1':'lı1',
+	'0':'߀𝛰〇𐊒𝟬𝜪Oዐ𝞞𝝤ⵔՕ𝟢𝗢𝘖ⲞОΟଠ𝟎𝐎০୦O𐊫𝙾ꓳ𐐄𝟶𝑶𝚶𐓂௦౦೦ഠဝ၀ჿᴏᴑⲟ0o𐐬𐓪',
+	'1':'𝚕𝟏𝟙𝟣𝟭𝟷',
 	'2':'Ƨᒿ2𝟐𝟤𝟮𝟸',
 	'3':'ƷȜЗӠⳌꝪꞫ3',
-	'4':'Ꮞ4',
+	'4':'Ꮞ𝟒𝟜𝟦𝟰𝟺',
 	'5':'Ƽ5',
 	'6':'бᏮⳒ6',
 	'7':'7𐓒',
@@ -50,7 +57,7 @@ confusable = {
 	'F':'ϜᖴꓝꞘF𐊇𐊥𝟋',
 	'G':'ɢԌᏀᏳᏻꓖꮐG𝐆𝐺𝑮𝔾𝖦𝗚𝘎𝙂𝙶',
 	'H':'ʜΗНнᎻᕼⲎꓧH𐋏𝐇𝐻𝑯𝖧𝗛𝘏𝙃𝚮𝛨𝜢𝝜𝞖',
-	'J':'ͿЈᎫᒍᴊꓙꞲꭻJ𝐉 𝐽 𝑱𝕁𝖩𝗝 𝙹',
+	'J':'ͿЈᎫᒍᴊꓙꞲꭻJ𝐉𝐽𝑱𝕁𝖩𝗝𝙹',
 	'K':'ΚКᏦᛕKⲔꓗK',
 	'L':'ʟᏞᒪⅬⳐⳑꓡꮮL𐐛𐑃',
 	'M':'ΜϺМᎷᗰᛖⅯⲘꓟM𐊰𐌑𝐌𝑀𝑴𝕄𝖬𝗠𝘔𝙈𝙼𝚳𝛭𝜧𝝡𝞛',
@@ -73,11 +80,11 @@ confusable = {
 	'd':'ԁᏧᑯⅆⅾꓒd𝐝𝑑𝒅𝒹𝓭𝖽𝗱𝘥𝙙𝚍',
 	'e':'еҽ℮e𝐞𝕖𝖾𝗲𝚎',
 	'f':'ẝꞙꬵf',
-	'g':'ƍɡցᶃg𝐠𝑔𝒈𝓰𝔤𝕘𝖌𝗀𝗴𝘨𝙜𝚐',
+	'g':'ƍɡցᶃg𝐠𝑔𝒈𝕘𝖌𝗀𝗴𝘨𝙜𝚐',
 	'h':'һᏂℎh𝒉𝕙𝗁𝗵𝘩𝙝𝚑',
 	'j':'ϳјj𝐣𝚓',
 	'k':'k𝐤𝑘𝒌𝕜𝖐𝗄𝗸𝘬𝙠𝚔',
-	'm':'m',
+	'm':'m𝕞𝙢𝗺ⅿ',
 	'n':'ոռn𝗇𝗻𝘯𝙣𝚗',
 	'o':'OΟОՕ௦౦೦ഠဝ၀ჿዐᴏᴑⲞⲟⵔ〇ꓳ0Oo𐊒𐊫𐐄𐐬𐓂𐓪',
 	'p':'ρϱр⍴ⲣp𝑝𝕡𝗉𝗽𝘱𝙥𝚙𝛒𝜌𝝆𝞀𝞺',
@@ -91,4 +98,5 @@ confusable = {
 	'x':'×хⅹ⤫⤬⨯x𝐱𝑥𝒙𝔵𝕩𝖝𝗑𝘅𝘹𝙭𝚡',
 	'y':'ɣγуүყỿꭚy',
 	'z':'ᴢꮓz'
+	'z':'𝙯ᴢ𝗓𝕫ꮓ𝚣𝒛'
 }
 \ No newline at end of file