mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-25 08:59:02 +00:00
Minor refactoring
This commit is contained in:
@@ -21,6 +21,7 @@ import time
|
||||
|
||||
from lib.core.common import dataToStdout
|
||||
from lib.core.common import getSafeExString
|
||||
from lib.core.common import openFile
|
||||
from lib.core.common import saveConfig
|
||||
from lib.core.common import unArrayizeValue
|
||||
from lib.core.compat import xrange
|
||||
@@ -648,9 +649,8 @@ def download(taskid, target, filename):
|
||||
|
||||
if os.path.isfile(path):
|
||||
logger.debug("(%s) Retrieved content of file %s" % (taskid, target))
|
||||
with open(path, 'rb') as inf:
|
||||
file_content = inf.read()
|
||||
return jsonize({"success": True, "file": encodeBase64(file_content, binary=False)})
|
||||
content = openFile(path, "rb").read()
|
||||
return jsonize({"success": True, "file": encodeBase64(content, binary=False)})
|
||||
else:
|
||||
logger.warning("[%s] File does not exist %s" % (taskid, target))
|
||||
return jsonize({"success": False, "message": "File does not exist"})
|
||||
|
||||
@@ -56,6 +56,7 @@ from lib.core.common import getSafeExString
|
||||
from lib.core.common import hashDBRetrieve
|
||||
from lib.core.common import hashDBWrite
|
||||
from lib.core.common import normalizeUnicode
|
||||
from lib.core.common import openFile
|
||||
from lib.core.common import paths
|
||||
from lib.core.common import readInput
|
||||
from lib.core.common import singleTimeLogMessage
|
||||
@@ -597,7 +598,7 @@ def storeHashesToFile(attack_dict):
|
||||
infoMsg = "writing hashes to a temporary file '%s' " % filename
|
||||
logger.info(infoMsg)
|
||||
|
||||
with open(filename, "w+") as f:
|
||||
with openFile(filename, "w+") as f:
|
||||
for item in items:
|
||||
f.write(item)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user