From 6f6cd676b79ec348396682b4b7beb525ee233646 Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Wed, 11 Jul 2012 14:07:20 +0100 Subject: [PATCH] clean up the file system from sqlmap created web files --- plugins/generic/misc.py | 11 +++++++++-- plugins/generic/takeover.py | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/plugins/generic/misc.py b/plugins/generic/misc.py index d73d81dd9..a037b6a0a 100644 --- a/plugins/generic/misc.py +++ b/plugins/generic/misc.py @@ -103,11 +103,18 @@ class Miscellaneous: inject.goStacked("DROP TABLE %s" % tblName, silent=True) inject.goStacked("CREATE TABLE %s(%s %s)" % (tblName, tblField, tblType)) - def cleanup(self, onlyFileTbl=False, udfDict=None): + def cleanup(self, onlyFileTbl=False, udfDict=None, web=False): """ - Cleanup database from sqlmap create tables and functions + Cleanup file system and database from sqlmap create files, tables + and functions """ + if web: + logger.info("cleaning up the web files uploaded") + + self.delRemoteFile(self.webStagerFilePath) + self.delRemoteFile(self.webBackdoorFilePath) + if not isTechniqueAvailable(PAYLOAD.TECHNIQUE.STACKED) and not conf.direct: return diff --git a/plugins/generic/takeover.py b/plugins/generic/takeover.py index 75a6959ac..fd90fb5b2 100644 --- a/plugins/generic/takeover.py +++ b/plugins/generic/takeover.py @@ -60,7 +60,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous): self.runCmd(conf.osCmd) if not conf.osShell and not conf.osPwn and not conf.cleanup: - self.cleanup() + self.cleanup(web=web) def osShell(self): if isTechniqueAvailable(PAYLOAD.TECHNIQUE.STACKED) or conf.direct: @@ -83,7 +83,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous): self.shell() if not conf.osPwn and not conf.cleanup: - self.cleanup() + self.cleanup(web=web) def osPwn(self): goUdf = False @@ -239,7 +239,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry, Miscellaneous): self.pwn(goUdf) if not conf.cleanup: - self.cleanup() + self.cleanup(web=web) def osSmb(self): self.checkDbmsOs()