当前位置: 首页>>代码示例>>Python>>正文


Python api.devlog函数代码示例

本文整理汇总了Python中model.api.devlog函数的典型用法代码示例。如果您正苦于以下问题:Python devlog函数的具体用法?Python devlog怎么用?Python devlog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了devlog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _showContextMenu

    def _showContextMenu(self, item, pos, val):
        """Pop up a context menu when an item is right-clicked on the list view."""
                                                                                               
                                               
                                               
                                               
                              
        popup = qt.QPopupMenu(self)

        selected_items = self._getSelectedItems()

        if not selected_items:
                                                      
            popup.insertItem('Create Workspace', 100)
        else:
            if len(selected_items) == 1:
                if item.object.isActive():
                    popup.insertItem('Save', self._saveWorkspace)
                    popup.insertItem('Synchronize', self._syncWorkspace)
                    popup.insertItem('Close', 300)
                else:
                    popup.insertItem('Open', lambda: self._openWorkspace(item))
                    popup.insertItem('Delete', lambda: self._deleteWorkspace(item))
            
                popup.insertItem('Properties', lambda: self._showWorkspaceProperties(item))

            elif len(selected_items) > 1: 
                popup.insertItem('Delete', lambda: self._deleteWorkspaces(selected_items))
            else:
                api.devlog("ERROR: right click on an valid item (%r) which has a null object" % item)
            
        ret = popup.exec_loop(pos)
        
        api.devlog("contextMenuEvent WorkspaceItem - item: %s - ret %s" % (self.name, ret))
开发者ID:Behk,项目名称:faraday,代码行数:34,代码来源:workspacebrowser.py

示例2: _showRepositoryConfigDialog

    def _showRepositoryConfigDialog(self):

        repoconfig_dialog = RepositoryConfigDialog(self, CONF.getCouchURI(),
                                                   CONF.getCouchIsReplicated(),
                                                   CONF.getCouchReplics(),
                                                   callback=None)
        result = repoconfig_dialog.exec_loop()
        if result == qt.QDialog.Accepted:
            repourl, isReplicated, replics = repoconfig_dialog.getData()
            api.devlog("repourl = %s" % repourl)
            wm = self._main_app.getWorkspaceManager()
            if not CouchDbManager.testCouch(repourl):
                self.showPopup("""
                Repository URL Not valid, check if
                service is available and that connection string is from
                the form: http[s]://hostname:port""")
                return

            CONF.setCouchUri(repourl)
            CONF.setCouchIsReplicated(isReplicated)
            CONF.setCouchReplics(replics)
            CONF.saveConfig()

            wm.closeWorkspace()
            wm.resource()
            wm.openWorkspace('untitled')

            mwin = self._main_app.getMainWindow()
            mwin.getWorkspaceTreeView().loadAllWorkspaces()
            mwin.getWorkspaceTreeView().setDefaultWorkspace()
开发者ID:m0sth8,项目名称:faraday,代码行数:30,代码来源:mainwindow.py

示例3: _showContextMenu

    def _showContextMenu(self, item, pos, val):
        """Pop up a context menu when an item is right-clicked on the list view."""

        popup = qt.QPopupMenu(self)

        selected_items = self._getSelectedItems()

        if not selected_items:

            popup.insertItem("No action available", 100)
        else:
            if len(selected_items) == 1:
                if item.is_active:
                    popup.insertItem("No action available", 100)
                else:
                    popup.insertItem("Open", lambda: self._openWorkspace(item))
                    popup.insertItem("Delete", lambda: self._deleteWorkspace(item))

                # popup.insertItem('Properties', lambda: self._showWorkspaceProperties(item))

            elif len(selected_items) > 1:
                popup.insertItem("Delete", lambda: self._deleteWorkspaces(selected_items))
            else:
                api.devlog("ERROR: right click on an valid item (%r) which has a null object" % item)

        ret = popup.exec_loop(pos)

        api.devlog("contextMenuEvent WorkspaceItem - item: %s - ret %s" % (self.name, ret))
开发者ID:followboy1999,项目名称:faraday,代码行数:28,代码来源:workspacebrowser.py

