Command Sequence API. Closes #471#478
Merged
regulartim merged 4 commits intointelowlproject:developfrom Feb 24, 2025
Merged
Conversation
mlodic
approved these changes
Feb 24, 2025
api/views/command_sequence.py
Outdated
Comment on lines
+59
to
+60
| "executed commands": seqs, | ||
| "executed by": sorted([ioc.name for ioc in related_iocs]), |
Member
There was a problem hiding this comment.
can you use underscore instead of spaces? just to avoid possible problems somewhere
|
|
||
| Args: | ||
| request: The HTTP request object containing query parameters | ||
|
|
Member
There was a problem hiding this comment.
observable and include_similar are missing in the docstring. I undestand that technically the only parameter is request but, based on how the documentation works, it makes sense to add them like you did for the advanced feeds
api/views/command_sequence.py
Outdated
| """ | ||
| observable = request.query_params.get("query") | ||
| include_similar = request.query_params.get("include_similar") is not None | ||
| logger.info(f"Command Sequence view requested for: {str(observable)}") |
Member
There was a problem hiding this comment.
it would be great to log the request.user too here to track it
api/views/command_sequence.py
Outdated
| if is_ip_address(observable): | ||
| sessions = CowrieSession.objects.filter(source__name=observable, start_time__isnull=False, commands__isnull=False) | ||
| sequences = set(s.commands for s in sessions) | ||
| seqs = [{"time": s.start_time, "command sequence": "\n".join(s.commands.commands), "command sequence hash": s.commands.commands_hash} for s in sessions] |
Member
There was a problem hiding this comment.
_ here too if possible in the keys
Collaborator
Author
|
Thanks for the review! :) Will do all of that and merge afterwards. |
Member
|
I added a new issue to integrate these new endpoints to IntelOwl too intelowlproject/IntelOwl#2768 |
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.
Description
New API that lets you (1) get all executed commands for a specific IP address or (2) get all IP addresses that executed a specific command. Also supports fuzzy matching of commands by including commands from the same cluster. Will update the docs later this week.
Related issues
Type of change
Checklist
develop.Black,Flake,Isort) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.Important Rules