Beispiel #1
0
    def generate_new_report():
        """
        Generates new report based on telemetries, replaces old report in db with new one.
        :return: Report object
        """
        report =\
            {
                'techniques': {},
                'meta': {'latest_monkey_modifytime': Monkey.get_latest_modifytime()},
                'name': REPORT_NAME
            }

        for tech_id, value in AttackConfig.get_technique_values().items():
            if value:
                try:
                    report['techniques'].update(
                        {tech_id: TECHNIQUES[tech_id].get_report_data()})
                except KeyError as e:
                    LOG.error(
                        "Attack technique does not have it's report component added "
                        "to attack report service. %s" % e)
        mongo.db.attack_report.replace_one({'name': REPORT_NAME},
                                           report,
                                           upsert=True)
        return report
Beispiel #2
0
 def _is_enabled_in_config(cls) -> bool:
     return AttackConfig.get_technique_values()[cls.tech_id]