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

Skip to content

Commit 5fae5c3

Browse files
committed
Minor improvement of sqlmapapi client
1 parent 590480d commit 5fae5c3

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty.six import unichr as _unichr
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.5.9.2"
23+
VERSION = "1.5.9.3"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/utils/api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from lib.core.common import getSafeExString
2424
from lib.core.common import openFile
2525
from lib.core.common import saveConfig
26+
from lib.core.common import setColor
2627
from lib.core.common import unArrayizeValue
2728
from lib.core.compat import xrange
2829
from lib.core.convert import decodeBase64
@@ -778,14 +779,16 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, username=Non
778779
return
779780

780781
commands = ("help", "new", "use", "data", "log", "status", "option", "stop", "kill", "list", "flush", "version", "exit", "bye", "quit")
782+
colors = ('red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'lightgrey', 'lightred', 'lightgreen', 'lightyellow', 'lightblue', 'lightmagenta', 'lightcyan')
781783
autoCompletion(AUTOCOMPLETE_TYPE.API, commands=commands)
782784

783785
taskid = None
784786
logger.info("Type 'help' or '?' for list of available commands")
785787

786788
while True:
787789
try:
788-
command = _input("api%s> " % (" (%s)" % taskid if taskid else "")).strip()
790+
color = colors[int(taskid or "0", 16) % len(colors)]
791+
command = _input("api%s> " % (" (%s)" % setColor(taskid, color) if taskid else "")).strip()
789792
command = re.sub(r"\A(\w+)", lambda match: match.group(1).lower(), command)
790793
except (EOFError, KeyboardInterrupt):
791794
print()

0 commit comments

Comments
 (0)