def build_page3(self, parent): p = Panel(parent) m = self.m # 多行文本框的默认size太小了 # 默认高度太低, 不指定个高度, 会报 滚动条相关的size 警告 m._page3_log_view.Create(p, size = (-1, 300), style = wx.TE_MULTILINE | wx.TE_READONLY) # self._handlers.clear_log_view_buffer(None) grid = GridSizer(1, 3, 0, 0) m._page3_read_target_btn.Create(p, label = '查看target文件') m._page3_clear_btn.Create(p, label = '清空(&C)') m._page3_read_log_btn.Create(p, label = '查看log文件') m._page3_read_target_btn.Bind(EVT_BUTTON, self._handlers.read_target_file) m._page3_clear_btn.Bind(EVT_BUTTON, self._handlers.clear_log_view_buffer) m._page3_read_log_btn.Bind(EVT_BUTTON, self._handlers.read_log_file) grid.Add(m._page3_read_target_btn, flag = ALIGN_CENTER) grid.Add(m._page3_clear_btn, flag = ALIGN_CENTER) grid.Add(m._page3_read_log_btn, flag = ALIGN_CENTER) vbox = BoxSizer(VERTICAL) vbox.Add(m._page3_log_view, proportion = 1, flag = EXPAND | ALL, border = 10) vbox.Add(grid, flag = EXPAND) p.SetSizerAndFit(vbox) return p
def build_page6(self, parent): p = Panel(parent) _version = '0.3.3.1' _timestamp = '2021-01-31 05:12:52' _url_self = 'https://github.com/needle-wang/sqlmap-wx' _url_tutorial1 = 'https://wiki.wxpython.org/' _url_tutorial2 = 'http://zetcode.com/wxpython/' _url_api = 'https://wxpython.org/Phoenix/docs/html/index.html' _url_idea = 'https://github.com/kxcode' _about_str = f''' 1. Website: {_url_self} VERSION: {_version} {_timestamp} required: python3.6+, wxPython4.0+, requests, sqlmap\n 2. use wxPython4 to recode sqlmap-gtk(driven by PyGObject) 3. thanks to the idea from sqm(by python2 + tkinter), author: KINGX, {_url_idea}\n 4. wxPython tutorial: {_url_tutorial1} {_url_tutorial2} 5. wxPython API: {_url_api} ''' hbox = BoxSizer() _page6_about = st(p, label = _about_str) # 完全居中! hbox.Add(_page6_about, flag = ALIGN_CENTER) vbox = BoxSizer(VERTICAL) vbox.Add(hbox, proportion = 1, flag = ALIGN_CENTER) p.SetSizerAndFit(vbox) return p
def build_page1(self, parent): p = Panel(parent) m = self.m # sqlmap命令语句 cmd_area = StaticBoxSizer(VERTICAL, p, 'A.收集选项 的结果显示在这:') _cmd_area = cmd_area.GetStaticBox() m._cmd_entry.Create(_cmd_area) cmd_area.Add(m._cmd_entry, flag = EXPAND) # 主构造区 self._notebook = Notebook(p, m, self._handlers) # 构造与执行 和 改善ui的使用体验 self.btn_grid = GridSizer(1, 4, 0, 0) _build_button = btn(p, label = 'A.收集选项(A)') _unselect_all_btn = btn(p, label = '反选所有复选框(S)') _clear_all_entry = btn(p, label = '清空所有输入框(D)') _build_button.Bind(EVT_BUTTON, self._handlers.build_all) _unselect_all_btn.Bind(EVT_BUTTON, self.unselect_all_ckbtn) _clear_all_entry.Bind(EVT_BUTTON, self.clear_all_entry) _run_button = btn(p, label = 'B.开始(F)') _run_button.Bind(EVT_BUTTON, self._handlers.run_cmdline) self.btn_grid.Add(_build_button, flag = ALIGN_CENTER) self.btn_grid.Add(_unselect_all_btn, flag = ALIGN_CENTER) self.btn_grid.Add(_clear_all_entry, flag = ALIGN_CENTER) self.btn_grid.Add(_run_button, flag = ALIGN_CENTER) vbox = BoxSizer(VERTICAL) vbox.Add(cmd_area, flag = EXPAND) vbox.Add(self._notebook, proportion = 1, flag = EXPAND) vbox.Add(self.btn_grid, flag = EXPAND) p.SetSizerAndFit(vbox) return p
def build_page5(self, parent): p = Panel(parent) m = self.m self._get_sqlmap_path_btn = btn(p, label = '获取帮助') self._get_sqlmap_path_btn.Disable() # 多行文本框的默认size太小了 # 默认高度太低, 不指定个高度, gtk会报 滚动条相关的size 警告 m._page5_manual_view.Create(p, size = (-1, 300), style = wx.TE_MULTILINE | wx.TE_READONLY) self._get_sqlmap_path_btn.Bind( EVT_BUTTON, lambda evt, view = m._page5_manual_view: self._make_help_thread(evt, view)) self._make_help_thread(None, m._page5_manual_view) vbox = BoxSizer(VERTICAL) vbox.Add(self._get_sqlmap_path_btn, flag = TOP | LEFT | BOTTOM, border = 10) vbox.Add(m._page5_manual_view, proportion = 1, flag = EXPAND | LEFT | RIGHT, border = 10) p.SetSizerAndFit(vbox) return p
def build_page6(self, parent): p = Panel(parent) _about_str = ''' 1. VERSION: 0.3.3 2019年 10月 16日 星期三 06:54:46 CST required: python3.5+, wxPython4.0+, sqlmap 作者: needle wang ( [email protected] ) https://github.com/needle-wang/sqlmap-wx\n 2. 使用wxPython重写sqlmap-ui(using PyGObject)\n 3. wxpython教程: https://wiki.wxpython.org/ http://zetcode.com/wxpython/ 4. wxpython API: https://wxpython.org/Phoenix/docs/html/index.html\n\n 5. 感谢sqm带来的灵感, 其作者: KINGX ( https://github.com/kxcode ), sqm UI 使用的是python2 + tkinter ''' hbox = BoxSizer() _page6_about = st(p, label = _about_str) # 完全居中! hbox.Add(_page6_about, flag = ALIGN_CENTER) vbox = BoxSizer(VERTICAL) vbox.Add(hbox, proportion = 1, flag = ALIGN_CENTER) p.SetSizerAndFit(vbox) return p
def build_page4(self, parent): p = Panel(parent) m = self.m border = SizerFlags().Border(LEFT | RIGHT, 5).Align(ALIGN_CENTER) proportion_border = SizerFlags(1).Border(LEFT | RIGHT, 5).Align(ALIGN_CENTER) row1, row2 = (BoxSizer() for _ in range(2)) m._page4_api_server_label.Create(p, label = 'REST-JSON API server:') m._page4_api_server_entry.Create(p, value = '127.0.0.1:8775') m._page4_admin_token_label.Create(p, label = 'Admin (secret) token:') m._page4_admin_token_entry.Create(p) m._page4_admin_token_entry.SetMaxLength(32) row1.Add(m._page4_api_server_label, border) row1.Add(m._page4_api_server_entry, proportion_border) row1.Add(m._page4_admin_token_label, border) row1.Add(m._page4_admin_token_entry, proportion_border) m._page4_task_new_btn.Create(p, label = '创建任务') m._page4_admin_list_btn.Create(p, label = '显示任务') m._page4_admin_flush_btn.Create(p, label = '删除所有任务') m._page4_clear_task_view_btn.Create(p, label = '清空反馈的结果') m._page4_username_label.Create(p, label = '用户名:') m._page4_username_entry.Create(p) m._page4_password_label.Create(p, label = '密码:') m._page4_password_entry.Create(p) _arrow_down = wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_BUTTON) m._page4_admin_list_btn.SetBitmap(_arrow_down, dir = RIGHT) m._page4_task_new_btn.Bind(EVT_BUTTON, self._handlers.api.task_new) m._page4_admin_list_btn.Bind(EVT_BUTTON, self._handlers.api.admin_list) m._page4_admin_flush_btn.Bind(EVT_BUTTON, self._handlers.api.admin_flush) m._page4_clear_task_view_btn.Bind(EVT_BUTTON, self._handlers.clear_task_view_buffer) row2.Add(m._page4_task_new_btn, border) row2.Add(m._page4_admin_list_btn, border) row2.Add(m._page4_admin_flush_btn, border) row2.Add(m._page4_clear_task_view_btn, border) row2.Add(m._page4_username_label, flag = ALIGN_CENTER | LEFT, border = 200) row2.Add(m._page4_username_entry, proportion_border) row2.Add(m._page4_password_label, border) row2.Add(m._page4_password_entry, proportion_border) row3 = SplitterWindow(p, style = wx.SP_LIVE_UPDATE | wx.BORDER_SUNKEN) # 不能放在SplitVertically后面, 不然gravity会无效 # row3.SetSashGravity(0.5) row3.SetMinimumPaneSize(400) lpane = Scroll(row3) self._api_admin_list_rows = lpane lpane.SetSizer(BoxSizer(VERTICAL)) rpane = Panel(row3) _rbox = BoxSizer(VERTICAL) m._page4_option_get_entry.Create(rpane, value = 'url risk level') _page4_option_set_view_tip = st(rpane, label = '所有选项见sqlmap目录中的optiondict.py') _options_example = ("{\n" " 'url': 'http://www.site.com/vuln.php?id=1',\n" " 'level': 1, 'risk': 1,\n\n" "}\n") m._page4_option_set_view.Create(rpane, value = _options_example, style = wx.TE_MULTILINE) _rbox.Add(m._page4_option_get_entry, flag = EXPAND | ALL, border = 2) _rbox.Add(_page4_option_set_view_tip, flag = ALL, border = 2) _rbox.Add(m._page4_option_set_view, proportion = 1, flag = EXPAND | ALL, border = 2) rpane.SetSizer(_rbox) row3.SplitVertically(lpane, rpane) # win下, lpane是灰色的, 将row3设下颜色, 又是兼容代码... row3.SetBackgroundColour(m._page4_option_set_view.GetBackgroundColour()) row3.SetSashPosition(lpane.GetMinWidth()) m._page4_task_view.Create(p, value = '此处显示反馈的结果:\n', style = wx.TE_MULTILINE | wx.TE_READONLY) vbox = BoxSizer(VERTICAL) vbox.Add(row1, flag = EXPAND | ALL, border = 5) vbox.Add(row2, flag = EXPAND | ALL, border = 5) vbox.Add(row3, proportion = 1, flag = EXPAND | LEFT | RIGHT, border = 10) vbox.Add(m._page4_task_view, proportion = 1, flag = EXPAND | ALL, border = 10) p.SetSizerAndFit(vbox) return p