From c74b920f54323f81bfe512909731ff66d8566d78 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 3 Feb 2010 14:49:28 +0000 Subject: [PATCH] bug fix --- lib/core/common.py | 8 ++++++++ lib/takeover/web.py | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index cbf6ec9a9..f8b1db1bc 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -880,6 +880,14 @@ def sanitizeAsciiString(string): def decloakToNamedTemporaryFile(filepath, name=None): retVal = NamedTemporaryFile() + def __del__(): + try: + if hasattr(retVal, 'old_name'): + retVal.name = old_name + retVal.close() + except OSError: + pass + retVal.__del__ = __del__ retVal.write(decloak(filepath)) retVal.seek(0) if name: diff --git a/lib/takeover/web.py b/lib/takeover/web.py index a95e34347..9043db6ce 100644 --- a/lib/takeover/web.py +++ b/lib/takeover/web.py @@ -162,6 +162,9 @@ class Web: uploaderName = "uploader.%s" % self.webApi uploaderContent = decloak(os.path.join(paths.SQLMAP_SHELL_PATH, uploaderName + '_')) + import pdb + pdb.set_trace() + for directory in directories: # Upload the uploader agent outFile = os.path.normpath("%s/%s" % (directory, uploaderName)) @@ -200,5 +203,3 @@ class Web: logger.info(infoMsg) break - - backdoorStream.name = backdoorStream.old_name