Skip to content

Commit 0a331f2

Browse files
committed
Minor update
1 parent 0430f78 commit 0a331f2

4 files changed

Lines changed: 87 additions & 17 deletions

File tree

data/txt/sha256sums.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ ccc4a717e887652b1fcce073d9409d9c59a3b28548c703a9e453d15845f90cd7 lib/core/patch
189189
9bf174058f15d14e24e94f9aaf42df045119d3617c6c54bd2f3af79b462f331d lib/core/replication.py
190190
0b8c38a01bb01f843d94a6c5f2075ee47520d0c4aa799cecea9c3e2c5a4a23a6 lib/core/revision.py
191191
888daba83fd4a34e9503fe21f01fef4cc730e5cde871b1d40e15d4cbc847d56c lib/core/session.py
192-
a6e15ece62113241870feacc9cda691c64be9b849ce2df169b35ee695a517165 lib/core/settings.py
192+
2db950a79f3f8a4bbb0f35731d4e2eef220150961be55d8ba4b1f9565bdd483a lib/core/settings.py
193193
c7804223319e18eb0b8e2cbf0a8b6896d1cefb7b0b1a2e9f1cf826a8a3b56750 lib/core/shell.py
194194
a2e98a94b231432736d6b304fc75525c8b5fdb4768c418387c5b4c1a610dad64 lib/core/subprocessng.py
195195
19f1e3c5e3ba703d28d510cd7a9ab8284d5fbe9df5ce7e77c86e5931571364b7 lib/core/target.py
@@ -249,7 +249,7 @@ da5bcbcda3f667582adf5db8c1b5d511b469ac61b55d387cec66de35720ed718 lib/utils/craw
249249
a94958be0ec3e9d28d8171813a6a90655a9ad7e6aa33c661e8d8ebbfcf208dbb lib/utils/deps.py
250250
b0d8ae8513c1f5ffcaa4bf0398790f26bc2180a6acf07bf5b2c86555bf9113f6 lib/utils/dialect.py
251251
51cfab194cd5b6b24d62706fb79db86c852b9e593f4c55c15b35f175e70c9d75 lib/utils/getch.py
252-
417029b70afe672f3121746a7909887aa996766c92547b4566c50343fff76131 lib/utils/gui.py
252+
3c4ad819589fe4fca303706dc87969273a07a04dee85e23f064b39caf1fb80e9 lib/utils/gui.py
253253
972c5db9c9e30ac0f91c0f8d4df4531d0304e151dac99f1399c37c952ba9f935 lib/utils/har.py
254254
0cd3860c03e39bacd1d0fe4cf1a0c605de48ff82f70441319f21d47e38e7e3a9 lib/utils/hashdb.py
255255
71a66ff766a2921106770b26acff380de469222dc893816a7b970b384c927666 lib/utils/hash.py
@@ -264,7 +264,7 @@ de4be7e291db0962cd59f9c04b3f7259f846e315df1fd9b323954f89fae0b2db lib/utils/sear
264264
8258d0f54ad94e6101934971af4e55d5540f217c40ddcc594e2fba837b856d35 lib/utils/sgmllib.py
265265
2760c4b82382e501f16bb98edec9531f46e5b286fbf004b346545b9b62f84824 lib/utils/sqlalchemy.py
266266
f0e5525a92fe971defc8f74c27942ff9138b1e8251f2e0d9a8bd59285b656084 lib/utils/timeout.py
267-
f19a6761284e689fca7d2e07120193f7b9c4f9c506ecaf87e82c2e97cca4db63 lib/utils/tui.py
267+
f28693d5d2783f3d5069b1df3d12e01730ce783f4a40ef31656ef2c879d2f027 lib/utils/tui.py
268268
e430db49aa768ff2cdba76932e30871c366054599c44d91580dde459ab9b6fef lib/utils/versioncheck.py
269269
b3c5109394f6c3cdd73a524a737b36cca7ecc56619f2a5f801eb1e7f1bfdb78b lib/utils/wafbypass.py
270270
1b439fc59fd202c21c74978ed9f36d1c309533226c77907eae159461525f9fef lib/utils/xrange.py

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 import six
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.10.6.158"
23+
VERSION = "1.10.6.159"
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/gui.py

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ def __init__(self, parser, tk, ttk, scrolledtext, messagebox, filedialog, font):
208208
self.inners = {} # name -> scrollable inner frame (populated lazily)
209209
self.builders = {} # name -> callable that populates the inner frame
210210
self.built = set() # names whose content has been built
211+
self.badges = {} # name -> sidebar count badge label
212+
self.sectionDests = {} # name -> [option dests in that section]
211213
self.paneOrder = [] # nav order, for Up/Down navigation
212214
self.currentPane = None
213215
self.process = None
@@ -329,6 +331,7 @@ def _buildLayout(self):
329331
cmdBar = self.ttk.Frame(self.window, style="Bar.TFrame", padding=(20, 8))
330332
cmdBar.pack(fill=tk.X)
331333
self.ttk.Label(cmdBar, text="Command:", style="Hint.TLabel").pack(side=tk.LEFT, padx=(0, 8))
334+
self.ttk.Button(cmdBar, text="Copy", command=self._copyCommand, takefocus=False).pack(side=tk.RIGHT, padx=(8, 0))
332335
self.command = tk.StringVar(value="sqlmap.py")
333336
cmdEntry = tk.Entry(cmdBar, textvariable=self.command, font=self.fonts["mono"],
334337
bg="#ffffff", fg=PALETTE["blue"], readonlybackground="#ffffff",
@@ -352,6 +355,12 @@ def _buildLayout(self):
352355
self.window.bind("<Up>", lambda e: self._navKey(-1))
353356
for seq in ("<MouseWheel>", "<Button-4>", "<Button-5>"):
354357
self.window.bind_all(seq, self._onWheel)
358+
self.window.bind("<F5>", lambda e: self.run())
359+
self.window.bind("<Control-r>", lambda e: self.run())
360+
self.window.bind("<Control-Return>", lambda e: self.run())
361+
self.window.bind("<Control-l>", lambda e: self._focusTarget())
362+
self.window.bind("<Control-s>", lambda e: self.saveConfigDialog())
363+
self.window.bind("<Control-o>", lambda e: self.loadConfig())
355364
self._enableSelectAll()
356365
self._tickStats()
357366
self._prebuildPanes()
@@ -586,14 +595,17 @@ def _addPane(self, name, navText):
586595
icon = tk.Canvas(row, width=22, height=22, highlightthickness=0, borderwidth=0, background=p["mantle"])
587596
icon.pack(side=tk.LEFT, padx=(13, 0), pady=8)
588597
self._drawIcon(icon, name, self._iconColor(name))
598+
badge = tk.Label(row, text="", background=p["mantle"], foreground=p["blue"], font=self.fonts["small"])
599+
badge.pack(side=tk.RIGHT, padx=(0, 12))
600+
self.badges[name] = badge
589601
lab = tk.Label(row, text=navText, background=p["mantle"], foreground=p["subtext"],
590602
font=self.fonts["nav"], anchor="w", padx=10, pady=9)
591603
lab.pack(side=tk.LEFT, fill=tk.X, expand=True)
592-
for w in (row, lab, strip, icon):
604+
for w in (row, lab, strip, icon, badge):
593605
w.bind("<Button-1>", lambda e, n=name: self._selectPane(n))
594606
w.bind("<Enter>", lambda e, n=name: self._navHover(n, True))
595607
w.bind("<Leave>", lambda e, n=name: self._navHover(n, False))
596-
self.navItems[name] = (row, strip, icon, lab)
608+
self.navItems[name] = (row, strip, icon, lab, badge)
597609
self.paneOrder.append(name)
598610

599611
outer = self.ttk.Frame(self.content, style="Card.TFrame")
@@ -618,8 +630,8 @@ def _navHover(self, name, entering):
618630
if name == self.currentPane:
619631
return
620632
bg = PALETTE["surface2"] if entering else PALETTE["mantle"]
621-
row, strip, icon, lab = self.navItems[name]
622-
for w in (row, strip, icon, lab):
633+
row, strip, icon, lab, badge = self.navItems[name]
634+
for w in (row, strip, icon, lab, badge):
623635
w.configure(background=bg)
624636

625637
def _navKey(self, delta):
@@ -643,16 +655,18 @@ def _selectPane(self, name):
643655
p = PALETTE
644656
if self.currentPane:
645657
self.panes[self.currentPane].pack_forget()
646-
row, strip, icon, lab = self.navItems[self.currentPane]
658+
row, strip, icon, lab, badge = self.navItems[self.currentPane]
647659
for w in (row, strip, icon):
648660
w.configure(background=p["mantle"])
649661
lab.configure(background=p["mantle"], foreground=p["text"], font=self.fonts["nav"])
662+
badge.configure(background=p["mantle"], foreground=p["blue"])
650663
self._drawIcon(icon, self.currentPane, self._iconColor(self.currentPane))
651664
self.panes[name].pack(expand=True, fill=self.tk.BOTH)
652-
row, strip, icon, lab = self.navItems[name]
665+
row, strip, icon, lab, badge = self.navItems[name]
653666
for w in (row, strip, icon):
654667
w.configure(background=p["blue"])
655668
lab.configure(background=p["blue"], foreground="#ffffff", font=self.fonts["bodyBold"])
669+
badge.configure(background=p["blue"], foreground="#ffffff")
656670
self._drawIcon(icon, name, "#ffffff")
657671
self.currentPane = name
658672
self._ensureNavVisible(name)
@@ -704,6 +718,7 @@ def _onWheel(self, event):
704718
def _buildQuickStartPane(self):
705719
name = "Quick start"
706720
self._addPane(name, name)
721+
self.sectionDests[name] = [_ for _ in QUICK_START_DESTS if _ in self.optionByDest]
707722

708723
def build(inner):
709724
self.ttk.Label(inner, text="Quick start", style="Pane.TLabel").grid(row=0, column=0, columnspan=2, sticky="w")
@@ -721,6 +736,7 @@ def build(inner):
721736
def _buildGroupPane(self, group):
722737
title = _groupTitle(group)
723738
self._addPane(title, NAV_ALIASES.get(title, title))
739+
self.sectionDests[title] = [_optDest(_) for _ in _groupOptions(group) if _optDest(_)]
724740

725741
def build(inner, group=group, title=title):
726742
self.ttk.Label(inner, text=title, style="Pane.TLabel").grid(row=0, column=0, columnspan=2, sticky="w")
@@ -806,19 +822,25 @@ def _center(self, window, width=None, height=None):
806822
window.geometry("%dx%d+%d+%d" % (width, height, x, y))
807823

808824
def _updateStats(self):
809-
count = 0
825+
setDests = set()
810826
for dest, (otype, var) in self.widgets.items():
811827
try:
812828
if otype == "bool":
813829
if var.get():
814-
count += 1
830+
setDests.add(dest)
815831
else:
816832
raw = var.get()
817833
if raw not in (None, "") and str(raw) != str(defaults.get(dest, "")):
818-
count += 1
834+
setDests.add(dest)
819835
except Exception:
820836
pass
837+
count = len(setDests)
821838
self.stat.set("%d option%s set" % (count, "" if count == 1 else "s"))
839+
for name, dests in self.sectionDests.items():
840+
badge = self.badges.get(name)
841+
if badge is not None:
842+
hits = sum(1 for _ in dests if _ in setDests)
843+
badge.configure(text=(str(hits) if hits else ""))
822844

823845
def _buildCommandString(self):
824846
parts = ["sqlmap.py"]
@@ -850,6 +872,22 @@ def _tickStats(self):
850872
self.command.set(self._buildCommandString())
851873
self.window.after(1200, self._tickStats)
852874

875+
def _copyCommand(self):
876+
try:
877+
self.window.clipboard_clear()
878+
self.window.clipboard_append(self.command.get())
879+
self.hint.set("Command copied to clipboard")
880+
except Exception:
881+
pass
882+
883+
def _focusTarget(self):
884+
try:
885+
self.targetEntry.focus_set()
886+
self.targetEntry.select_range(0, "end")
887+
except Exception:
888+
pass
889+
return "break"
890+
853891
def _collectConfig(self):
854892
config = {}
855893
for dest, (otype, var) in self.widgets.items():

lib/utils/tui.py

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,37 @@ def _draw_tabs(self):
260260

261261
x += len(tab_text) + 1
262262

263+
def _build_command(self):
264+
"""Assemble the equivalent sqlmap command line from the current field values"""
265+
parts = ["sqlmap.py"]
266+
for opt in self.all_options:
267+
flag = opt['label'].split(',')[0].strip() if opt['label'] else ""
268+
if not flag:
269+
continue
270+
value = opt['value']
271+
if opt['type'] == 'bool':
272+
if value:
273+
parts.append(flag)
274+
elif value not in (None, "") and str(value) != str(opt.get('default') or ""):
275+
text = str(value)
276+
if ' ' in text or '"' in text:
277+
text = '"%s"' % text.replace('"', '\\"')
278+
parts.append("%s %s" % (flag, text))
279+
return " ".join(parts)
280+
281+
def _draw_command(self):
282+
"""Live preview of the command being built, just above the footer"""
283+
height, width = self.stdscr.getmaxyx()
284+
cmd = "$ " + self._build_command()
285+
if len(cmd) > width - 2:
286+
cmd = cmd[:width - 5] + "..."
287+
try:
288+
self.stdscr.attron(curses.color_pair(8) | curses.A_BOLD)
289+
self.stdscr.addstr(height - 2, 1, cmd.ljust(width - 2)[:width - 2])
290+
self.stdscr.attroff(curses.color_pair(8) | curses.A_BOLD)
291+
except curses.error:
292+
pass
293+
263294
def _draw_footer(self):
264295
"""Draw the footer with help text"""
265296
height, width = self.stdscr.getmaxyx()
@@ -303,12 +334,12 @@ def _draw_current_tab(self):
303334
pass
304335
y += 1
305336

306-
# Draw options
337+
# Draw options (leave height-2 for the command preview, height-1 for the footer)
307338
visible_start = self.scroll_offset
308-
visible_end = visible_start + (height - y - 2)
339+
visible_end = visible_start + (height - y - 3)
309340

310341
for i, option in enumerate(tab['options'][visible_start:visible_end], visible_start):
311-
if y >= height - 2:
342+
if y >= height - 3:
312343
break
313344

314345
is_selected = (i == self.current_field)
@@ -374,7 +405,7 @@ def _draw_current_tab(self):
374405
if len(tab['options']) > visible_end - visible_start:
375406
try:
376407
self.stdscr.attron(curses.color_pair(6))
377-
self.stdscr.addstr(height - 2, width - 10, "[More...]")
408+
self.stdscr.addstr(height - 3, width - 10, "[More...]")
378409
self.stdscr.attroff(curses.color_pair(6))
379410
except:
380411
pass
@@ -828,6 +859,7 @@ def run(self):
828859
self._draw_header()
829860
self._draw_tabs()
830861
self._draw_current_tab()
862+
self._draw_command()
831863
self._draw_footer()
832864

833865
self.stdscr.refresh()

0 commit comments

Comments
 (0)