-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
64 lines (49 loc) · 1.57 KB
/
main.py
File metadata and controls
64 lines (49 loc) · 1.57 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from encodings.aliases import aliases
import urllib.parse
text_encrypted = ' Ð¼ÐµÐ¼Ñ Ð¿Ñо девÑÑек '
fragment_decrypted = 'мем'
# text_encrypted = '\ud83d\udc4d'
# fragment_decrypted = '👍'
# text_decrypted = '\u003cfoo\u003e'
# fragment_encrypted = '<foo>'
cods = set(aliases.values())
text_encrypted = text_encrypted.strip()
print('encode → decode')
print('-'*25)
for code_enc in cods:
try:
text = text_encrypted.encode(code_enc)
# print(text)
for code_dec in cods:
try:
text_decrypted = text.decode(code_dec)
# print(text_decrypted)
if fragment_decrypted in text_decrypted:
print(text_decrypted)
print(code_enc, '→', code_dec)
except:
pass
except:
pass
print()
print('URL parse')
print('-'*25)
print(urllib.parse.unquote(text_encrypted))
print()
print('decode → encode')
print('-'*25)
for code_enc in cods: # {'unicode_escape'}: hex
try:
text = text_encrypted.encode(code_enc).decode('unicode_escape')
print(text)
# for code_dec in cods:
# try:
# text_decrypted = text.encode(code_dec)
# # print(text_decrypted)
# if fragment_decrypted in text_decrypted:
# print(text_decrypted)
# print(code_enc, '→', code_dec)
# except:
# pass
except:
pass