Exemple #1
0
    def scanviz(self, id, gexf="0"):
        """Export entities from scan results for visualising

        Args:
            id (str): scan ID
            gexf (str): TBD

        Returns:
            string: GEXF data
        """

        if not id:
            return None

        dbh = SpiderFootDb(self.config)
        data = dbh.scanResultEvent(id, filterFp=True)
        scan = dbh.scanInstanceGet(id)

        if not scan:
            return None

        root = scan[1]

        if gexf == "0":
            return SpiderFootHelpers.buildGraphJson([root], data)

        cherrypy.response.headers['Content-Disposition'] = "attachment; filename=SpiderFoot.gexf"
        cherrypy.response.headers['Content-Type'] = "application/gexf"
        cherrypy.response.headers['Pragma'] = "no-cache"
        return SpiderFootHelpers.buildGraphGexf([root], "SpiderFoot Export", data)
    def test_buildGraphJson_should_return_a_string(self):
        """
        Test buildGraphJson(root, data, flt=list())
        """
        json = SpiderFootHelpers.buildGraphJson('test root', [[
            "test", "test", "test", "test", "test", "test", "test", "test",
            "test", "test", "test", "ENTITY", "test", "test", "test"
        ]])
        self.assertIsInstance(json, str)

        self.assertEqual('TBD', 'TBD')