Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 10 additions & 5 deletions dirmon/dirmon/dirmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from watchgod import awatch
from typing import Dict, Optional

from stoq import Payload, PayloadMeta
from stoq import Payload, PayloadMeta, Request, RequestMeta
from stoq.plugins import ProviderPlugin
from stoq.helpers import StoqConfigParser
from stoq.exceptions import StoqPluginException
Expand Down Expand Up @@ -57,12 +57,17 @@ async def ingest(self, queue: Queue) -> None:
# Only handle Change.added
if event != 1:
continue
meta = PayloadMeta(
payload_meta = PayloadMeta(
extra_data={
'filename': os.path.basename(src_path)
}
)
request_meta = RequestMeta(
extra_data={
'filename': os.path.basename(src_path),
'source_dir': os.path.dirname(src_path),
}
)
with open(src_path, 'rb') as f:
payload = Payload(f.read(), meta)
await queue.put(payload)
payload = Payload(f.read(), payload_meta)
request = Request([payload], request_meta)
await queue.put(request)
2 changes: 1 addition & 1 deletion dirmon/dirmon/dirmon.stoq
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Module = dirmon

[Documentation]
Author = Marcus LaFerrera
Version = 3.0.0
Version = 3.1.0
Website = https://github.com/PUNCH-Cyber/stoq-plugins-public
Description = Monitor a directory for newly created files for processing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make sense to add a min_stoq_version here, but can't until PUNCH-Cyber/stoq#160 is tagged in a new release... if the new release is 3.0.2, then I would add that here...

Expand Down