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


Python SpiderFootDb.scanResultEvent方法代码示例

本文整理汇总了Python中sfdb.SpiderFootDb.scanResultEvent方法的典型用法代码示例。如果您正苦于以下问题:Python SpiderFootDb.scanResultEvent方法的具体用法?Python SpiderFootDb.scanResultEvent怎么用?Python SpiderFootDb.scanResultEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfdb.SpiderFootDb的用法示例。


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

示例1: scanexportjsonmulti

# 需要导入模块: from sfdb import SpiderFootDb [as 别名]
# 或者: from sfdb.SpiderFootDb import scanResultEvent [as 别名]
    def scanexportjsonmulti(self, ids):
        dbh = SpiderFootDb(self.config)
        scaninfo = dict()

        for id in ids.split(','):
          scan_name = dbh.scanInstanceGet(id)[0]

          if scan_name not in scaninfo:
              scaninfo[scan_name] = []

          for row in dbh.scanResultEvent(id):
              lastseen = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0]))
              event_data = str(row[1]).replace("<SFURL>", "").replace("</SFURL>", "")
              source_data = str(row[2])
              source_module = str(row[3])
              event_type = row[4]
              false_positive = row[13]

              if event_type == "ROOT":
                  continue

              scaninfo[scan_name].append({
                  "data": event_data,
                  "type": event_type,
                  "source_module": source_module,
                  "source_data": source_data,
                  "false_positive": false_positive,
                  "lastseen": lastseen
              })

        cherrypy.response.headers['Content-Disposition'] = "attachment; filename=SpiderFoot.json"
        cherrypy.response.headers['Content-Type'] = "application/json; charset=utf-8"
        cherrypy.response.headers['Pragma'] = "no-cache"

        return json.dumps(scaninfo)
开发者ID:smicallef,项目名称:spiderfoot,代码行数:37,代码来源:sfwebui.py

示例2: scanelementtypediscovery

# 需要导入模块: from sfdb import SpiderFootDb [as 别名]
# 或者: from sfdb.SpiderFootDb import scanResultEvent [as 别名]
    def scanelementtypediscovery(self, id, eventType):
        keepGoing = True
        sf = SpiderFoot(self.config)
        dbh = SpiderFootDb(self.config)
        pc = dict()
        datamap = dict()

        # Get the events we will be tracing back from
        leafSet = dbh.scanResultEvent(id, eventType)

        # Get the first round of source IDs for the leafs
        nextIds = list()
        for row in leafSet:
            # these must be unique values!
            parentId = row[9]
            childId = row[8]
            datamap[childId] = row

            if pc.has_key(parentId):
                if childId not in pc[parentId]:
                    pc[parentId].append(childId)
            else:
                pc[parentId] = [ childId ]

            # parents of the leaf set
            if parentId not in nextIds:
                nextIds.append(parentId)

        while keepGoing:
            parentSet = dbh.scanElementSources(id, nextIds)
            nextIds = list()
            keepGoing = False

            for row in parentSet:
                parentId = row[9]
                childId = row[8]
                datamap[childId] = row
                #print childId + " = " + str(row)

                if pc.has_key(parentId):
                    if childId not in pc[parentId]:
                        pc[parentId].append(childId)
                else:
                    pc[parentId] = [ childId ]
                if parentId not in nextIds:
                    nextIds.append(parentId)

                # Prevent us from looping at root
                if parentId != "ROOT":
                    keepGoing = True

        datamap[parentId] = row

        #print pc
        retdata = dict()
        retdata['tree'] = sf.dataParentChildToTree(pc)
        retdata['data'] = datamap
        return json.dumps(retdata, ensure_ascii=False)
开发者ID:Pinperepette,项目名称:spiderfoot,代码行数:60,代码来源:sfwebui.py

示例3: scaneventresults

# 需要导入模块: from sfdb import SpiderFootDb [as 别名]
# 或者: from sfdb.SpiderFootDb import scanResultEvent [as 别名]
 def scaneventresults(self, id, eventType):
     dbh = SpiderFootDb(self.config)
     data = dbh.scanResultEvent(id, eventType)
     retdata = []
     for row in data:
         lastseen = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0]))
         escaped = cgi.escape(row[1])
         retdata.append([lastseen, escaped, row[2], row[3], row[5], row[6], row[7]])
     return json.dumps(retdata, ensure_ascii=False)
开发者ID:jspc,项目名称:spiderfoot,代码行数:11,代码来源:sfwebui.py

示例4: scaneventresultexport

# 需要导入模块: from sfdb import SpiderFootDb [as 别名]
# 或者: from sfdb.SpiderFootDb import scanResultEvent [as 别名]
 def scaneventresultexport(self, id, type, dialect="excel"):
     dbh = SpiderFootDb(self.config)
     data = dbh.scanResultEvent(id, type)
     fileobj = StringIO()
     parser = csv.writer(fileobj, dialect=dialect)
     parser.writerow(["Updated", "Type", "Module", "Source", "Data"])
     for row in data:
         lastseen = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0]))
         parser.writerow([lastseen, str(row[4]), str(row[3]), str(row[2]), str(row[1])])
     cherrypy.response.headers['Content-Disposition'] = "attachment; filename=SpiderFoot.csv"
     cherrypy.response.headers['Content-Type'] = "application/csv"
     cherrypy.response.headers['Pragma'] = "no-cache"
     return fileobj.getvalue()
开发者ID:adepasquale,项目名称:spiderfoot,代码行数:15,代码来源:sfwebui.py

示例5: scanviz

