mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-07-29 12:41:58 +00:00
Fixes #1170
This commit is contained in:
parent
8df3d7a6fa
commit
b6ea2fdb07
3 changed files with 31 additions and 59 deletions
|
|
@ -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" % _
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue