analyzer: Allow for data to be provided#24
Open
michaelweiser wants to merge 1 commit intoTheHive-Project:masterfrom
Open
analyzer: Allow for data to be provided#24michaelweiser wants to merge 1 commit intoTheHive-Project:masterfrom
michaelweiser wants to merge 1 commit intoTheHive-Project:masterfrom
Conversation
If the user has the file content in a buffer it is more efficient to be able to hand it to the analyzer directly instead of writing it out into a temporary file just to be read back in again by the requests module. Add an observable key 'dataProvided' which can be set to True to change behaviour of run_by_id() and in turn run_by_name() so it uses the 'data' key as observable data directly instead of interpreting it as a file name and opening that file. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If the user has the file content in a buffer it is more efficient to be
able to hand it to the analyzer directly instead of writing it out into
a temporary file just to be read back in again by the requests module.
Add an observable key 'dataProvided' which can be set to True to change
behaviour of run_by_id() and in turn run_by_name() so it uses the 'data'
key as observable data directly instead of interpreting it as a file
name and opening that file.
I didn't want to change behaviour for compatibility which is why I added that new flag key 'dataProvided'. I don't much like it though and would be happy to implement any other logic that'd be acceptable, e.g. using isinstance() to detect if 'data' is a file-like.
I plan to use this functionality here: https://github.com/michaelweiser/PeekabooAV/blob/cf02ed3a891058c669fe8e54b35d352f197f617e/peekaboo/toolbox/cortex.py#L152