Skip to content

Commit f4028bd

Browse files
committed
minor adjustment
1 parent d8a0e7e commit f4028bd

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

lib/takeover/web.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def webInit(self):
271271
_ = _.replace("WRITABLE_DIR", localPath.replace('/', '\\\\') if Backend.isOs(OS.WINDOWS) else localPath)
272272
f.write(utf8encode(_))
273273

274-
self.unionWriteFile(filename, self.webStagerFilePath, "text")
274+
self.unionWriteFile(filename, self.webStagerFilePath, "text", forceCheck=True)
275275

276276
uplPage, _, _ = Request.getPage(url=self.webStagerUrl, direct=True, raise404=False)
277277
uplPage = uplPage or ""

plugins/dbms/mysql/filesystem.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def stackedReadFile(self, rFile):
8080

8181
return result
8282

83-
def unionWriteFile(self, wFile, dFile, fileType):
83+
def unionWriteFile(self, wFile, dFile, fileType, forceCheck=False):
8484
logger.debug("encoding file to its hexadecimal string value")
8585

8686
fcEncodedList = self.fileEncode(wFile, "hex", True)
@@ -104,6 +104,8 @@ def unionWriteFile(self, wFile, dFile, fileType):
104104
warnMsg += "file as a leftover from UNION query"
105105
singleTimeWarnMessage(warnMsg)
106106

107+
return self.askCheckWrittenFile(wFile, dFile, forceCheck)
108+
107109
def stackedWriteFile(self, wFile, dFile, fileType, forceCheck=False):
108110
debugMsg = "creating a support table to write the hexadecimal "
109111
debugMsg += "encoded file to"

plugins/generic/filesystem.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,14 @@ def fileEncode(self, fileName, encoding, single):
137137

138138
def askCheckWrittenFile(self, localFile, remoteFile, forceCheck=False):
139139
output = None
140+
140141
if forceCheck is not True:
141142
message = "do you want confirmation that the local file '%s' " % localFile
142143
message += "has been successfully written on the back-end DBMS "
143144
message += "file system (%s)? [Y/n] " % remoteFile
144145
output = readInput(message, default="Y")
145146

146-
readInput("press ENTER to continue :)")
147-
148-
if forceCheck or (not output or output in ("y", "Y")):
147+
if forceCheck or (output and output.lower() == "y"):
149148
return self._checkFileLength(localFile, remoteFile)
150149

151150
return True
@@ -274,7 +273,7 @@ def writeFile(self, localFile, remoteFile, fileType=None, forceCheck=False):
274273
debugMsg += "UNION query SQL injection technique"
275274
logger.debug(debugMsg)
276275

277-
self.unionWriteFile(localFile, remoteFile, fileType)
276+
written = self.unionWriteFile(localFile, remoteFile, fileType, forceCheck)
278277
else:
279278
errMsg = "none of the SQL injection techniques detected can "
280279
errMsg += "be used to write files to the underlying file "

0 commit comments

Comments
 (0)