mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-28 20:43:49 +03:00
Minor update
This commit is contained in:
parent
5013f767a1
commit
737c727e56
|
@ -6,10 +6,11 @@ See the file 'LICENSE' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import tkinter as tk
|
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
|
from lib.core.common import getSafeExString
|
||||||
from lib.core.defaults import defaults
|
from lib.core.defaults import defaults
|
||||||
|
from lib.core.exception import SqlmapMissingDependence
|
||||||
from lib.core.settings import DEV_EMAIL_ADDRESS
|
from lib.core.settings import DEV_EMAIL_ADDRESS
|
||||||
from lib.core.settings import ISSUES_PAGE
|
from lib.core.settings import ISSUES_PAGE
|
||||||
from lib.core.settings import GIT_PAGE
|
from lib.core.settings import GIT_PAGE
|
||||||
|
@ -17,16 +18,21 @@ from lib.core.settings import SITE
|
||||||
from lib.core.settings import VERSION_STRING
|
from lib.core.settings import VERSION_STRING
|
||||||
from lib.core.settings import WIKI_PAGE
|
from lib.core.settings import WIKI_PAGE
|
||||||
from thirdparty.six.moves import tkinter_messagebox as _tkinter_messagebox
|
from thirdparty.six.moves import tkinter_messagebox as _tkinter_messagebox
|
||||||
from tkinter import ttk
|
|
||||||
|
|
||||||
def runGui(parser):
|
def runGui(parser):
|
||||||
|
try:
|
||||||
|
import tkinter
|
||||||
|
import tkinter.ttk
|
||||||
|
except ImportError as ex:
|
||||||
|
raise SqlmapMissingDependence("missing dependence ('%s')" % getSafeExString(ex))
|
||||||
|
|
||||||
# Reference: https://www.reddit.com/r/learnpython/comments/985umy/limit_user_input_to_only_int_with_tkinter/e4dj9k9?utm_source=share&utm_medium=web2x
|
# Reference: https://www.reddit.com/r/learnpython/comments/985umy/limit_user_input_to_only_int_with_tkinter/e4dj9k9?utm_source=share&utm_medium=web2x
|
||||||
class ConstrainedEntry(tk.Entry):
|
class ConstrainedEntry(tkinter.Entry):
|
||||||
def __init__(self, master=None, **kwargs):
|
def __init__(self, master=None, **kwargs):
|
||||||
self.var = tk.StringVar()
|
self.var = tkinter.StringVar()
|
||||||
self.regex = kwargs["regex"]
|
self.regex = kwargs["regex"]
|
||||||
del kwargs["regex"]
|
del kwargs["regex"]
|
||||||
tk.Entry.__init__(self, master, textvariable=self.var, **kwargs)
|
tkinter.Entry.__init__(self, master, textvariable=self.var, **kwargs)
|
||||||
self.old_value = ''
|
self.old_value = ''
|
||||||
self.var.trace('w', self.check)
|
self.var.trace('w', self.check)
|
||||||
self.get, self.set = self.var.get, self.var.set
|
self.get, self.set = self.var.get, self.var.set
|
||||||
|
@ -38,9 +44,9 @@ def runGui(parser):
|
||||||
self.set(self.old_value)
|
self.set(self.old_value)
|
||||||
|
|
||||||
# Reference: https://code.activestate.com/recipes/580726-tkinter-notebook-that-fits-to-the-height-of-every-/
|
# Reference: https://code.activestate.com/recipes/580726-tkinter-notebook-that-fits-to-the-height-of-every-/
|
||||||
class AutoresizableNotebook(ttk.Notebook):
|
class AutoresizableNotebook(tkinter.ttk.Notebook):
|
||||||
def __init__(self, master=None, **kw):
|
def __init__(self, master=None, **kw):
|
||||||
ttk.Notebook.__init__(self, master, **kw)
|
tkinter.ttk.Notebook.__init__(self, master, **kw)
|
||||||
self.bind("<<NotebookTabChanged>>", self._on_tab_changed)
|
self.bind("<<NotebookTabChanged>>", self._on_tab_changed)
|
||||||
|
|
||||||
def _on_tab_changed(self,event):
|
def _on_tab_changed(self,event):
|
||||||
|
@ -49,11 +55,11 @@ def runGui(parser):
|
||||||
tab = event.widget.nametowidget(event.widget.select())
|
tab = event.widget.nametowidget(event.widget.select())
|
||||||
event.widget.configure(height=tab.winfo_reqheight())
|
event.widget.configure(height=tab.winfo_reqheight())
|
||||||
|
|
||||||
window = tk.Tk()
|
window = tkinter.Tk()
|
||||||
window.title(VERSION_STRING)
|
window.title(VERSION_STRING)
|
||||||
|
|
||||||
# Reference: https://www.holadevs.com/pregunta/64750/change-selected-tab-color-in-ttknotebook
|
# Reference: https://www.holadevs.com/pregunta/64750/change-selected-tab-color-in-ttknotebook
|
||||||
style = ttk.Style()
|
style = tkinter.ttk.Style()
|
||||||
settings = {"TNotebook.Tab": {"configure": {"padding": [5, 1], "background": "#fdd57e" }, "map": {"background": [("selected", "#C70039"), ("active", "#fc9292")], "foreground": [("selected", "#ffffff"), ("active", "#000000")]}}}
|
settings = {"TNotebook.Tab": {"configure": {"padding": [5, 1], "background": "#fdd57e" }, "map": {"background": [("selected", "#C70039"), ("active", "#fc9292")], "foreground": [("selected", "#ffffff"), ("active", "#000000")]}}}
|
||||||
style.theme_create("custom", parent="alt", settings=settings)
|
style.theme_create("custom", parent="alt", settings=settings)
|
||||||
style.theme_use("custom")
|
style.theme_use("custom")
|
||||||
|
@ -61,18 +67,18 @@ def runGui(parser):
|
||||||
def dummy():
|
def dummy():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
menubar = tk.Menu(window)
|
menubar = tkinter.Menu(window)
|
||||||
|
|
||||||
filemenu = tk.Menu(menubar, tearoff=0)
|
filemenu = tkinter.Menu(menubar, tearoff=0)
|
||||||
filemenu.add_command(label="Open", command=dummy, state=tk.DISABLED)
|
filemenu.add_command(label="Open", command=dummy, state=tkinter.DISABLED)
|
||||||
filemenu.add_command(label="Save", command=dummy, state=tk.DISABLED)
|
filemenu.add_command(label="Save", command=dummy, 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=window.quit)
|
||||||
|
|
||||||
helpmenu = tk.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))
|
||||||
helpmenu.add_command(label="Github pages", command=lambda: webbrowser.open(GIT_PAGE))
|
helpmenu.add_command(label="Github pages", command=lambda: webbrowser.open(GIT_PAGE))
|
||||||
helpmenu.add_command(label="Wiki pages", command=lambda: webbrowser.open(WIKI_PAGE))
|
helpmenu.add_command(label="Wiki pages", command=lambda: webbrowser.open(WIKI_PAGE))
|
||||||
|
@ -88,44 +94,44 @@ def runGui(parser):
|
||||||
first = None
|
first = None
|
||||||
frames = {}
|
frames = {}
|
||||||
for group in parser.option_groups:
|
for group in parser.option_groups:
|
||||||
frame = frames[group.title] = tk.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)
|
||||||
|
|
||||||
tk.Label(frame).grid(column=0, row=0, sticky=tk.W)
|
tkinter.Label(frame).grid(column=0, row=0, sticky=tkinter.W)
|
||||||
|
|
||||||
row = 1
|
row = 1
|
||||||
if group.get_description():
|
if group.get_description():
|
||||||
tk.Label(frame, text="%s:" % group.get_description()).grid(column=0, row=1, columnspan=3, sticky=tk.W)
|
tkinter.Label(frame, text="%s:" % group.get_description()).grid(column=0, row=1, columnspan=3, sticky=tkinter.W)
|
||||||
tk.Label(frame).grid(column=0, row=2, sticky=tk.W)
|
tkinter.Label(frame).grid(column=0, row=2, sticky=tkinter.W)
|
||||||
row += 2
|
row += 2
|
||||||
|
|
||||||
for option in group.option_list:
|
for option in group.option_list:
|
||||||
tk.Label(frame, text="%s " % parser.formatter._format_option_strings(option)).grid(column=0, row=row, sticky=tk.W)
|
tkinter.Label(frame, text="%s " % parser.formatter._format_option_strings(option)).grid(column=0, row=row, sticky=tkinter.W)
|
||||||
|
|
||||||
if option.type == "string":
|
if option.type == "string":
|
||||||
widget = tk.Entry(frame)
|
widget = tkinter.Entry(frame)
|
||||||
elif option.type == "float":
|
elif option.type == "float":
|
||||||
widget = ConstrainedEntry(frame, regex=r"\A\d*\.?\d*\Z")
|
widget = ConstrainedEntry(frame, regex=r"\A\d*\.?\d*\Z")
|
||||||
elif option.type == "int":
|
elif option.type == "int":
|
||||||
widget = ConstrainedEntry(frame, regex=r"\A\d*\Z")
|
widget = ConstrainedEntry(frame, regex=r"\A\d*\Z")
|
||||||
else:
|
else:
|
||||||
var = tk.IntVar()
|
var = tkinter.IntVar()
|
||||||
widget = tk.Checkbutton(frame, variable=var)
|
widget = tkinter.Checkbutton(frame, variable=var)
|
||||||
widget.var = var
|
widget.var = var
|
||||||
|
|
||||||
first = first or widget
|
first = first or widget
|
||||||
widget.grid(column=1, row=row, sticky=tk.W)
|
widget.grid(column=1, row=row, sticky=tkinter.W)
|
||||||
|
|
||||||
default = defaults.get(option.dest)
|
default = defaults.get(option.dest)
|
||||||
if default:
|
if default:
|
||||||
if hasattr(widget, "insert"):
|
if hasattr(widget, "insert"):
|
||||||
widget.insert(0, default)
|
widget.insert(0, default)
|
||||||
|
|
||||||
tk.Label(frame, text=" %s" % option.help).grid(column=2, row=row, sticky=tk.W)
|
tkinter.Label(frame, text=" %s" % option.help).grid(column=2, row=row, sticky=tkinter.W)
|
||||||
|
|
||||||
row += 1
|
row += 1
|
||||||
|
|
||||||
tk.Label(frame).grid(column=0, row=row, sticky=tk.W)
|
tkinter.Label(frame).grid(column=0, row=row, sticky=tkinter.W)
|
||||||
|
|
||||||
notebook.pack(expand=1, fill="both")
|
notebook.pack(expand=1, fill="both")
|
||||||
notebook.enable_traversal()
|
notebook.enable_traversal()
|
||||||
|
|
|
@ -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.89"
|
VERSION = "1.3.11.90"
|
||||||
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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user