mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 01:26:42 +03:00
Minor code refactoring
This commit is contained in:
parent
45f5548113
commit
57eb19377e
|
@ -338,3 +338,7 @@ class AUTH_TYPE:
|
|||
DIGEST = "digest"
|
||||
NTLM = "ntlm"
|
||||
PKI = "pki"
|
||||
|
||||
class AUTOCOMPLETE_TYPE:
|
||||
SQL = 0
|
||||
OS = 1
|
||||
|
|
|
@ -13,6 +13,7 @@ from lib.core import readlineng as readline
|
|||
from lib.core.common import Backend
|
||||
from lib.core.data import logger
|
||||
from lib.core.data import paths
|
||||
from lib.core.enums import AUTOCOMPLETE_TYPE
|
||||
from lib.core.enums import OS
|
||||
|
||||
def saveHistory():
|
||||
|
@ -47,13 +48,13 @@ class CompleterNG(rlcompleter.Completer):
|
|||
|
||||
return matches
|
||||
|
||||
def autoCompletion(sqlShell=False, osShell=False):
|
||||
def autoCompletion(completion=None):
|
||||
# First of all we check if the readline is available, by default
|
||||
# it is not in Python default installation on Windows
|
||||
if not readline._readline:
|
||||
return
|
||||
|
||||
if osShell:
|
||||
if completion == AUTOCOMPLETE_TYPE.OS:
|
||||
if Backend.isOs(OS.WINDOWS):
|
||||
# Reference: http://en.wikipedia.org/wiki/List_of_DOS_commands
|
||||
completer = CompleterNG({
|
||||
|
|
|
@ -13,6 +13,7 @@ from lib.core.common import isStackingAvailable
|
|||
from lib.core.common import readInput
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import logger
|
||||
from lib.core.enums import AUTOCOMPLETE_TYPE
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.exception import SqlmapFilePathException
|
||||
from lib.core.exception import SqlmapUnsupportedFeatureException
|
||||
|
@ -116,7 +117,7 @@ class Abstraction(Web, UDF, Xp_cmdshell):
|
|||
infoMsg += "'x' or 'q' and press ENTER"
|
||||
logger.info(infoMsg)
|
||||
|
||||
autoCompletion(osShell=True)
|
||||
autoCompletion(AUTOCOMPLETE_TYPE.OS)
|
||||
|
||||
while True:
|
||||
command = None
|
||||
|
|
|
@ -15,6 +15,7 @@ from lib.core.convert import utf8decode
|
|||
from lib.core.data import conf
|
||||
from lib.core.data import logger
|
||||
from lib.core.dicts import SQL_STATEMENTS
|
||||
from lib.core.enums import AUTOCOMPLETE_TYPE
|
||||
from lib.core.settings import NULL
|
||||
from lib.core.settings import PARAMETER_SPLITTING_REGEX
|
||||
from lib.core.shell import autoCompletion
|
||||
|
@ -73,7 +74,7 @@ class Custom:
|
|||
infoMsg += "'x' or 'q' and press ENTER"
|
||||
logger.info(infoMsg)
|
||||
|
||||
autoCompletion(sqlShell=True)
|
||||
autoCompletion(AUTOCOMPLETE_TYPE.SQL)
|
||||
|
||||
while True:
|
||||
query = None
|
||||
|
|
Loading…
Reference in New Issue
Block a user