# 需要导入模块: from sfdb import SpiderFootDb [as 别名]
# 或者: from sfdb.SpiderFootDb import scanResultEvent [as 别名]
 def scanviz(self, id, gexf="0"):
     types = list()
     dbh = SpiderFootDb(self.config)
     sf = SpiderFoot(self.config)
     data = dbh.scanResultEvent(id, filterFp=True)
     scan = dbh.scanInstanceGet(id)
     root = scan[1]
     if gexf != "0":
         cherrypy.response.headers['Content-Disposition'] = "attachment; filename=SpiderFoot.gexf"
         cherrypy.response.headers['Content-Type'] = "application/gexf"
         cherrypy.response.headers['Pragma'] = "no-cache"
         return sf.buildGraphGexf([root], "SpiderFoot Export", data)
     else:
         return sf.buildGraphJson([root], data)
开发者ID:Wingless-Archangel,项目名称:spiderfoot,代码行数:16,代码来源:sfwebui.py

示例6: scaneventresultexport

# 需要导入模块: from sfdb import SpiderFootDb [as 别名]
# 或者: from sfdb.SpiderFootDb import scanResultEvent [as 别名]
 def scaneventresultexport(self, id, type):
     dbh = SpiderFootDb(self.config)
     data = dbh.scanResultEvent(id, type)
     blob = "\"Updated\",\"Type\",\"Module\",\"Source\",\"Data\"\n"
     for row in data:
         lastseen = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0]))
         escapedData = cgi.escape(row[1].replace("\n", "#LB#").replace("\r", "#LB#"))
         escapedSrc = cgi.escape(row[2].replace("\n", "#LB#").replace("\r", "#LB#"))
         blob = blob + "\"" + lastseen + "\",\"" + row[4] + "\",\""
         blob = blob + row[3] + "\",\"" + escapedSrc + "\",\"" + escapedData + "\"\n"
     cherrypy.response.headers['Content-Disposition'] = "attachment; filename=SpiderFoot.csv"
     cherrypy.response.headers['Content-Type'] = "application/csv"
     cherrypy.response.headers['Pragma'] = "no-cache"
     return blob
开发者ID:askfanxiaojun,项目名称:spiderfoot,代码行数:16,代码来源:sfwebui.py

示例7: scanelementtypediscovery

# 需要导入模块: from sfdb import SpiderFootDb [as 别名]
# 或者: from sfdb.SpiderFootDb import scanResultEvent [as 别名]
    def scanelementtypediscovery(self, id, eventType):
        sf = SpiderFoot(self.config)
        dbh = SpiderFootDb(self.config)
        pc = dict()
        datamap = dict()

        # Get the events we will be tracing back from
        leafSet = dbh.scanResultEvent(id, eventType)
        [datamap, pc] = dbh.scanElementSourcesAll(id, leafSet)

        # Delete the ROOT key as it adds no value from a viz perspective
        del pc['ROOT']
        retdata = dict()
        retdata['tree'] = sf.dataParentChildToTree(pc)
        retdata['data'] = datamap

        return json.dumps(retdata, ensure_ascii=False)
开发者ID:Wingless-Archangel,项目名称:spiderfoot,代码行数:19,代码来源:sfwebui.py

示例8: scanvizmulti

# 需要导入模块: from sfdb import SpiderFootDb [as 别名]
# 或者: from sfdb.SpiderFootDb import scanResultEvent [as 别名]
    def scanvizmulti(self, ids, gexf="1"):
        types = list()
        dbh = SpiderFootDb(self.config)
        sf = SpiderFoot(self.config)
        data = list()
        roots = list()
        for id in ids.split(','):
            data = data + dbh.scanResultEvent(id, filterFp=True)
            roots.append(dbh.scanInstanceGet(id)[1])

        if gexf != "0":
            cherrypy.response.headers['Content-Disposition'] = "attachment; filename=SpiderFoot.gexf"
            cherrypy.response.headers['Content-Type'] = "application/gexf"
            cherrypy.response.headers['Pragma'] = "no-cache"
            return sf.buildGraphGexf(roots, "SpiderFoot Export", data)
        else:
            # Not implemented yet
            return None
开发者ID:Wingless-Archangel,项目名称:spiderfoot,代码行数:20,代码来源:sfwebui.py

示例9: scaneventresultexportmulti

# 需要导入模块: from sfdb import SpiderFootDb [as 别名]
# 或者: from sfdb.SpiderFootDb import scanResultEvent [as 别名]
    def scaneventresultexportmulti(self, ids, dialect="excel"):
        dbh = SpiderFootDb(self.config)
        scaninfo = dict()
        data = list()
        for id in ids.split(','):
            scaninfo[id] = dbh.scanInstanceGet(id)
            data = data + dbh.scanResultEvent(id)

        fileobj = StringIO()
        parser = csv.writer(fileobj, dialect=dialect)
        parser.writerow(["Scan Name", "Updated", "Type", "Module", "Source", "Data"])
        for row in data:
            if row[4] == "ROOT":
                continue
            lastseen = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0]))
            datafield = str(row[1]).replace("<SFURL>", "").replace("</SFURL>", "")
            parser.writerow([scaninfo[row[12]][0], lastseen, str(row[4]), str(row[3]), str(row[2]), datafield])
        cherrypy.response.headers['Content-Disposition'] = "attachment; filename=SpiderFoot.csv"
        cherrypy.response.headers['Content-Type'] = "application/csv"
        cherrypy.response.headers['Pragma'] = "no-cache"
        return fileobj.getvalue()
开发者ID:cnlouts,项目名称:spiderfoot,代码行数:23,代码来源:sfwebui.py


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