-
Notifications
You must be signed in to change notification settings - Fork 10
/
RUN.py
47 lines (32 loc) · 1.24 KB
/
RUN.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
import os
import platform
import sys
config_file = "modules/.files/config"
modulez = sys.argv[1]
module_path = f"modules/{modulez}"
if os.path.exists(f"generated/{modulez}"):
os.remove(f"generated/{modulez}")
def read_config(module):
config_values = [x.strip("\n") for x in open(config_file, "r").readlines()]
for parameter in config_values:
variable, value = parameter.split("=")
parameter = variable + "=" + f"\"{value}\""
with open(module, "r") as append:
data = append.read()
with open(f"generated/{modulez}", "a+") as files:
files.write(parameter + "\n")
with open(f"generated/{modulez}", "a+") as file:
file.write(data)
def run():
try:
read_config(module_path)
os.system(f"python3 generated/{modulez}" if 'Windows' not in platform.platform() else f"py -3 generated/{modulez}")
except:
os.system(f"python3 modules/{modulez}"if 'Windows' not in platform.platform() else f"py -3 generated/{modulez}")
if os.path.exists("modules/.files/config"):
os.remove("modules/.files/config")
try:
run()
except:
print("[+] Set parameters are removed!")
print("[+] Something went wrong, select module again and set parameters.")