mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-06 20:51:31 +00:00
Fixes #1170
This commit is contained in:
@@ -42,7 +42,7 @@ class Filesystem:
|
||||
lengthQuery = "LENGTH(LOAD_FILE('%s'))" % remoteFile
|
||||
|
||||
elif Backend.isDbms(DBMS.PGSQL) and not fileRead:
|
||||
lengthQuery = "SELECT LENGTH(data) FROM pg_largeobject WHERE loid=%d" % self.oid
|
||||
lengthQuery = "SELECT SUM(LENGTH(data)) FROM pg_largeobject WHERE loid=%d" % self.oid
|
||||
|
||||
elif Backend.isDbms(DBMS.MSSQL):
|
||||
self.createSupportTbl(self.fileTblName, self.tblField, "VARBINARY(MAX)")
|
||||
@@ -105,20 +105,27 @@ class Filesystem:
|
||||
|
||||
return sqlQueries
|
||||
|
||||
def fileEncode(self, fileName, encoding, single):
|
||||
def fileEncode(self, fileName, encoding, single, chunkSize=256):
|
||||
"""
|
||||
Called by MySQL and PostgreSQL plugins to write a file on the
|
||||
back-end DBMS underlying file system
|
||||
"""
|
||||
|
||||
retVal = []
|
||||
with open(fileName, "rb") as f:
|
||||
content = f.read().encode(encoding).replace("\n", "")
|
||||
content = f.read()
|
||||
|
||||
return self.fileContentEncode(content, encoding, single, chunkSize)
|
||||
|
||||
def fileContentEncode(self, content, encoding, single, chunkSize=256):
|
||||
retVal = []
|
||||
|
||||
if encoding:
|
||||
content = content.encode(encoding).replace("\n", "")
|
||||
|
||||
if not single:
|
||||
if len(content) > 256:
|
||||
for i in xrange(0, len(content), 256):
|
||||
_ = content[i:i + 256]
|
||||
if len(content) > chunkSize:
|
||||
for i in xrange(0, len(content), chunkSize):
|
||||
_ = content[i:i + chunkSize]
|
||||
|
||||
if encoding == "hex":
|
||||
_ = "0x%s" % _
|
||||
|
||||
Reference in New Issue
Block a user