mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-04-25 11:23:44 +03:00
Minor refactoring
This commit is contained in:
parent
5f11f9e176
commit
ffc520b35f
|
@ -125,36 +125,31 @@ class Filesystem:
|
||||||
back-end DBMS underlying file system
|
back-end DBMS underlying file system
|
||||||
"""
|
"""
|
||||||
|
|
||||||
fcEncodedList = []
|
retVal = []
|
||||||
fp = codecs.open(fileName, "rb")
|
with codecs.open(fileName, "rb") as f:
|
||||||
fcEncodedStr = fp.read().encode(encoding).replace("\n", "")
|
content = f.read().encode(encoding).replace("\n", "")
|
||||||
|
|
||||||
if not single:
|
if not single:
|
||||||
fcLength = len(fcEncodedStr)
|
if len(content) > 256:
|
||||||
|
for i in xrange(0, len(content), 256):
|
||||||
if fcLength > 256:
|
_ = content[i:i+256]
|
||||||
for i in xrange(0, fcLength, 256):
|
|
||||||
string = ""
|
|
||||||
|
|
||||||
if encoding == "hex":
|
if encoding == "hex":
|
||||||
string += "0x"
|
_ = "0x%s" % _
|
||||||
|
elif encoding == "base64":
|
||||||
|
_ = "'%s'" % _
|
||||||
|
|
||||||
string += fcEncodedStr[i:i+256]
|
retVal.append(_)
|
||||||
|
|
||||||
if encoding == "base64":
|
if not retVal:
|
||||||
string = "'%s'" % string
|
|
||||||
|
|
||||||
fcEncodedList.append(string)
|
|
||||||
|
|
||||||
if not fcEncodedList:
|
|
||||||
if encoding == "hex":
|
if encoding == "hex":
|
||||||
fcEncodedStr = "0x%s" % fcEncodedStr
|
content = "0x%s" % content
|
||||||
elif encoding == "base64":
|
elif encoding == "base64":
|
||||||
fcEncodedStr = "'%s'" % fcEncodedStr
|
content = "'%s'" % content
|
||||||
|
|
||||||
fcEncodedList = [ fcEncodedStr ]
|
retVal = [ content ]
|
||||||
|
|
||||||
return fcEncodedList
|
return retVal
|
||||||
|
|
||||||
def askCheckWrittenFile(self, wFile, dFile, fileType):
|
def askCheckWrittenFile(self, wFile, dFile, fileType):
|
||||||
message = "do you want confirmation that the file '%s' " % dFile
|
message = "do you want confirmation that the file '%s' " % dFile
|
||||||
|
|
Loading…
Reference in New Issue
Block a user