示例#1
0
 def reset_db():
     remove_PBA_files()
     # We can't drop system collections.
     [
         mongo.db[x].drop() for x in mongo.db.collection_names()
         if not x.startswith('system.')
     ]
     ConfigService.init_config()
     AttackConfig.reset_config()
     logger.info('DB was reset')
     return jsonify(status='OK')
示例#2
0
 def reset_db():
     logger.info("Resetting database")
     # We can't drop system collections.
     [
         Database.drop_collection(x) for x in mongo.db.collection_names()
         if not x.startswith("system.")
         and not x == AttackMitigations.COLLECTION_NAME
     ]
     ConfigService.init_config()
     AttackConfig.reset_config()
     logger.info("DB was reset")
     return jsonify(status="OK")
示例#3
0
文件: database.py 项目: zkbupt/monkey
 def reset_db():
     logger.info('Resetting database')
     remove_PBA_files()
     # We can't drop system collections.
     [
         Database.drop_collection(x) for x in mongo.db.collection_names()
         if not x.startswith('system.')
         and not x == AttackMitigations.COLLECTION_NAME
     ]
     ConfigService.init_config()
     AttackConfig.reset_config()
     logger.info('DB was reset')
     return jsonify(status='OK')
示例#4
0
 def post(self):
     """
     Based on request content this endpoint either resets ATT&CK configuration or updates it.
     :return: Technique types dict with techniques on reset and nothing on update
     """
     config_json = json.loads(request.data)
     if 'reset_attack_matrix' in config_json:
         AttackConfig.reset_config()
         return jsonify(configuration=AttackConfig.get_config()['properties'])
     else:
         AttackConfig.update_config({'properties': json.loads(request.data)})
         AttackConfig.apply_to_monkey_config()
         return {}