another attempt to fix the stall during regression test

This commit is contained in:
Bernardo Damele 2013-02-09 12:16:56 +00:00
parent 138a846cf1
commit e48181e28d
2 changed files with 8 additions and 10 deletions

View File

@ -77,7 +77,7 @@ def main():
if stderr: if stderr:
failure_email("Update of sqlmap failed with error:\n\n%s" % stderr) failure_email("Update of sqlmap failed with error:\n\n%s" % stderr)
regressionproc = subprocess.Popen("python /opt/sqlmap/sqlmap.py --live-test", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) regressionproc = subprocess.Popen("python /opt/sqlmap/sqlmap.py --live-test", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=False)
stdout, stderr = regressionproc.communicate() stdout, stderr = regressionproc.communicate()
if stderr: if stderr:

View File

@ -380,7 +380,7 @@ class Metasploit:
logger.info(infoMsg) logger.info(infoMsg)
logger.debug("executing local command: %s" % self._cliCmd) logger.debug("executing local command: %s" % self._cliCmd)
self._msfCliProc = execute(self._cliCmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) self._msfCliProc = execute(self._cliCmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=False)
def _runMsfCli(self, exitfunc): def _runMsfCli(self, exitfunc):
self._forgeMsfCliCmd(exitfunc) self._forgeMsfCliCmd(exitfunc)
@ -390,7 +390,7 @@ class Metasploit:
logger.info(infoMsg) logger.info(infoMsg)
logger.debug("executing local command: %s" % self._cliCmd) logger.debug("executing local command: %s" % self._cliCmd)
self._msfCliProc = execute(self._cliCmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) self._msfCliProc = execute(self._cliCmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=False)
def _runMsfShellcodeRemote(self): def _runMsfShellcodeRemote(self):
infoMsg = "running Metasploit Framework shellcode " infoMsg = "running Metasploit Framework shellcode "
@ -481,7 +481,7 @@ class Metasploit:
if len(inp) > 0: if len(inp) > 0:
try: try:
send_all(proc, inp) send_all(proc, inp)
except IOError: except (EOFError, IOError):
# Probably the child has exited # Probably the child has exited
pass pass
else: else:
@ -490,7 +490,7 @@ class Metasploit:
if stdin_fd in ready_fds[0]: if stdin_fd in ready_fds[0]:
try: try:
send_all(proc, blockingReadFromFD(stdin_fd)) send_all(proc, blockingReadFromFD(stdin_fd))
except IOError: except (EOFError, IOError):
# Probably the child has exited # Probably the child has exited
pass pass
@ -528,10 +528,8 @@ class Metasploit:
elif conf.liveTest and time.time() - start_time > METASPLOIT_SESSION_TIMEOUT: elif conf.liveTest and time.time() - start_time > METASPLOIT_SESSION_TIMEOUT:
proc.kill() proc.kill()
except EOFError: except (EOFError, IOError):
returncode = proc.wait() return proc.returncode
return returncode
def createMsfShellcode(self, exitfunc, format, extra, encode): def createMsfShellcode(self, exitfunc, format, extra, encode):
infoMsg = "creating Metasploit Framework multi-stage shellcode " infoMsg = "creating Metasploit Framework multi-stage shellcode "
@ -545,7 +543,7 @@ class Metasploit:
self._forgeMsfPayloadCmd(exitfunc, format, self._shellcodeFilePath, extra) self._forgeMsfPayloadCmd(exitfunc, format, self._shellcodeFilePath, extra)
logger.debug("executing local command: %s" % self._payloadCmd) logger.debug("executing local command: %s" % self._payloadCmd)
process = execute(self._payloadCmd, shell=True, stdout=None, stderr=PIPE) process = execute(self._payloadCmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=False)
dataToStdout("\r[%s] [INFO] creation in progress " % time.strftime("%X")) dataToStdout("\r[%s] [INFO] creation in progress " % time.strftime("%X"))
pollProcess(process) pollProcess(process)