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


Python logs.getLogger函数代码示例

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


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

示例1: sendReport

 def sendReport(self, plugin_id, filename):
     """Sends a report to the appropiate plugin specified by plugin_id"""
     getLogger(self).debug("The file is %s, %s" % (filename, plugin_id))
     if not self.plugin_controller.processReport(plugin_id, filename):
         getLogger(self).error("Faraday doesn't have a plugin for this tool..." " Processing: ABORT")
         return False
     return True
开发者ID:FreedomCoder,项目名称:faraday,代码行数:7,代码来源:reports_managers.py

示例2: syncReports

    def syncReports(self):
        """
        Synchronize report directory using the DataManager and Plugins online
        We first make sure that all shared reports were added to the repo
        """
        for root, dirs, files in os.walk(self._report_path, False):
            # skip processed and unprocessed directories
            if root == self._report_path:
                for name in files:
                    filename = os.path.join(root, name)
                    name = os.path.basename(filename)
                    # If plugin not is detected... move to unprocessed
                    # PluginCommiter will rename the file to processed or unprocessed
                    # when the plugin finishes
                    if self.processor.processReport(filename) is False:
                        getLogger(self).info('Plugin not detected. Moving {0} to unprocessed'.format(filename))
                        os.rename(
                            filename,
                            os.path.join(self._report_upath, name))
                    else:
                        getLogger(self).info(
                            'Detected valid report {0}'.format(filename))
                        os.rename(
                            filename,
                            os.path.join(self._report_ppath, name))

        self.onlinePlugins()
开发者ID:perplext,项目名称:faraday,代码行数:27,代码来源:reports_managers.py

示例3: getRootTag

    def getRootTag(self, file_path):

        report_type = result = f = None

        f, report_type = self.open_file(file_path)

        # Check error in open_file()
        if f is None and report_type is None:
            self.report_type = None
            return None, None

        # Find root tag based in report_type
        if report_type == "zip":
            result = "maltego"
        elif report_type == "dat":
            result = 'lynis'
        elif report_type == 'json':
            # this will work since recon-ng is the first plugin to use json.
            # we need to add json detection here!
            result = 'reconng'
        else:

            try:
                for event, elem in ET.iterparse(f, ('start', )):
                    result = elem.tag
                    break

            except SyntaxError, err:
                self.report_type = None
                getLogger(self).error("Not an xml file.\n %s" % (err))
开发者ID:perplext,项目名称:faraday,代码行数:30,代码来源:reports_managers.py

示例4: run

    def run(self, args):
        workspace = args.workspace
        try:
            ws = super(GuiApp, self).openWorkspace(workspace)
        except Exception as e:
            getLogger(self).error(
                ("Your last workspace %s is not accessible, "
                 "check configuration") % workspace)
            getLogger(self).error(str(e))
            ws = self.openDefaultWorkspace()
        workspace = ws.name
        CONF.setLastWorkspace(workspace)
        CONF.saveConfig()

        self.loadWorkspaces()
        self.createLoggerWidget()
        self.stopSplashScreen()
        self._main_window.showAll()
        couchURL = CONF.getCouchURI()
        if couchURL:
            url = "%s/reports/_design/reports/index.html" % couchURL
            model.api.log("Faraday ui is ready")
            model.api.log("Make sure you have couchdb up and running if you want visualizations.")
            model.api.log("If couchdb is up, point your browser to: [%s]" % url)
        else:
            model.api.log("Please configure Couchdb for fancy HTML5 Dashboard (https://github.com/infobyte/faraday/wiki/Couchdb)")
        exit_code = self.exec_loop()
        return exit_code
开发者ID:Exploit-install,项目名称:faraday,代码行数:28,代码来源:application.py

示例5: _pluginStart

 def _pluginStart(self, name, command_id):
     self.active_plugins_count_lock.acquire()
     self.processing = True
     getLogger(self).info("Plugin Started: {0}. ".format(name, command_id))
     self.active_plugins_count += 1
     self.active_plugins_count_lock.release()
     return True
