D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
share
/
lve
/
modlscapi
/
user
/
Filename :
exec_command.py
back
Copy
#%copyright% import os import subprocess def first_quot(line, isquotf): if line[0] == "\"" and isquotf == 0: return 1 return 0 def last_quot(line, isquotf): if line[len(line) - 1] == '\"' and isquotf == 1: return 1 return 0 def parse_command(command): command = command.split(" ") isquot = 0 res = "" result = [] for i in range(len(command)): if command[i] != "": if first_quot(command[i], isquot) == 1: isquot = 1 res = command[i] continue if last_quot(command[i], isquot) == 1: isquot = 0 res += " " + command[i] result.append(res) continue result.append(command[i]) print(result) def exec_command(command): result = [] try: p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) while 1: output = p.stdout.readline() if not output: break if output.strip() != "": result.append(output.decode().strip()) except Exception as inst: print("Call process error: " + str(inst)) return result def exec_command_out(command): """ Run command via os.system and return its exit status :param command: Command to execute in a subshell :return: Exit status of the command process """ return os.system(command) def exec_command_find_substring(command, substring): result = exec_command(command) for i in result: if substring in i: return i return -1
Name
Size
Last Modified
Owner
Permissions
Actions
__pycache__
Dir
April 17 2025 3:40:13
root
0755
dashboard_malfunctions.py
1.358
KB
April 10 2025 3:29:31
root
0644
exec_command.py
1.623
KB
April 10 2025 3:29:31
root
0644
lsphpchecker.ini
1.554
KB
April 10 2025 3:29:31
root
0644
lsphpchecker.py
11.022
KB
April 10 2025 3:29:31
root
0755
lve_diagnostic.py
12.241
KB
April 10 2025 3:29:31
root
0644
mod_lsapi_stat.py
14.695
KB
April 10 2025 3:29:31
root
0644
selector_usage_lib.py
12.874
KB
April 10 2025 3:29:31
root
0644
stat_utils.py
9.169
KB
April 10 2025 3:29:31
root
0644
switch_lsapi
27.543
KB
April 10 2025 3:29:31
root
0755
2017 © D7net | D704T team