mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-10 09:49:06 +00:00
Fixes #3948
This commit is contained in:
@@ -1245,6 +1245,22 @@ def isZipFile(filename):
|
||||
|
||||
return openFile(filename, "rb", encoding=None).read(len(ZIP_HEADER)) == ZIP_HEADER
|
||||
|
||||
def isDigit(value):
|
||||
"""
|
||||
Checks if provided (string) value consists of digits (Note: Python's isdigit() is problematic)
|
||||
|
||||
>>> u'\xb2'.isdigit()
|
||||
True
|
||||
>>> isDigit(u'\xb2')
|
||||
False
|
||||
>>> isDigit('123456')
|
||||
True
|
||||
>>> isDigit('3b3')
|
||||
False
|
||||
"""
|
||||
|
||||
return re.search(r"\A[0-9]+\Z", value or "") is not None
|
||||
|
||||
def checkFile(filename, raiseOnError=True):
|
||||
"""
|
||||
Checks for file existence and readability
|
||||
|
||||
@@ -20,6 +20,7 @@ import thirdparty.chardet.universaldetector
|
||||
|
||||
from lib.core.common import filterNone
|
||||
from lib.core.common import getSafeExString
|
||||
from lib.core.common import isDigit
|
||||
from lib.core.common import isListLike
|
||||
from lib.core.common import readInput
|
||||
from lib.core.common import shellExec
|
||||
@@ -62,6 +63,7 @@ def resolveCrossReferences():
|
||||
Place for cross-reference resolution
|
||||
"""
|
||||
|
||||
lib.core.threads.isDigit = isDigit
|
||||
lib.core.threads.readInput = readInput
|
||||
lib.core.common.getPageTemplate = getPageTemplate
|
||||
lib.core.convert.filterNone = filterNone
|
||||
|
||||
@@ -18,7 +18,7 @@ from lib.core.enums import OS
|
||||
from thirdparty.six import unichr as _unichr
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.3.10.6"
|
||||
VERSION = "1.3.10.7"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||
|
||||
@@ -73,6 +73,10 @@ def readInput(message, default=None, checkBatch=True, boolean=False):
|
||||
# It will be overwritten by original from lib.core.common
|
||||
pass
|
||||
|
||||
def isDigit(value):
|
||||
# It will be overwritten by original from lib.core.common
|
||||
pass
|
||||
|
||||
def getCurrentThreadData():
|
||||
"""
|
||||
Returns current thread's local data
|
||||
@@ -125,10 +129,12 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
|
||||
choice = readInput(message, default=str(numThreads))
|
||||
if choice:
|
||||
skipThreadCheck = False
|
||||
|
||||
if choice.endswith('!'):
|
||||
choice = choice[:-1]
|
||||
skipThreadCheck = True
|
||||
if choice.isdigit():
|
||||
|
||||
if isDigit(choice):
|
||||
if int(choice) > MAX_NUMBER_OF_THREADS and not skipThreadCheck:
|
||||
errMsg = "maximum number of used threads is %d avoiding potential connection issues" % MAX_NUMBER_OF_THREADS
|
||||
logger.critical(errMsg)
|
||||
|
||||
Reference in New Issue
Block a user