-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
59 lines (51 loc) · 1.66 KB
/
setup.py
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
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Author: kerlomz <[email protected]>
import rsa
(client_public_key, server_private_key) = rsa.newkeys(1024)
(server_public_key, client_private_key) = rsa.newkeys(1024)
SPLIT_FLAG = "|'''--''?\\\\%&SPLIT_FLAG&%\\\\?''--'''|"
AES_KEY = "123456"
DES3_KEY = "123456"
CLIENT_PUBLIC_KEY = client_public_key.save_pkcs1().decode()
CLIENT_PRIVATE_KEY = client_private_key.save_pkcs1().decode()
SERVER_PUBLIC_KEY = server_public_key.save_pkcs1().decode()
SERVER_PRIVATE_KEY = server_private_key.save_pkcs1().decode()
CLIENT_CONF = """
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Author: kerlomz <[email protected]>
SPLIT_FLAG = "{SPLIT_FLAG}"
AES_KEY = '{AES_KEY}'
DES3_KEY = '{DES3_KEY}'
PUBLIC_KEY = '{CLIENT_PUBLIC_KEY}'
PRIVATE_KEY = '{CLIENT_PRIVATE_KEY}'
""".format(
SPLIT_FLAG=SPLIT_FLAG,
AES_KEY=AES_KEY,
DES3_KEY=DES3_KEY,
CLIENT_PUBLIC_KEY=CLIENT_PUBLIC_KEY.replace("\n", "\\n"),
CLIENT_PRIVATE_KEY=CLIENT_PRIVATE_KEY.replace("\n", "\\n")
)
SERVER_CONF = """
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Author: kerlomz <[email protected]>
SPLIT_FLAG = "{SPLIT_FLAG}"
AES_KEY = '{AES_KEY}'
DES3_KEY = '{DES3_KEY}'
PUBLIC_KEY = '{SERVER_PUBLIC_KEY}'
PRIVATE_KEY = '{SERVER_PRIVATE_KEY}'
""".format(
SPLIT_FLAG=SPLIT_FLAG,
AES_KEY=AES_KEY,
DES3_KEY=DES3_KEY,
SERVER_PUBLIC_KEY=SERVER_PUBLIC_KEY.replace("\n", "\\n"),
SERVER_PRIVATE_KEY=SERVER_PRIVATE_KEY.replace("\n", "\\n")
)
print(CLIENT_CONF)
with open("nv_client/nv/constants.pyx", "w", encoding="utf8") as f:
f.write(CLIENT_CONF)
print(SERVER_CONF)
with open("nv_backend/constants.py", "w", encoding="utf8") as f:
f.write(SERVER_CONF)