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