mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-02 20:54:13 +03:00
Patches #1530
This commit is contained in:
parent
bc215d1b19
commit
07b1407345
|
@ -7,7 +7,6 @@ See the file 'doc/COPYING' for copying permission
|
||||||
|
|
||||||
import atexit
|
import atexit
|
||||||
import os
|
import os
|
||||||
import rlcompleter
|
|
||||||
|
|
||||||
from lib.core import readlineng as readline
|
from lib.core import readlineng as readline
|
||||||
from lib.core.data import logger
|
from lib.core.data import logger
|
||||||
|
@ -16,6 +15,29 @@ from lib.core.enums import AUTOCOMPLETE_TYPE
|
||||||
from lib.core.enums import OS
|
from lib.core.enums import OS
|
||||||
from lib.core.settings import MAX_HISTORY_LENGTH
|
from lib.core.settings import MAX_HISTORY_LENGTH
|
||||||
|
|
||||||
|
try:
|
||||||
|
import rlcompleter
|
||||||
|
|
||||||
|
class CompleterNG(rlcompleter.Completer):
|
||||||
|
def global_matches(self, text):
|
||||||
|
"""
|
||||||
|
Compute matches when text is a simple name.
|
||||||
|
Return a list of all names currently defined in self.namespace
|
||||||
|
that match.
|
||||||
|
"""
|
||||||
|
|
||||||
|
matches = []
|
||||||
|
n = len(text)
|
||||||
|
|
||||||
|
for ns in (self.namespace,):
|
||||||
|
for word in ns:
|
||||||
|
if word[:n] == text:
|
||||||
|
matches.append(word)
|
||||||
|
|
||||||
|
return matches
|
||||||
|
except:
|
||||||
|
readline._readline = None
|
||||||
|
|
||||||
def readlineAvailable():
|
def readlineAvailable():
|
||||||
"""
|
"""
|
||||||
Check if the readline is available. By default
|
Check if the readline is available. By default
|
||||||
|
@ -74,24 +96,6 @@ def loadHistory(completion=None):
|
||||||
warnMsg = "there was a problem loading the history file '%s' (%s)" % (historyPath, msg)
|
warnMsg = "there was a problem loading the history file '%s' (%s)" % (historyPath, msg)
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
|
|
||||||
class CompleterNG(rlcompleter.Completer):
|
|
||||||
def global_matches(self, text):
|
|
||||||
"""
|
|
||||||
Compute matches when text is a simple name.
|
|
||||||
Return a list of all names currently defined in self.namespace
|
|
||||||
that match.
|
|
||||||
"""
|
|
||||||
|
|
||||||
matches = []
|
|
||||||
n = len(text)
|
|
||||||
|
|
||||||
for ns in (self.namespace,):
|
|
||||||
for word in ns:
|
|
||||||
if word[:n] == text:
|
|
||||||
matches.append(word)
|
|
||||||
|
|
||||||
return matches
|
|
||||||
|
|
||||||
def autoCompletion(completion=None, os=None, commands=None):
|
def autoCompletion(completion=None, os=None, commands=None):
|
||||||
if not readlineAvailable():
|
if not readlineAvailable():
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user