def OnClose(self, event): if self.wash.is_alive: self.wash.stop() # stop monitor and restore services if self.iface is not None: wx.LogDebug(self.iface.airmon_stop()) wx.LogDebug(self.iface.desactivar_iface()) wx.Exit()
def on_btn_airmon_check(self, event): if self.iface is not None: if self.iface.modo == 'monitor': wx.LogDebug(self.iface.optimize()) if self.iface.is_optimized: wx.LogDebug( "El modo monitor esta funcionando correctamente") else: wx.LogWarning( "Debes activar el modo monitor antes de usar esta opcion") else: wx.LogWarning("Primero debes seleccionar una interfaz")
def OnEvent(self, propGrid, prop, ctrl, event): """ Обработка клика на дополнительных кнопках. @param propGrid: @param prop: @param ctrl: @param event: @return: """ if event.GetEventType() == wx.wxEVT_COMMAND_BUTTON_CLICKED: buttons = self.buttons evtId = event.GetId() if evtId == buttons.GetButtonId(0): # Do something when the first button is pressed wx.LogDebug('First button pressed') return False # Return false since value did not change if evtId == buttons.GetButtonId(1): # Do something when the second button is pressed value = prop.GetValue() result = False if not value or value in ('None', ): # Если значение не определено, то сгенерировать его result = self.create_on_event(prop, prop.GetName()) else: # Если значение определено, то открыть модуль менеджера ресурса и промотать до функции - обработчика result = self.find_on_event(prop, prop.GetName(), value) return result # Return false since value did not change return self.CallSuperMethod('OnEvent', propGrid, prop, ctrl, event)
def on_btn_airmon_toggle(self, event): if self.combo_iface.Selection > 0: wx.LogDebug(self.iface.airmon_toggle()) self.update_ifaces() else: wx.LogWarning( "Debes seleccionar una tarjeta antes de usar esta opcion")
def OnEvent(self, propGrid, prop, ctrl, event): """ :param propGrid: :param prop: :param ctrl: :param event: :return: """ if event.GetEventType() == wx.wxEVT_COMMAND_BUTTON_CLICKED: buttons = self.buttons evtId = event.GetId() if evtId == buttons.GetButtonId(0): # Do something when the first button is pressed wx.LogDebug("First button pressed") return False # Return false since value did not change if evtId == buttons.GetButtonId(1): # Do something when the second button is pressed wx.MessageBox("Second button pressed") return False # Return false since value did not change if evtId == buttons.GetButtonId(2): # Do something when the third button is pressed wx.MessageBox("Third button pressed") return False # Return false since value did not change return self.CallSuperMethod("OnEvent", propGrid, prop, ctrl, event)
def ClickOnSave(self): """ show File Save DLG save template data in json format """ data = self.PropertyGridNoteBoook.GetData() #--- make file name self.Template.TMP.template_name = self.GetDataName(data) #fjson = self.Template.TMP.template_full_filename SaveDLG = wx.FileDialog( self, message='Save Template data.', wildcard='template (*.' + self.Template.TMP.template_extention + ')|*.json|All Files|*', style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT | wx.FD_PREVIEW) SaveDLG.SetDirectory(self.Template.TMP.template_path) SaveDLG.SetFilename(self.Template.TMP.template_filename) if SaveDLG.ShowModal() == wx.ID_OK: #--- update templatev info data["info"] = self.Template.TMP.update_template_info( gui_version=__version__) fout = os.path.join(SaveDLG.GetDirectory(), SaveDLG.GetFilename()) if self.verbose: wx.LogMessage(" ---> experiment template : " + data["experiment"]["name"]) wx.LogMessage(" --> saving experiment template file : " + fout) if self.debug: wx.LogDebug(" -> experiment template data: \n" + json.dumps(data, indent=4)) try: with open(fout, "w") as f: f.write(json.dumps(data, indent=4)) os.fsync(f.fileno()) # make to disk f.close() if self.verbose: wx.LogMessage( " ---> done saving experiment template file: " + fout) #--- update Experiment Template lists and update ExpTmp ComboBox with new template name #--- TEST_jumeg_experiment_template.json => TEST name = SaveDLG.GetFilename().split( "_" + self.Template.TMP.template_postfix)[0] self.Template.update_template(name=name) except Exception as e: wx.LogError("Save failed!\n" + jb.pp_list2str( e, head="Error writing experiment template file: " + fout)) pub.sendMessage("MAIN_FRAME.MSG.ERROR", data="Error writing template file: " + fout) raise finally: SaveDLG.Destroy()
def on_btn_select_iface(self, event): if self.iface is not None: if self.iface.modo == 'monitor': if self.iface.is_optimized: self.iface_name = self.iface.name self.SetStatusText(self.iface_name, 1) self.SetStatusWidths([-1, 100]) wx.LogDebug(self.iface.ifconfig_up()) else: txt = "La interfaz no esta optimizada, usa el boton 'Optimizar interfaz'." wx.LogStatus(txt) txt += "\nEl boton 'optimizar' desactivará servicios de red usados por el sistema. " wx.LogWarning(txt) else: wx.LogWarning( "Activa el modo monitor antes de usar esta opcion") else: wx.LogWarning("Primero debes seleccionar una interfaz")
def OnEvent(self, propGrid, prop, ctrl, event): if event.GetEventType() == wx.wxEVT_COMMAND_BUTTON_CLICKED: buttons = self.buttons evtId = event.GetId() if evtId == buttons.GetButtonId(0): # Do something when the first button is pressed wx.LogDebug("First button pressed") return False # Return false since value did not change if evtId == buttons.GetButtonId(1): # Do something when the second button is pressed wx.MessageBox("Second button pressed") return False # Return false since value did not change if evtId == buttons.GetButtonId(2): # Do something when the third button is pressed wx.MessageBox("Third button pressed") return False # Return false since value did not change return super(SampleMultiButtonEditor, self).OnEvent(propGrid, prop, ctrl, event)
def DebugLog(msg): import wx msg = msg.replace(u'\r', u'') msg = msg.replace(u'\n', u'') wx.LogDebug(msg)
def on_btn_powerup(self, event): wx.LogDebug("OPCION POWERUP NO IMPLEMENTADA...")
def log(txt, lvl=syslog.LOG_NOTICE): syslog.openlog('golumn') syslog.syslog(lvl, txt) wx.LogDebug(txt)