Skip to content

sample_search_in_mongo_conf #2550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions conf/default/web.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ anon_viewable = no
existent_tasks = no
top_detections = yes
top_asn = yes
# Check for file in mongodb on submit before fetch from 3rd party. This is useful when you want to try to find file on disk, but when mongodb is too big might better to disable.
check_sample_in_mongodb = no
# hostname of the cape instance
hostname = 127.0.0.1
;hostname = www.capesandbox.com
Expand Down
8 changes: 4 additions & 4 deletions lib/cuckoo/core/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2352,7 +2352,9 @@ def sample_path_by_hash(self, sample_hash: str = False, task_id: int = False):
if path_exists(path):
sample = [path]

if not sample:

if not sample and web_conf.general.check_sample_in_mongodb:
tasks = []
if repconf.mongodb.enabled:
tasks = mongo_find(
"analysis",
Expand All @@ -2368,8 +2370,6 @@ def sample_path_by_hash(self, sample_hash: str = False, task_id: int = False):
_source=["CAPE.payloads", "info.id"],
)["hits"]["hits"]
]
else:
tasks = []

if tasks:
for task in tasks:
Expand Down Expand Up @@ -2443,7 +2443,7 @@ def sample_path_by_hash(self, sample_hash: str = False, task_id: int = False):
sample = [path]
break

if not sample:
if not sample and web_conf.general.check_sample_in_mongodb:
# search in Suricata files folder
if repconf.mongodb.enabled:
tasks = mongo_find(
Expand Down
Loading