示例4: _openWorkspace

 def _openWorkspace(self, item):
                                            
                                                                  
     api.devlog("Opening workspace %s selected on the Workspace Perspective" % item.name)
     self._getMainApp().openWorkspace(item.object.name)
                      
     self.loadAllWorkspaces()
开发者ID:Behk,项目名称:faraday,代码行数:7,代码来源:workspacebrowser.py

示例5: _delValue

    def _delValue(self, attrName, valID):
        # attribute passed as a parameter MUST BE  the name
        # of an internal attribute which is a dictionary indexed
        # with a string ID
        api.devlog("(%s)._delValue(%s, %s)" % (self, attrName, valID))
        ref = self.__getattribute__(attrName)
        api.devlog("ref.keys() = %s" % ref.keys())
        if valID in ref:
            val = ref[valID]
            del ref[valID]
            val.delete()
            return True

        hash_id = get_hash([valID])
        if hash_id in ref:
            val = ref[hash_id]
            del ref[hash_id]
            val.delete()
            return True

        for element in ref.itervalues():
            if valID == element.name:
                val = ref[element.getID()]
                del ref[element.getID()]
                val.delete()
                return True

        # none of the ids were found
        return False
开发者ID:BecomingMore,项目名称:faraday,代码行数:29,代码来源:common.py

示例6: _checkDate

    def _checkDate(self,rowdate):
        
        mret=True                              
        msave=True                
        
        if not self._lsdate:                
                                         
            if self._sdate:                     
                self._lsdate=self._sdate                                       
            else:
                self._lsdate=rowdate                                      

                                                           
        if self._cdate(self._lsdate,rowdate):
            msave=False
        
        if self._sdate:
            self._mwhere =" and updated_at > to_timestamp('"+self._sdate+"','YYYY-MM-DD HH24:MI:SS.US');"
                                                    
                                                      
                
        if msave:
            try:
                f=open(self.path,"w")
                f.write(rowdate)
                f.close()
                self._lsdate=rowdate
            except:
                api.devlog ("Can't save metasploit lastupdate file")
                return
        
        return mret
开发者ID:Behk,项目名称:faraday,代码行数:32,代码来源:plugin.py

示例7: parseOutputString

    def parseOutputString(self, output, debug=False):

        host_info = re.search(
            r"(\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b)",
            output)

        host_mac_addr = re.search(r"([\dA-F]{2}(?:[-:][\dA-F]{2}){5})", output)

        if host_info is None:
            api.devlog("No hosts detected")
        else:

            for line in output.split('\n'):
                vals = line.split("\t")

                if len(vals[0].split(".")) == 4:

                    host = vals[0]
                    h_id = self.createAndAddHost(host)
                    i_id = self.createAndAddInterface(
                        h_id, host, ipv4_address=host, mac=vals[1])
                    n_id = self.createAndAddNoteToHost(
                        h_id, "NIC VENDOR:", vals[2])

        return True
开发者ID:Sliim,项目名称:faraday,代码行数:25,代码来源:plugin.py

示例8: _doSql

 def _doSql(self, db, sql):
     try:
         api.devlog("SQL:" + sql)
         db.execute(sql)
     except Exception, e:
         print ("Error SQL[" + e.pgcode + "] - " + e.pgerror)
         return None
开发者ID:infobyte,项目名称:faraday,代码行数:7,代码来源:plugin.py

示例9: sigCHLDHandler

    def sigCHLDHandler(self, sig, frame):
        """SIGCHLD handler

        :signal: int
        :frame: frame object

        Automatically called upon SIGCHLD.

        Normally you do not need to do anything with this function but
        if your application needs to disable SIGCHLD for some time for
        reasons beyond your control, you should call this function afterwards
        to make sure that no SIGCHLDs where missed.
        """
        found = False
        # iterating the list doesn't perform any system call
        for process in self.process_list:
            if process.pid is None:
                continue
            if not process.running:
                continue
            try:
                wpid, status = os.waitpid(process.pid, os.WNOHANG)
            except OSError:
                # [Errno 10] No child processes
                # XXX: bug in process.py ?
                continue
            if wpid > 0:
                os.write(self.fd[1], struct.pack('II', wpid, status))
                devlog("sigCHLDHandler - signal = %d - wpid = %d - status = %d" % (sig, wpid, status))
                found = True
        if (not found and
            not self.old_sigCHLDHandler in (signal.SIG_IGN, signal.SIG_DFL)):
            self.old_sigCHLDHandler(sig) # call the old handler
