-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobfuscate.py
More file actions
50 lines (44 loc) · 1.48 KB
/
obfuscate.py
File metadata and controls
50 lines (44 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import argparse
import random
char_mapping = {
'a': ['а', 'ɑ', 'ɒ'],
'b': ['Ь', 'Ъ', 'Ƅ'],
'c': ['с', 'ϲ'],
'd': ['ԁ', 'ժ'],
'e': ['е', '℮', 'ҽ'],
'i': ['і', 'ɪ', 'ı'],
'l': ['ӏ', 'ʟ'],
'n': ['ո', 'ռ'],
'o': ['о', 'σ'],
'p': ['р', 'ρ'],
'r': ['г', 'ѓ'],
's': ['ѕ', 'ʃ'],
'x': ['х', 'ҳ'],
'y': ['у', 'ү']
}
def obfuscate(word, mapping, num_recommendations=5):
recommendations = []
for _ in range(num_recommendations):
obfuscated_word = []
for char in word:
if char.lower() in mapping:
# Choose a random replacement if available
replacements = mapping[char.lower()]
new_char = random.choice(replacements)
# Preserve the case of the original character
if char.isupper():
new_char = new_char.upper()
obfuscated_word.append(new_char)
else:
obfuscated_word.append(char)
recommendations.append(''.join(obfuscated_word))
return recommendations
def main():
parser = argparse.ArgumentParser(description='Obfuscate a given word using Unicode characters.')
parser.add_argument('word', type=str, help='The word to obfuscate')
args = parser.parse_args()
obfuscated_versions = obfuscate(args.word, char_mapping)
for version in obfuscated_versions:
print(version)
if __name__ == '__main__':
main()