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

Skip to content

Commit 0a266f6

Browse files
committed
Minor improvement
1 parent 9fc856b commit 0a266f6

4 files changed

Lines changed: 38 additions & 8 deletions

File tree

lib/core/gui.py

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,42 @@ def _on_tab_changed(self,event):
6464
style.theme_create("custom", parent="alt", settings=settings)
6565
style.theme_use("custom")
6666

67-
def dummy():
68-
pass
67+
def run():
68+
options = {}
69+
70+
for key in window._widgets:
71+
dest, type = key
72+
widget = window._widgets[key]
73+
74+
if hasattr(widget, "get") and not widget.get():
75+
value = None
76+
elif type == "string":
77+
value = widget.get()
78+
elif type == "float":
79+
value = float(widget.get())
80+
elif type == "int":
81+
value = int(widget.get())
82+
else:
83+
value = bool(widget.getint())
84+
85+
options[dest] = value
86+
87+
for option in parser.option_list:
88+
options[option.dest] = defaults.get(option.dest, None)
89+
90+
parser._args = options
91+
window.destroy()
6992

7093
menubar = tkinter.Menu(window)
7194

7295
filemenu = tkinter.Menu(menubar, tearoff=0)
73-
filemenu.add_command(label="Open", command=dummy, state=tkinter.DISABLED)
74-
filemenu.add_command(label="Save", command=dummy, state=tkinter.DISABLED)
96+
filemenu.add_command(label="Open", state=tkinter.DISABLED)
97+
filemenu.add_command(label="Save", state=tkinter.DISABLED)
7598
filemenu.add_separator()
7699
filemenu.add_command(label="Exit", command=window.quit)
77100
menubar.add_cascade(label="File", menu=filemenu)
78101

79-
menubar.add_command(label="Run", command=window.quit)
102+
menubar.add_command(label="Run", command=run)
80103

81104
helpmenu = tkinter.Menu(menubar, tearoff=0)
82105
helpmenu.add_command(label="Official site", command=lambda: webbrowser.open(SITE))
@@ -88,11 +111,13 @@ def dummy():
88111
menubar.add_cascade(label="Help", menu=helpmenu)
89112

90113
window.config(menu=menubar)
114+
window._widgets = {}
91115

92116
notebook = AutoresizableNotebook(window)
93117

94118
first = None
95119
frames = {}
120+
96121
for group in parser.option_groups:
97122
frame = frames[group.title] = tkinter.Frame(notebook, width=200, height=200)
98123
notebook.add(frames[group.title], text=group.title)
@@ -122,6 +147,8 @@ def dummy():
122147
first = first or widget
123148
widget.grid(column=1, row=row, sticky=tkinter.W)
124149

150+
window._widgets[(option.dest, option.type)] = widget
151+
125152
default = defaults.get(option.dest)
126153
if default:
127154
if hasattr(widget, "insert"):

lib/core/settings.py

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

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

lib/parse/cmdline.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,9 +863,11 @@ def _format_action_invocation(self, action):
863863

864864
if "--gui" in argv:
865865
from lib.core.gui import runGui
866-
867866
runGui(parser)
868867

868+
if hasattr(parser, "_args"):
869+
return parser._args
870+
869871
elif "--sqlmap-shell" in argv:
870872
_createHomeDirectories()
871873

sqlmap.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ def main():
141141
banner()
142142

143143
# Store original command line options for possible later restoration
144-
cmdLineOptions.update(cmdLineParser().__dict__)
144+
args = cmdLineParser()
145+
cmdLineOptions.update(args.__dict__ if hasattr(args, "__dict__") else args)
145146
initOptions(cmdLineOptions)
146147

147148
if checkPipedInput():

0 commit comments

Comments
 (0)