开发者ID:0x24bin,项目名称:BurpSuite,代码行数:33,代码来源:procctrl.py

示例10: _importVulnsCvs

    def _importVulnsCvs(self,item):
        filename =  qt.QFileDialog.getOpenFileName(
                    CONF.getDefaultTempPath(),
                    "Csv vulnerability file  (*.*)",
                    None,
                    "open file dialog",
                    "Choose a vulnerability file" );
        
        if os.path.isfile(filename):
            with open(filename) as f:
                data = f.read()
            f.close()

            for l in data.split("\n"):
                api.devlog(l)
                if re.search("^#",l):
                    api.devlog("ERROR FILE")
                    continue
                
                d = l.split("|")
                
                if len(d) <=8:
                    api.log("Error vuln line: ("+l+")" )
                else:
                    self._newVulnImport(d[1],d[2],d[3],d[4],d[5],d[6],d[7])
开发者ID:diokhancze,项目名称:faraday,代码行数:25,代码来源:hostsbrowser.py

示例11: parseOutputString

    def parseOutputString(self, output, debug=False):

        host_info = re.search(r"Connected to (.+)\.", output)
        banner = re.search("220?([\w\W]+)$", output)
        if re.search("Connection timed out", output) is None and host_info is not None:
            hostname = host_info.group(1)
            ip_address = self.resolve(hostname)
            self._version = banner.groups(0) if banner else ""
            if debug:
                print ip_address

            h_id = self.createAndAddHost(ip_address)

            i_id = self.createAndAddInterface(
                h_id,
                ip_address,
                ipv4_address=ip_address,
                hostname_resolution=hostname)

            s_id = self.createAndAddServiceToInterface(
                h_id,
                i_id,
                "ftp",
                "tcp",
                ports=[self._port],
                status="open")

        if debug is True:
            api.devlog("Debug is active")

        return True
开发者ID:MrMugiwara,项目名称:faraday,代码行数:31,代码来源:plugin.py

示例12: _checkFullDelete

 def _checkFullDelete(self):
                                                     
                                                                          
                                                               
     api.devlog("Doing service checkFullDelete")
     if not self._interfaces and not self._applications:
         if self.getParent() is not None:
             self.getParent().delService(self.getID())
开发者ID:0x24bin,项目名称:BurpSuite,代码行数:8,代码来源:hosts.py

示例13: close

 def close(self, session, status, *args):
     #TODO: por alguna razon queda colgado un QSocketNotifier
     # QSocketNotifier: invalid socket 17 and type 'Read', disabling...
     # y eso cuelga la aplicacion
     api.devlog("ShellEnvironment close was called - session = %r, status = %r , *args = %r" % (session, status, args))
     if self._close_callback is not None:
         self._close_callback(self.name, self)
     else:
         api.devlog("close was call but callback is not set")
开发者ID:BecomingMore,项目名称:faraday,代码行数:9,代码来源:env.py

示例14: setPorts

 def setPorts(self, ports):
     if ports is not None:
         if isinstance(ports, (str,unicode)):
             self._ports = [int(ports)]
         elif isinstance(ports, int):
             self._ports = [ports]
         elif isinstance(ports, list):
             self._ports = [int(p) for p in ports]
         else:
             api.devlog("ports must be a string, an int o a list of any of those types")
开发者ID:BecomingMore,项目名称:faraday,代码行数:10,代码来源:hosts.py

示例15: setSavingModel

 def setSavingModel(self, value):
     api.devlog("setSavingModel: %s" % value)
     self._saving_model_flag = value
     if value:
         self._saving_model_lock.acquire()
     else:
         try:
             self._saving_model_lock.release()
         except RuntimeError:
             pass
开发者ID:followboy1999,项目名称:faraday,代码行数:10,代码来源:controller.py


注:本文中的model.api.devlog函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。