StructurePaiMei will scan the images/icons directory on startup, looking for modules to load. If you create a new module and do not create an icon for it, your module will be ignored. The Photoshop template for icons is available in the docs directory, it is named Listbook Graphic Templates.psd. The core of the module itself must be implemented as a WxPanel and placed in the modules directory with the same name of the icon. All modules should be prefixed with "PAIMEI" and contain only lower-case letters in the name. For example, to add a module named 'explorer', create the following files:images\icons\PAIMEIexplorer.png modules\PAIMEIexplorer.pySupport files for your module should be placed under a subdirectory within modules with the name '_PAIMEI[module name]'. Following our example: modules\_PAIMEIexplorer\* |
documented_properties = { "pida_modules" : "Dictionary of loaded PIDA modules.", }There are two class variables that you should declare in your module to access the global PaiMei namespace, self.list_book and self.main_frame:
self.list_book = kwds["parent"] # handle to list book. self.main_frame = self.list_book.top # handle to top most frame.These handles are necessary for accessing the namespace of other modules and, more importantly, accessing the top level MySQL, PyDbg and uDraw variables (through self.main_frame.xxxx). When creating new controls, you should pass self, which within the control should be assigned to self.top, so that individual controls can access these variables as well (through self.top.main_frame.xxxx
#################################################################################################################### def _get_status (self): ''' Return the text to display in the status bar on page change. ''' return self.status_msg #################################################################################################################### def _set_status (self, status_msg): ''' Set the text to display in the status bar. ''' self.status_msg = status_msg self.main_frame.status_bar.SetStatusText(self.status_msg, 1)The _get_status() routine is called from the console as the user selects between various modules. This allows your module to maintain a status message persistently as the user transitions back and forth between modules.
Creating a Log WindowUtilizing a log window is optional. However, if you plan on using one it should be placed within a splitter and must be named 'log'. You must then create and bind a routine for handing situations where generated log data exceeds the maximum size of the log control:self.Bind(wx.EVT_TEXT_MAXLEN, self.OnMaxLogLengthReached, self.log) #################################################################################################################### def OnMaxLogLengthReached (self, event): ''' Clear the log window when the max length is reach. @todo: Make this smarter by maybe only clearing half the lines. ''' self.log.SetValue("")If you are placing your log control in a splitter window (which is wise) and you want to prevent the user from accidentally closing the log window. Then set a minimum pane size on the containing sizer: self.log_splitter.SetMinimumPaneSize(25)Finally, create and utilize the following shortcut routines to the log control: #################################################################################################################### def err (self, message): ''' Write an error message to log window. ''' self.log.AppendText("[!] %s\n" % message) #################################################################################################################### def msg (self, message): ''' Write a log message to log window. ''' self.log.AppendText("[*] %s\n" % message) |
self.msg("PaiMei Explorer") self.msg("Module by Pedram Amini\n")
for key in module.functions.keys(): module.functions[key].ext["PAIMEIexplore"] = {} module.functions[key].ext["PAIMEIexplore"]["hit_count"] = 0If you want to save your attribute extensions, simply dump the PIDA module back to disk. The ext dictionary will be included in the file and restored the next time it is loaded.