update sqlmap

This commit is contained in:
Grey_D
2023-03-08 15:38:50 -06:00
parent a4e5361d76
commit 5154844439
9 changed files with 250 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
import os
import os, subprocess
def execute_cmd(cmd:str) -> str:
"""
@@ -15,13 +15,20 @@ def execute_cmd(cmd:str) -> str:
output: str
The output of the command.
"""
# execute the command in the mac terminal.
# Alert!! The execution should be really careful, because it can be dangerous.
# It is recommended to use this in a sandbox environment.
try:
output = os.popen(cmd).read()
# execute the command in the system terminal
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr = None, shell=True)
output = ""
# some tools may take time to execute. Wait until the output is finished.
while True:
line_output = p.stdout.readline()
if line_output:
output += line_output.decode("utf-8")
if line_output == b'' and p.poll() is not None:
break
return output
except Exception as e:
print("Error when executing command %s in terminal:" % cmd )
print("Error is:", e)
return False
return output
print("log: Error in executing the command:", cmd)
print("Error in executing the command:", e)
return None