Skip to content

Commit 6f6cd67

Browse files
committed
clean up the file system from sqlmap created web files
1 parent 0c5f259 commit 6f6cd67

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

plugins/generic/misc.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,18 @@ def createSupportTbl(self, tblName, tblField, tblType):
103103
inject.goStacked("DROP TABLE %s" % tblName, silent=True)
104104
inject.goStacked("CREATE TABLE %s(%s %s)" % (tblName, tblField, tblType))
105105

106-
def cleanup(self, onlyFileTbl=False, udfDict=None):
106+
def cleanup(self, onlyFileTbl=False, udfDict=None, web=False):
107107
"""
108-
Cleanup database from sqlmap create tables and functions
108+
Cleanup file system and database from sqlmap create files, tables
109+
and functions
109110
"""
110111

112+
if web:
113+
logger.info("cleaning up the web files uploaded")
114+
115+
self.delRemoteFile(self.webStagerFilePath)
116+
self.delRemoteFile(self.webBackdoorFilePath)
117+
111118
if not isTechniqueAvailable(PAYLOAD.TECHNIQUE.STACKED) and not conf.direct:
112119
return
113120

plugins/generic/takeover.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def osCmd(self):
6060
self.runCmd(conf.osCmd)
6161

6262
if not conf.osShell and not conf.osPwn and not conf.cleanup:
63-
self.cleanup()
63+
self.cleanup(web=web)
6464

6565
def osShell(self):
6666
if isTechniqueAvailable(PAYLOAD.TECHNIQUE.STACKED) or conf.direct:
@@ -83,7 +83,7 @@ def osShell(self):
8383
self.shell()
8484

8585
if not conf.osPwn and not conf.cleanup:
86-
self.cleanup()
86+
self.cleanup(web=web)
8787

8888
def osPwn(self):
8989
goUdf = False
@@ -239,7 +239,7 @@ def osPwn(self):
239239
self.pwn(goUdf)
240240

241241
if not conf.cleanup:
242-
self.cleanup()
242+
self.cleanup(web=web)
243243

244244
def osSmb(self):
245245
self.checkDbmsOs()

0 commit comments

Comments
 (0)