mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-05-25 07:59:18 +03:00
Patch for an Issue #1105
This commit is contained in:
parent
8e03f4db0f
commit
06ff8b3a16
|
@ -17,7 +17,6 @@ import tempfile
|
||||||
|
|
||||||
from lib.core.exception import SqlmapSystemException
|
from lib.core.exception import SqlmapSystemException
|
||||||
from lib.core.settings import BIGARRAY_CHUNK_SIZE
|
from lib.core.settings import BIGARRAY_CHUNK_SIZE
|
||||||
from lib.core.settings import BIGARRAY_TEMP_PREFIX
|
|
||||||
|
|
||||||
DEFAULT_SIZE_OF = sys.getsizeof(object())
|
DEFAULT_SIZE_OF = sys.getsizeof(object())
|
||||||
|
|
||||||
|
@ -92,7 +91,7 @@ class BigArray(list):
|
||||||
|
|
||||||
def _dump(self, chunk):
|
def _dump(self, chunk):
|
||||||
try:
|
try:
|
||||||
handle, filename = tempfile.mkstemp(prefix=BIGARRAY_TEMP_PREFIX)
|
handle, filename = tempfile.mkstemp()
|
||||||
self.filenames.add(filename)
|
self.filenames.add(filename)
|
||||||
os.close(handle)
|
os.close(handle)
|
||||||
with open(filename, "w+b") as fp:
|
with open(filename, "w+b") as fp:
|
||||||
|
|
|
@ -15,6 +15,7 @@ import re
|
||||||
import socket
|
import socket
|
||||||
import string
|
import string
|
||||||
import sys
|
import sys
|
||||||
|
import tempfile
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import urllib2
|
import urllib2
|
||||||
|
@ -1437,6 +1438,17 @@ def _checkDependencies():
|
||||||
if conf.dependencies:
|
if conf.dependencies:
|
||||||
checkDependencies()
|
checkDependencies()
|
||||||
|
|
||||||
|
def _createTemporaryDirectory():
|
||||||
|
"""
|
||||||
|
Creates temporary directory for this run.
|
||||||
|
"""
|
||||||
|
|
||||||
|
if not os.path.isdir(tempfile.gettempdir()):
|
||||||
|
os.makedirs(tempfile.gettempdir())
|
||||||
|
tempfile.tempdir = tempfile.mkdtemp(prefix="sqlmap", suffix=str(os.getpid()))
|
||||||
|
if not os.path.isdir(tempfile.tempdir):
|
||||||
|
os.makedirs(tempfile.tempdir)
|
||||||
|
|
||||||
def _cleanupOptions():
|
def _cleanupOptions():
|
||||||
"""
|
"""
|
||||||
Cleanup configuration attributes.
|
Cleanup configuration attributes.
|
||||||
|
@ -2332,6 +2344,7 @@ def init():
|
||||||
_cleanupOptions()
|
_cleanupOptions()
|
||||||
_purgeOutput()
|
_purgeOutput()
|
||||||
_checkDependencies()
|
_checkDependencies()
|
||||||
|
_createTemporaryDirectory()
|
||||||
_basicOptionValidation()
|
_basicOptionValidation()
|
||||||
_setProxyList()
|
_setProxyList()
|
||||||
_setTorProxySettings()
|
_setTorProxySettings()
|
||||||
|
|
|
@ -446,9 +446,6 @@ ROTATING_CHARS = ('\\', '|', '|', '/', '-')
|
||||||
# Approximate chunk length (in bytes) used by BigArray objects (only last chunk and cached one are held in memory)
|
# Approximate chunk length (in bytes) used by BigArray objects (only last chunk and cached one are held in memory)
|
||||||
BIGARRAY_CHUNK_SIZE = 1024 * 1024
|
BIGARRAY_CHUNK_SIZE = 1024 * 1024
|
||||||
|
|
||||||
# Prefix used for storing dumped chunks in BigArray objects
|
|
||||||
BIGARRAY_TEMP_PREFIX = "sqlmapba-%d-" % os.getpid()
|
|
||||||
|
|
||||||
# Only console display last n table rows
|
# Only console display last n table rows
|
||||||
TRIM_STDOUT_DUMP_SIZE = 256
|
TRIM_STDOUT_DUMP_SIZE = 256
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@ See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import bdb
|
import bdb
|
||||||
import glob
|
|
||||||
import inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
|
@ -44,7 +44,6 @@ from lib.core.exception import SqlmapUserQuitException
|
||||||
from lib.core.option import initOptions
|
from lib.core.option import initOptions
|
||||||
from lib.core.option import init
|
from lib.core.option import init
|
||||||
from lib.core.profiling import profile
|
from lib.core.profiling import profile
|
||||||
from lib.core.settings import BIGARRAY_TEMP_PREFIX
|
|
||||||
from lib.core.settings import LEGAL_DISCLAIMER
|
from lib.core.settings import LEGAL_DISCLAIMER
|
||||||
from lib.core.testing import smokeTest
|
from lib.core.testing import smokeTest
|
||||||
from lib.core.testing import liveTest
|
from lib.core.testing import liveTest
|
||||||
|
@ -154,11 +153,7 @@ def main():
|
||||||
if conf.get("showTime"):
|
if conf.get("showTime"):
|
||||||
dataToStdout("\n[*] shutting down at %s\n\n" % time.strftime("%X"), forceOutput=True)
|
dataToStdout("\n[*] shutting down at %s\n\n" % time.strftime("%X"), forceOutput=True)
|
||||||
|
|
||||||
for filename in glob.glob("%s*" % os.path.join(tempfile.gettempdir(), BIGARRAY_TEMP_PREFIX)):
|
shutil.rmtree(tempfile.tempdir, ignore_errors=True)
|
||||||
try:
|
|
||||||
os.remove(filename)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
kb.threadContinue = False
|
kb.threadContinue = False
|
||||||
kb.threadException = True
|
kb.threadException = True
|
||||||
|
|
Loading…
Reference in New Issue
Block a user