Skip to content

Commit

Permalink
add yara desription and name
Browse files Browse the repository at this point in the history
  • Loading branch information
sebdraven committed Mar 29, 2024
1 parent e15914f commit fc857f6
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 1 deletion.
14 changes: 14 additions & 0 deletions plugins/feeds/public/otx_alienvault.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from core import taskmanager
from core.config.config import yeti_config
from core.schemas import entity, indicator, observable, task
import yara


class OTXAlienvault(task.FeedTask):
Expand Down Expand Up @@ -106,6 +107,19 @@ def analyze(self, item):
# sometimes the content is empty
if not otx_indic["content"]:
continue
r = None
try:
r = yara.compile(source=otx_indic["content"])

except Exception as e:
logging.error(f"Error compiling YARA rule: {e}")
continue

for t in r:
ind_obj.name = t.identifier
if "description" in t.meta:
ind_obj.description = t.meta["description"]

ind_obj.pattern = otx_indic["content"]
ind_obj.save()
investigation.link_to(ind_obj, "Observed", "OTXAlienVault")
Expand Down
91 changes: 90 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ authlib = "^1.2.1"
itsdangerous = "^2.1.2"
pyyaml = "^6.0.1"
parameterized = "^0.9.0"
yara-python = "^4.5.0"

[tool.poetry.group.dev.dependencies]
pylint = "^2.16.1"
Expand Down

0 comments on commit fc857f6

Please sign in to comment.