-
Notifications
You must be signed in to change notification settings - Fork 591
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
Added import stream object for more flexible data upload #1004
Conversation
This is still WIP, just uploading to demonstrate a bit where I was going with this. Still need to test it (haven't tested it once), which will most likely results in some unit tests being added as well as major or minor changes to the actual code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First round of comments.
string_items.append('{0:s} = {{0!s}}'.format(column)) | ||
format_message_string = ' '.join(string_items) | ||
|
||
response = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe rename to streamer_response ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
return 'No return value.' | ||
|
||
return_lines = [] | ||
for timesketch_object in response.get('objects', []): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sketch_object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
timesketch/api/v1/resources.py
Outdated
@@ -1368,6 +1369,50 @@ def post(self, sketch_id): | |||
annotations, status_code=HTTP_STATUS_CODE_CREATED) | |||
|
|||
|
|||
class AnalyzerPipelineResource(ResourceMixin, Resource): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we want to extend this to also accept an analyzer name? So we can run a specific analyzer instead of all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is already supported in the AnalyzerRunResource
Decided to do this differently, removed this entire resource, merged it with the run resource, and made it so that we can run a single or multiple analyzers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also deleted the form so that we now just use request.json instead of the form
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, SG
# Create the search index in the Timesketch database | ||
searchindex = SearchIndex.get_or_create( | ||
# Check if search index already exists. | ||
searchindex = SearchIndex.query.filter_by( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, why not use get_or_create() here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to create one here if it doesn't exist, only querying whether it exists or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
@@ -0,0 +1,201 @@ | |||
# Create Timeline From Other Sources |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kudos for great documentation :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
;)
there are some TODOs there though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done with round
string_items.append('{0:s} = {{0!s}}'.format(column)) | ||
format_message_string = ' '.join(string_items) | ||
|
||
response = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
return 'No return value.' | ||
|
||
return_lines = [] | ||
for timesketch_object in response.get('objects', []): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
@@ -0,0 +1,201 @@ | |||
# Create Timeline From Other Sources |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
;)
there are some TODOs there though
timesketch/api/v1/resources.py
Outdated
@@ -1368,6 +1369,50 @@ def post(self, sketch_id): | |||
annotations, status_code=HTTP_STATUS_CODE_CREATED) | |||
|
|||
|
|||
class AnalyzerPipelineResource(ResourceMixin, Resource): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is already supported in the AnalyzerRunResource
Decided to do this differently, removed this entire resource, merged it with the run resource, and made it so that we can run a single or multiple analyzers.
timesketch/api/v1/resources.py
Outdated
@@ -1368,6 +1369,50 @@ def post(self, sketch_id): | |||
annotations, status_code=HTTP_STATUS_CODE_CREATED) | |||
|
|||
|
|||
class AnalyzerPipelineResource(ResourceMixin, Resource): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also deleted the form so that we now just use request.json instead of the form
# Create the search index in the Timesketch database | ||
searchindex = SearchIndex.get_or_create( | ||
# Check if search index already exists. | ||
searchindex = SearchIndex.query.filter_by( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to create one here if it doesn't exist, only querying whether it exists or not.
@berggren PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one small thing, otherwise LG
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Adding an import stream object that has the ability to:
Other features: