Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 57eb193

Browse files
committed
Minor code refactoring
1 parent 45f5548 commit 57eb193

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

lib/core/enums.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,3 +338,7 @@ class AUTH_TYPE:
338338
DIGEST = "digest"
339339
NTLM = "ntlm"
340340
PKI = "pki"
341+
342+
class AUTOCOMPLETE_TYPE:
343+
SQL = 0
344+
OS = 1

lib/core/shell.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from lib.core.common import Backend
1414
from lib.core.data import logger
1515
from lib.core.data import paths
16+
from lib.core.enums import AUTOCOMPLETE_TYPE
1617
from lib.core.enums import OS
1718

1819
def saveHistory():
@@ -47,13 +48,13 @@ def global_matches(self, text):
4748

4849
return matches
4950

50-
def autoCompletion(sqlShell=False, osShell=False):
51+
def autoCompletion(completion=None):
5152
# First of all we check if the readline is available, by default
5253
# it is not in Python default installation on Windows
5354
if not readline._readline:
5455
return
5556

56-
if osShell:
57+
if completion == AUTOCOMPLETE_TYPE.OS:
5758
if Backend.isOs(OS.WINDOWS):
5859
# Reference: http://en.wikipedia.org/wiki/List_of_DOS_commands
5960
completer = CompleterNG({

lib/takeover/abstraction.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from lib.core.common import readInput
1414
from lib.core.data import conf
1515
from lib.core.data import logger
16+
from lib.core.enums import AUTOCOMPLETE_TYPE
1617
from lib.core.enums import DBMS
1718
from lib.core.exception import SqlmapFilePathException
1819
from lib.core.exception import SqlmapUnsupportedFeatureException
@@ -116,7 +117,7 @@ def shell(self):
116117
infoMsg += "'x' or 'q' and press ENTER"
117118
logger.info(infoMsg)
118119

119-
autoCompletion(osShell=True)
120+
autoCompletion(AUTOCOMPLETE_TYPE.OS)
120121

121122
while True:
122123
command = None

plugins/generic/custom.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from lib.core.data import conf
1616
from lib.core.data import logger
1717
from lib.core.dicts import SQL_STATEMENTS
18+
from lib.core.enums import AUTOCOMPLETE_TYPE
1819
from lib.core.settings import NULL
1920
from lib.core.settings import PARAMETER_SPLITTING_REGEX
2021
from lib.core.shell import autoCompletion
@@ -73,7 +74,7 @@ def sqlShell(self):
7374
infoMsg += "'x' or 'q' and press ENTER"
7475
logger.info(infoMsg)
7576

76-
autoCompletion(sqlShell=True)
77+
autoCompletion(AUTOCOMPLETE_TYPE.SQL)
7778

7879
while True:
7980
query = None

0 commit comments

Comments
 (0)