开发者ID:perplext,项目名称:faraday,代码行数:7,代码来源:controller.py

示例6: run

    def run(self):

        self.online_plugins.start()
        tmp_timer = .0

        while not self._stop:

            time.sleep(.1)
            tmp_timer += .1

            if tmp_timer >= self.timer:

                try:
                    self.syncReports()
                    if not self.polling:
                        break

                except Exception:

                    getLogger(self).error(
                        "An exception was captured while saving reports\n%s"
                        % traceback.format_exc())

                finally:
                    tmp_timer = 0
开发者ID:infobyte,项目名称:faraday,代码行数:25,代码来源:reports_managers.py

示例7: startAPIs

def startAPIs(plugin_controller, model_controller, hostname, port):
    global _rest_controllers
    global _http_server
    _rest_controllers = [PluginControllerAPI(plugin_controller), ModelControllerAPI(model_controller)]

    app = Flask('APISController')

    _http_server = HTTPServer(WSGIContainer(app))
    while True:
        try:
            _http_server.listen(port, address=hostname)
            logger.getLogger().info(
                    "REST API server configured on %s" % str(
                        CONF.getApiRestfulConInfo()))
            break
        except socket.error as exception:
            if exception.errno == 98:
                # Port already in use
                # Let's try the next one
                port += 1
                if port > 65535:
                    raise Exception("No ports available!")
                CONF.setApiRestfulConInfoPort(port)
                CONF.saveConfig()
            else:
                raise exception

    routes = [r for c in _rest_controllers for r in c.getRoutes()]

    for route in routes:
        app.add_url_rule(route.path, view_func=route.view_func, methods=route.methods)

    logging.getLogger("tornado.access").addHandler(logger.getLogger(app))
    logging.getLogger("tornado.access").propagate = False
    threading.Thread(target=startServer).start()
开发者ID:Exploit-install,项目名称:faraday,代码行数:35,代码来源:api.py

示例8: loadChange

    def loadChange(self, objid, revision, deleted):
        try:
            obj = self.mapper_manager.find(objid)
            change = change_factory.create(obj, revision, deleted)

            if change.getChangeType() == CHANGETYPE.DELETE:
                # object deleted
                if isinstance(change, ChangeModelObject):
                    obj_parent = obj.getParent()
                    if obj_parent:
                        obj_parent.deleteChild(obj.getID())
                self.mapper_manager.remove(objid)
            elif change.getChangeType() == CHANGETYPE.UPDATE:
                # object edited
                self.mapper_manager.reload(objid)
            elif change.getChangeType() == CHANGETYPE.ADD:
                if isinstance(change, ChangeModelObject):
                    # The child has a parent, but the parent doesn't
                    # have the child yet...
                    if obj.getParent():
                        obj.getParent().addChild(obj)

            if isinstance(change, ChangeModelObject):
                self._notify_model_object_change(change, obj)
            model.guiapi.notification_center.changeFromInstance(change)
        except:
            getLogger(self).debug(
                "Change couldn't be processed")
开发者ID:FreedomCoder,项目名称:faraday,代码行数:28,代码来源:change.py

示例9: getRootTag

    def getRootTag(self, file_path):

        report_type = result = f = None

        f, report_type = self.open_file(file_path)

        # Check error in open_file()
        if f is None and report_type is None:
            self.report_type = None
            return None, None

        # Find root tag based in report_type
        if report_type == "zip":
            result = "maltego"

        else:

            try:
                for event, elem in ET.iterparse(f, ('start', )):
                    result = elem.tag
                    break

            except SyntaxError, err:
                self.report_type = None
                getLogger(self).error("Not an xml file.\n %s" % (err))
开发者ID:HMSH00D,项目名称:faraday,代码行数:25,代码来源:reports_managers.py

