def __init__(self, parent, is_in_monitor_mode=False): self.is_in_monitor_mode = is_in_monitor_mode wx.Panel.__init__(self, parent=parent) self.btn_capture_toggle = wx.Button(self, -1, "Start capture", style=wx.BU_LEFT | wx.BU_TOP) self.devices_list = wx.Choice(self, -1, choices=get_wireless_devices()) self.capture_list = wx.ListCtrl(self, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER) self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.update, self.timer) self.tshark = None self.index = 0 self.fields = [] self.btn_capture_toggle.Bind(wx.EVT_BUTTON, self.toggle_capture) sizer = wx.FlexGridSizer(2, 1, 0, 1) sizer_toolbar = wx.BoxSizer(wx.HORIZONTAL) sizer_toolbar.Add(self.btn_capture_toggle, 0, 0, 0) sizer_toolbar.Add(wx.StaticText(self, -1, "Monitoring device:"), 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) sizer_toolbar.Add(self.devices_list, 0, 0, 0) sizer.Add(sizer_toolbar, 1, wx.EXPAND, 0) sizer.Add(self.capture_list, 1, wx.EXPAND, 1) self.SetSizer(sizer) sizer.AddGrowableCol(0) sizer.AddGrowableRow(1) self.Layout()
def start_monitor_mode(self, event=None): devname = self.current_device() lines = subprocess.check_output("gksudo airmon-ng start %s" % \ devname, shell=True) # print lines # DEBUG self.devices_list.SetItems(get_wireless_devices())
def stop_monitor_mode(self, event=None): devname = self.current_device() lines = subprocess.check_output("gksudo airmon-ng stop %s" % \ devname, shell=True) # print lines # DEBUG self.devices_list.SetItems(get_wireless_devices()) ### TODO: refresh devices_list (or select "least recent" device?) self.btn_monitor_toggle.SetLabel("Select interface")
def __init__(self, parent): wx.Panel.__init__(self, parent=parent) self.btn_monitor_toggle = wx.Button(self, -1, "Start monitor mode", style=wx.BU_LEFT | wx.BU_TOP) self.btn_capture_toggle = wx.Button(self, -1, "Start capture") self.devices_list = wx.Choice(self, -1, choices=get_wireless_devices()) self.capture_list = wx.ListCtrl(self, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER) self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.update, self.timer) self.tshark = None self.btn_capture_toggle.Bind(wx.EVT_BUTTON, self.toggle_capture) self.btn_monitor_toggle.Bind(wx.EVT_BUTTON, self.toggle_monitor) # TODO: bind capture_list change event to set # btn_monitor_toggle text appropriately self.devices_list.Bind(wx.EVT_CHOICE, self.interface_selected) sizer = wx.FlexGridSizer(2, 1, 0, 1) sizer_toolbar = wx.BoxSizer(wx.HORIZONTAL) sizer_toolbar.Add(self.btn_monitor_toggle, 0, 0, 0) sizer_toolbar.Add(self.btn_capture_toggle, 0, 0, 0) sizer_toolbar.Add(wx.StaticText(self, -1, "Monitoring device:"), 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0) sizer_toolbar.Add(self.devices_list, 0, 0, 0) sizer.Add(sizer_toolbar, 1, wx.EXPAND, 0) sizer.Add(self.capture_list, 1, wx.EXPAND, 1) self.SetSizer(sizer) sizer.AddGrowableCol(0) sizer.AddGrowableRow(1) self.Layout() # Set monitor mode toggle button appropriately based on # selected interface try: devname = self.current_device() if devname[0:3] == "mon": self.btn_monitor_toggle.SetLabel("Stop monitor mode") except: pass