-
Notifications
You must be signed in to change notification settings - Fork 0
/
PylbgzShell.py
64 lines (49 loc) · 1.69 KB
/
PylbgzShell.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
60
61
62
63
64
import os
import re
import sys
sys.dont_write_bytecode = True
#禁用pyc
from modules.compress import *
from modules.decompress import *
from modules.lsfiles import *
from api import api
while True:
try:
cwd = os.getcwd()
content = input(f"PylbgzShell {cwd} $ ")
compress_match = re.match(r'^compress (.+) output (.+)', content)
decompress_match = re.match(r'^decompress (.+) output (.+)', content)
compress_match2 = re.match(r'^compress (.+)', content)
lsfiles_match = re.match(r'^lsfiles (.+)', content)
mkdir_match = re.match(r'^mkdir (.+)', content)
if compress_match:
files = compress_match.group(1).split(',')
output_path = compress_match.group(2)
result = compress(files, output_path)
print(result)
if compress_match2:
files = compress_match2.group(1).split(',')
result = compress(files)
print(result)
elif decompress_match:
input_path = decompress_match.group(1)
output_path = decompress_match.group(2)
result = decompress(input_path, output_path)
print(result)
elif lsfiles_match:
path = content[8:]
result = lsfiles(path)
print(result)
elif content == "ls":
print(os.listdir())
elif content == "exit":
sys.exit()
elif content == "":
pass
elif mkdir_match:
path = mkdir_match.group(1)
os.mkdir(path)
else:
print("Invalid command. Please try again.")
except KeyboardInterrupt:
print("\nUse 'exit' to exit.")