mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 19:13:48 +03:00
Minor refactoring for an Issue #295
This commit is contained in:
parent
c155c6df84
commit
ad85c4c964
|
@ -22,6 +22,7 @@ import socket
|
|||
import string
|
||||
import struct
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
import urllib
|
||||
import urlparse
|
||||
|
@ -38,6 +39,7 @@ from subprocess import Popen as execute
|
|||
from xml.dom import minidom
|
||||
from xml.sax import parse
|
||||
|
||||
from extra.cloak.cloak import decloak
|
||||
from extra.safe2bin.safe2bin import safecharencode
|
||||
from lib.core.bigarray import BigArray
|
||||
from lib.core.data import conf
|
||||
|
@ -3260,6 +3262,21 @@ def resetCookieJar(cookieJar):
|
|||
errMsg += "cookies file ('%s')" % msg
|
||||
raise SqlmapGenericException(errMsg)
|
||||
|
||||
def decloakToTemp(filename):
|
||||
"""
|
||||
Decloaks content of a given file to a temporary file with similar name and extension
|
||||
"""
|
||||
|
||||
content = decloak(filename)
|
||||
_ = os.path.split(filename[:-1])[-1]
|
||||
prefix, suffix = os.path.splitext(_)
|
||||
prefix = prefix.split(os.extsep)[0]
|
||||
handle, filename = tempfile.mkstemp(prefix=prefix, suffix=suffix)
|
||||
os.close(handle)
|
||||
with open(filename, "w+b") as f:
|
||||
f.write(content)
|
||||
return filename
|
||||
|
||||
def prioritySortColumns(columns):
|
||||
"""
|
||||
Sorts given column names by length in ascending order while those containing
|
||||
|
|
|
@ -8,10 +8,10 @@ See the file 'doc/COPYING' for copying permission
|
|||
import os
|
||||
import tempfile
|
||||
|
||||
from extra.cloak.cloak import decloak
|
||||
from lib.core.agent import agent
|
||||
from lib.core.common import dataToOutFile
|
||||
from lib.core.common import Backend
|
||||
from lib.core.common import decloakToTemp
|
||||
from lib.core.common import decodeHexValue
|
||||
from lib.core.common import isNumPosStrValue
|
||||
from lib.core.common import isListLike
|
||||
|
@ -253,14 +253,8 @@ class Filesystem:
|
|||
def writeFile(self, localFile, remoteFile, fileType=None):
|
||||
self.checkDbmsOs()
|
||||
|
||||
if localFile.endswith("_"):
|
||||
content = decloak(localFile)
|
||||
_ = os.path.split(localFile[:-1])[-1]
|
||||
prefix, suffix = os.path.splitext(_)
|
||||
handle, localFile = tempfile.mkstemp(prefix=prefix, suffix=suffix)
|
||||
os.close(handle)
|
||||
with open(localFile, "w+b") as f:
|
||||
f.write(content)
|
||||
if localFile.endswith('_'):
|
||||
localFile = decloakToTemp(localFile)
|
||||
|
||||
if conf.direct or isTechniqueAvailable(PAYLOAD.TECHNIQUE.STACKED):
|
||||
if isTechniqueAvailable(PAYLOAD.TECHNIQUE.STACKED):
|
||||
|
|
Loading…
Reference in New Issue
Block a user