Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 94b6004

Browse files
Adding XOR encryptor and decryptor
1 parent a14c2de commit 94b6004

File tree

3 files changed

+97
-0
lines changed

3 files changed

+97
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
�������ᾎ�����������������黎���������������������������������������������������������������������������������������������������������������������������������ᤵ���������������������������������������������������������������������������������瘝����������������������������������������������������������������������������㨤�����������������������������ત���������������������ᤵ�����������������������������������������������������������������������������������������������������������������������������������������������������������������骎����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������㤣����������ᨤ����������ᣨ�������������������������������쪤�������������������������������������������������������������������������������������������������������������������飤�����������������������������������������������������������������������������������������������������������������������������������������������������������᭪����������������������黎������������������������⨤����������������������������������������������������������������������������������餰���Ǩ���������������������������ત����������������﨤������������������������������������������������娤��������������������������������������������������������������������������ᨤ�����������������������������������������������������ᨤ�����������������������������᪤���������������������������������������व��������⤦�������������������������馤�������������������������譤��������먤��������ꤰ���Ǫ����������������������������������������������������������������������������᪤�����������������������騤�����������������������𪪦�������������������������ꤵ������������������������������������������������ᤵ�����������������������������������������ત�������������������व����������餦�������������������������馤��������������������������������������������������騤������������������������������������ᤵ������������������̪�������骎
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#! /usr/bin/env python3
2+
import base64
3+
import os
4+
import pathlib
5+
import re
6+
import string
7+
from pathlib import Path
8+
import signal
9+
10+
# Nick's security protocol
11+
os.system("clear")
12+
13+
# Dynamic File Path Solution
14+
KEY_PATH = pathlib.Path(__file__).parent.absolute()
15+
16+
17+
def relative_to_assets(path: str) -> Path:
18+
return KEY_PATH / Path(path)
19+
20+
21+
def signal_handler(sig, frame):
22+
# If the program exits then remove important files.
23+
os.remove(relative_to_assets("Data/security/.tmp/.KEY"))
24+
exit()
25+
26+
27+
def decryptSecurity():
28+
# Use external script to make base64 or https://www.base64encode.org/
29+
key = "MTMy" # up 255
30+
key = base64.b64decode(key)
31+
cleanKey = re.sub(
32+
r"[^A-Za-z0-9-]", "", key.decode("utf-8"))
33+
finalKey = int(cleanKey)
34+
35+
loadEnc00 = open(relative_to_assets(
36+
"Data/security/.KEY.nclmE"), "rb").read()
37+
38+
byteReader = bytearray(loadEnc00)
39+
for index, value in enumerate(byteReader):
40+
byteReader[index] = value ^ finalKey
41+
42+
decEnc = open(relative_to_assets("Data/security/.tmp/.KEY"), "wb")
43+
decEnc.write(byteReader)
44+
45+
46+
try:
47+
# signal handler for "CTRL + C"
48+
signal.signal(signal.SIGINT, signal_handler)
49+
decryptSecurity()
50+
signal.pause()
51+
except:
52+
# Before exit the script will remove decrypted files.
53+
os.remove(relative_to_assets("Data/security/.tmp/.KEY"))
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#! /usr/bin/env python3
2+
import base64
3+
import os
4+
import pathlib
5+
import re
6+
from pathlib import Path
7+
8+
# Nick's security protocol
9+
os.system("clear")
10+
11+
# Dynamic File Path Solution
12+
KEY_PATH = pathlib.Path(__file__).parent.absolute()
13+
14+
15+
def relative_to_assets(path: str) -> Path:
16+
return KEY_PATH / Path(path)
17+
18+
19+
def encryptSecurity():
20+
# Use external script to make base64 or https://www.base64encode.org/
21+
key = "MTMy" # up 255
22+
key = base64.b64decode(key)
23+
cleanKey = re.sub(
24+
r"[^A-Za-z0-9-]", "", key.decode("utf-8"))
25+
finalKey = int(cleanKey)
26+
27+
loadEnc00 = open(relative_to_assets("Data/security/.KEY"), "rb")
28+
byteReaderData = loadEnc00.read()
29+
loadEnc00.close()
30+
31+
byteReaderData = bytearray(byteReaderData)
32+
for index, value in enumerate(byteReaderData):
33+
byteReaderData[index] = value ^ finalKey
34+
35+
Enc = open(relative_to_assets("Data/security/.KEY.nclmE"), "wb")
36+
Enc.write(byteReaderData)
37+
Enc.close()
38+
39+
# Delete Data/security/KEY
40+
os.remove(relative_to_assets("Data/security/.KEY"))
41+
42+
43+
encryptSecurity()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /