-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathC_normal.py
52 lines (43 loc) · 1.47 KB
/
C_normal.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
from CRY.CRY_RSA import CRYRSA
import argparse
import os
parser = argparse.ArgumentParser(
prog="Pixiv Downloader",
description='用于下载固定UID的收藏列表',
epilog='Phantom-sea © limited |∀` )',
)
parser.add_argument('--private', type=str,
dest="private", help='设置private key', default=False)
parser.add_argument('--public', type=str,
dest="public", help='设置public key', default=False)
parser.add_argument('--mode', type=str,
dest="mode", help='加密or解密', default=False)
parser.add_argument('--type', type=str,
dest="type", help='type', default="python")
def load_and_save(path, m: str = ""):
if m == "":
with open(path, "r") as f:
return f.read()
else:
with open(path, "w") as f:
f.write(m)
def main(args):
# c = Cry(args.private, args.public)
c = CRYRSA()
# c.create_rsa_key()
filelist = {}
filelist["python"] = [
os.path.join("Upload", "oa.json"),
os.path.join("Upload", "setting.py"),
]
filelist["rclone"] = ["rclone.conf"]
if args.mode == "jiami":
for i in filelist[args.type]:
load_and_save(i, c.encrypt_more(load_and_save(i)))
elif args.mode == "jiemi":
for i in filelist[args.type]:
load_and_save(i, c.decrypt_more(load_and_save(i)))
elif args.mode == "create":
c.create_rsa_key()
args = parser.parse_args()
main(args)