mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-27 01:49:04 +00:00
Some refactoring
This commit is contained in:
@@ -5,7 +5,6 @@ Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
from lib.core.common import Backend
|
||||
from lib.core.common import isDBMSVersionAtLeast
|
||||
from plugins.generic.syntax import Syntax as GenericSyntax
|
||||
|
||||
@@ -16,6 +15,7 @@ class Syntax(GenericSyntax):
|
||||
@staticmethod
|
||||
def escape(expression, quote=True):
|
||||
"""
|
||||
>>> from lib.core.common import Backend
|
||||
>>> Backend.setVersion('2.0')
|
||||
['2.0']
|
||||
>>> Syntax.escape("SELECT 'abcdefgh' FROM foobar")
|
||||
|
||||
@@ -7,7 +7,6 @@ See the file 'doc/COPYING' for copying permission
|
||||
|
||||
import binascii
|
||||
|
||||
from lib.core.common import Backend
|
||||
from lib.core.common import isDBMSVersionAtLeast
|
||||
from lib.core.settings import UNICODE_ENCODING
|
||||
from plugins.generic.syntax import Syntax as GenericSyntax
|
||||
@@ -19,6 +18,7 @@ class Syntax(GenericSyntax):
|
||||
@staticmethod
|
||||
def escape(expression, quote=True):
|
||||
"""
|
||||
>>> from lib.core.common import Backend
|
||||
>>> Backend.setVersion('2')
|
||||
['2']
|
||||
>>> Syntax.escape("SELECT 'abcdefgh' FROM foobar")
|
||||
|
||||
@@ -119,13 +119,13 @@ class Custom:
|
||||
infoMsg = "executing SQL statements from given file(s)"
|
||||
logger.info(infoMsg)
|
||||
|
||||
for sfile in re.split(PARAMETER_SPLITTING_REGEX, conf.sqlFile):
|
||||
sfile = sfile.strip()
|
||||
for filename in re.split(PARAMETER_SPLITTING_REGEX, conf.sqlFile):
|
||||
filename = filename.strip()
|
||||
|
||||
if not sfile:
|
||||
if not filename:
|
||||
continue
|
||||
|
||||
snippet = getSQLSnippet(Backend.getDbms(), sfile)
|
||||
snippet = getSQLSnippet(Backend.getDbms(), filename)
|
||||
|
||||
if snippet and all(query.strip().upper().startswith("SELECT") for query in filter(None, snippet.split(';' if ';' in snippet else '\n'))):
|
||||
for query in filter(None, snippet.split(';' if ';' in snippet else '\n')):
|
||||
|
||||
Reference in New Issue
Block a user