Skip to content
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

Improve ransomware.live connector #2746

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

seanthegeek
Copy link

@seanthegeek seanthegeek commented Oct 1, 2024

Proposed changes

  • Properly handle empty sector values
  • Do not create threat actor objects by default
    • They were wasteful duplicates of Intrusion Sets and not threat actors in terms of STIX definitions
  • Fix typos
  • Fix README tables

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality using different use cases
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

- Properly handle empty sector values
- Do not create threat actor objects by default
  - They were wasteful duplicates of Intrusion Sets and not threat actors in terms of STIX
- Fix typos
- Fix README tables
@seanthegeek
Copy link
Author

How do I properly test this connector on my development system? This PR should work, but I'm keeping the PR in draft status until I can properly test it.

{"timestamp": "2024-10-01T23:54:16.228980Z", "level": "ERROR", "name": "pika.adapters.utils.connection_workflow", "message": "AMQP connection workflow failed: AMQPConnectionWorkflowFailed: 1 exceptions in all; last exception - gaierror(11001, 'getaddrinfo failed'); first exception - None.", "taskName": null}
{"timestamp": "2024-10-01T23:54:16.228980Z", "level": "ERROR", "name": "pika.adapters.utils.connection_workflow", "message": "AMQPConnectionWorkflow - reporting failure: AMQPConnectionWorkflowFailed: 1 exceptions in all; last exception - gaierror(11001, 'getaddrinfo failed'); first exception - None", "taskName": null}
{"timestamp": "2024-10-01T23:54:16.228980Z", "level": "ERROR", "name": "pika.adapters.blocking_connection", "message": "Connection workflow failed: AMQPConnectionWorkflowFailed: 1 exceptions in all; last exception - gaierror(11001, 'getaddrinfo failed'); first exception - None", "taskName": null}

@seanthegeek
Copy link
Author

I was able to test is by creating a local docker image, but that's not ideal if I want to walk through the Python code in a debugger

Now I'm getting an exception that states "File data is not a valid bundle"

{"timestamp": "2024-10-02T00:30:20.182278Z", "level": "ERROR", "name": "ransomware.live", "message": "Error sending STIX2 bundle to OpenCTI", "exc_info": "Traceback (most recent call last):\n  File \"/opt/connector/lib/ransomConn.py\", line 960, in run\n    self.helper.send_stix2_bundle(\n  File \"/usr/local/lib/python3.11/site-packages/pycti/connector/opencti_connector_helper.py\", line 1699, in send_stix2_bundle\n    ) = stix2_splitter.split_bundle_with_expectations(\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/local/lib/python3.11/site-packages/pycti/utils/opencti_stix2_splitter.py\", line 215, in split_bundle_with_expectations\n    raise Exception(\"File data is not a valid bundle\")\nException: File data is not a valid bundle"}

Any suggestions for tracking down where my PR went wrong?

@seanthegeek seanthegeek marked this pull request as ready for review October 2, 2024 02:53
@seanthegeek
Copy link
Author

All issues have been fixed.

@yassine-ouaamou yassine-ouaamou added the community use to identify PR from community label Oct 3, 2024
Copy link
Member

@Powlinett Powlinett left a comment

Choose a reason for hiding this comment

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

Hi @seanthegeek thank you for submitting a PR and improvements!

I managed to resolve conflicts locally by keeping your changes and pycti.<ENTITY_CLASS>.generate_id() functions calls from master.🤞

I had to add "filterGroups": [] on line ~320 (in filterGroups[0]) to avoid errors returned by OpenCTI API, and now everything seems to work as intended 👍

May I ask you to resolve conflicts and fix the filters tiny issue on your repo so we can merge your PR? Thanks 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community use to identify PR from community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants