def api_create_yara():
"""
Add a new yara
@arg name: the yara name
@arg rule: the full text of the rule
@arg tlp_level: Optional, the sensibility of the rule.
Default = TLP AMBER
"""
tlp_level = None
data = request.json
name = data["name"]
rule = data["rule"]
if 'tlp_level' in data.keys():
tlp_level = data["tlp_level"]
if tlp_level is None:
tlp_level = TLPLevel.TLPAMBER
result = api.yaracontrol.create(name, rule, tlp_level)
if result is None or not result:
abort(500, "Cannot create yara rule")
return jsonify({"id": result.id})
评论列表
文章目录