Minor improvement

This commit is contained in:
Miroslav Stampar 2019-11-21 15:58:04 +01:00
parent 9fc856b3a6
commit 0a266f602c
4 changed files with 38 additions and 8 deletions

View File

@ -64,19 +64,42 @@ def runGui(parser):
style.theme_create("custom", parent="alt", settings=settings) style.theme_create("custom", parent="alt", settings=settings)
style.theme_use("custom") style.theme_use("custom")
def dummy(): def run():
pass options = {}
for key in window._widgets:
dest, type = key
widget = window._widgets[key]
if hasattr(widget, "get") and not widget.get():
value = None
elif type == "string":
value = widget.get()
elif type == "float":
value = float(widget.get())
elif type == "int":
value = int(widget.get())
else:
value = bool(widget.getint())
options[dest] = value
for option in parser.option_list:
options[option.dest] = defaults.get(option.dest, None)
parser._args = options
window.destroy()
menubar = tkinter.Menu(window) menubar = tkinter.Menu(window)
filemenu = tkinter.Menu(menubar, tearoff=0) filemenu = tkinter.Menu(menubar, tearoff=0)
filemenu.add_command(label="Open", command=dummy, state=tkinter.DISABLED) filemenu.add_command(label="Open", state=tkinter.DISABLED)
filemenu.add_command(label="Save", command=dummy, state=tkinter.DISABLED) filemenu.add_command(label="Save", state=tkinter.DISABLED)
filemenu.add_separator() filemenu.add_separator()
filemenu.add_command(label="Exit", command=window.quit) filemenu.add_command(label="Exit", command=window.quit)
menubar.add_cascade(label="File", menu=filemenu) menubar.add_cascade(label="File", menu=filemenu)
menubar.add_command(label="Run", command=window.quit) menubar.add_command(label="Run", command=run)
helpmenu = tkinter.Menu(menubar, tearoff=0) helpmenu = tkinter.Menu(menubar, tearoff=0)
helpmenu.add_command(label="Official site", command=lambda: webbrowser.open(SITE)) helpmenu.add_command(label="Official site", command=lambda: webbrowser.open(SITE))
@ -88,11 +111,13 @@ def runGui(parser):
menubar.add_cascade(label="Help", menu=helpmenu) menubar.add_cascade(label="Help", menu=helpmenu)
window.config(menu=menubar) window.config(menu=menubar)
window._widgets = {}
notebook = AutoresizableNotebook(window) notebook = AutoresizableNotebook(window)
first = None first = None
frames = {} frames = {}
for group in parser.option_groups: for group in parser.option_groups:
frame = frames[group.title] = tkinter.Frame(notebook, width=200, height=200) frame = frames[group.title] = tkinter.Frame(notebook, width=200, height=200)
notebook.add(frames[group.title], text=group.title) notebook.add(frames[group.title], text=group.title)
@ -122,6 +147,8 @@ def runGui(parser):
first = first or widget first = first or widget
widget.grid(column=1, row=row, sticky=tkinter.W) widget.grid(column=1, row=row, sticky=tkinter.W)
window._widgets[(option.dest, option.type)] = widget
default = defaults.get(option.dest) default = defaults.get(option.dest)
if default: if default:
if hasattr(widget, "insert"): if hasattr(widget, "insert"):

View File

@ -18,7 +18,7 @@ from lib.core.enums import OS
from thirdparty.six import unichr as _unichr from thirdparty.six import unichr as _unichr
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.3.11.91" VERSION = "1.3.11.92"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View File

@ -863,9 +863,11 @@ def cmdLineParser(argv=None):
if "--gui" in argv: if "--gui" in argv:
from lib.core.gui import runGui from lib.core.gui import runGui
runGui(parser) runGui(parser)
if hasattr(parser, "_args"):
return parser._args
elif "--sqlmap-shell" in argv: elif "--sqlmap-shell" in argv:
_createHomeDirectories() _createHomeDirectories()

View File

@ -141,7 +141,8 @@ def main():
banner() banner()
# Store original command line options for possible later restoration # Store original command line options for possible later restoration
cmdLineOptions.update(cmdLineParser().__dict__) args = cmdLineParser()
cmdLineOptions.update(args.__dict__ if hasattr(args, "__dict__") else args)
initOptions(cmdLineOptions) initOptions(cmdLineOptions)
if checkPipedInput(): if checkPipedInput():