mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-06 12:41:30 +00:00
Make --live-test Metasploit integration cases work, added more test cases for PostgreSQL and code refactoring (issue #312)
This commit is contained in:
@@ -444,6 +444,7 @@ class Metasploit:
|
||||
|
||||
def _controlMsfCmd(self, proc, func):
|
||||
stdin_fd = sys.stdin.fileno()
|
||||
initiated_properly = False
|
||||
|
||||
while True:
|
||||
returncode = proc.poll()
|
||||
@@ -493,6 +494,14 @@ class Metasploit:
|
||||
out = recv_some(proc, t=.1, e=0)
|
||||
blockingWriteToFD(sys.stdout.fileno(), out)
|
||||
|
||||
# Dirty hack to allow Metasploit integration to be tested
|
||||
# in --live-test mode
|
||||
if initiated_properly and conf.liveTest:
|
||||
try:
|
||||
send_all(proc, "exit\n")
|
||||
except TypeError:
|
||||
continue
|
||||
|
||||
# For --os-pwn and --os-bof
|
||||
pwnBofCond = self.connectionStr.startswith("reverse")
|
||||
pwnBofCond &= "Starting the payload handler" in out
|
||||
@@ -509,6 +518,9 @@ class Metasploit:
|
||||
else:
|
||||
send_all(proc, "uname -a ; id\n")
|
||||
|
||||
time.sleep(2)
|
||||
initiated_properly = True
|
||||
|
||||
metSess = re.search("Meterpreter session ([\d]+) opened", out)
|
||||
|
||||
if metSess:
|
||||
|
||||
Reference in New Issue
Block a user