示例10: parse

	def parse(self, xml_file, from_string=False):
		"""Import .nessus file"""
		# Parse XML file
		getLogger(self).debug("Parsing report start")
		if from_string:
			xml_file = StringIO(xml_file)
				
		# Iterate through each host scanned and create objects for each
		for event, elem in ET.iterparse(xml_file):
			
			getLogger(self).debug("Parsing elemn %s" % elem[0:20])
			# Grab the report name from the Report element
			if event == 'end' and elem.tag == 'Report':
				self.name = elem.attrib.get('name')
				continue

			# Only process ReportHost elements
			elif event == 'end' and elem.tag != 'ReportHost':
				continue

			rh_obj = ReportHost(elem)
			if rh_obj:
				self.targets.append(rh_obj)

				# Update Report dates
				if not self.scan_start:
					self.scan_start = rh_obj.host_start
				if not self.scan_end:
					self.scan_end = rh_obj.host_end
				if rh_obj.get('host_start'):
					if rh_obj.host_start < self.scan_start:
						self.scan_start = rh_obj.host_start
				if rh_obj.host_end > self.scan_end:
					self.scan_end = rh_obj.host_end
开发者ID:forbidden-ali,项目名称:faraday,代码行数:34,代码来源:dotnessus_v2.py

示例11: _loadPlugins

    def _loadPlugins(self, plugin_repo_path):
        """
        Finds and load all the plugins that are available in the plugin_repo_path.
        """
        try:
            os.stat(plugin_repo_path)
        except OSError:
                                 
            pass
        
        sys.path.append(plugin_repo_path)

        dir_name_regexp = re.compile(r"^[\d\w\-\_]+$")
        for name in os.listdir(plugin_repo_path):
            if dir_name_regexp.match(name):
                try:
                    module_path = os.path.join(plugin_repo_path, name)
                    sys.path.append(module_path)
                    module_filename = os.path.join(module_path, "plugin.py")
                    self._plugin_modules[name] = imp.load_source(name, module_filename)
                except Exception as e:
                    msg = "An error ocurred while loading plugin %s.\n%s" % (module_filename, traceback.format_exc())
                    getLogger(self).debug(msg)
                    getLogger(self).warn(e)
            else:
                pass
开发者ID:Gr3yR0n1n,项目名称:faraday,代码行数:26,代码来源:all.py

示例12: wrapper

 def wrapper(*args, **kwargs):
     try:
         res = func(*args, **kwargs)
     except ServerRequestException as e:
         res = response_in_emergency
         getLogger("Server-GTK IO").warning(e)
     return res
开发者ID:Sliim,项目名称:faraday,代码行数:7,代码来源:decorators.py

示例13: _loadDbs

 def _loadDbs(self):
     conditions = lambda x: not x.startswith("_") and x != 'reports'
     for dbname in filter(conditions, self.__serv.all_dbs()):
         if dbname not in self.dbs.keys():
             getLogger(self).debug(
                 "Asking for dbname[%s], registering for lazy initialization" % dbname)
             self.dbs[dbname] = lambda x: self._loadDb(x)
开发者ID:Gr3yR0n1n,项目名称:faraday,代码行数:7,代码来源:persistence_managers.py

示例14: _pluginStart

 def _pluginStart(self, name, command_id):
     self.active_plugins_count_lock.acquire()
     self.processing = True
     if name not in ["MetasploitOn", "Beef", "Sentinel"]:
         getLogger(self).info("Plugin Started: {0}. ".format(name, command_id))
     self.active_plugins_count += 1
     self.active_plugins_count_lock.release()
     return True
开发者ID:infobyte,项目名称:faraday,代码行数:8,代码来源:controller.py

示例15: exit_faraday_without_confirm

 def exit_faraday_without_confirm(self, widget=None):
     """Exits faraday without confirm. Used as a middle-man between
     connect callbacks (which will send the widget as an argument and
     self.window.destroy, which takes none.
     """
     getLogger(self).error("Faraday exited because you didn't connect " "to a valid Faraday Server.")
     GObject.idle_add(self.window.destroy)
     GObject.idle_add(self.on_quit)
开发者ID:Sliim,项目名称:faraday,代码行数:8,代码来源:application.py


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