Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Rewrite Zeek plugin to convert to/from STIX-2 Indicators and Sightings #103

Merged
merged 19 commits into from
Mar 16, 2021

Conversation

0snap
Copy link
Contributor

@0snap 0snap commented Mar 4, 2021

📔 Description

Following up on the STIX-2 rewrite of Threat Bus: this PR updates the Zeek plugin.

  • Convert STIX-2 Indicators to Zeek/Broker events
  • Update Zeek script to consume Zeek/Broker events & ingest in Intel framework
  • Convert sightings / matches from Zeek (Broker events) to STIX-2 valid Sightings
  • Updated unit tests
  • Integration-test the Zeek-plugin's Broker interface in isolation
  • Integration-test with a full Zeek instance that runs the Threat Bus app script
  • Update / separate from ZMQ message-passing integration test

📝 Checklist

  • All user-facing changes have changelog entries.
  • The changes are reflected on docs.tenzir.com/threatbus, if necessary.
  • The PR description contains instructions for the reviewer, if necessary.

🎯 Review Instructions

Do at least a code-review & run the unit tests. If you want to try out more, here is how:

Integration testing:
You require a local Broker installation with Python bindings for integration testing

  • Follow the instructions from the Zeek plugin's README
  • Run the integration tests

Interactive usage:
You require local Zeek and Broker installations with Python bindings for interactive usage

  • Make sure your local Zeek and Broker installations have matching versions (i.e., Zeek 4 -> Broker 2.x, Zeek 3.2 -> Broker 1.4)
  • Start Threat Bus with the Zeek plugin, in-mem backbone plugin, and the Zmq-app plugin
  • Start a local Zeek instance using the Threat Bus app script and monitor your local network interface (sudo zeek -i wlp0s20f3 -C apps/zeek/threatbus.zeek)
  • Use the test utils to send STIX-2 indicators to the Zmq-endpoint -> that should ultimately be mapped via Broker and arrive in Zeek. Send something like example.com.
  • Use curl or similar to invoke example.com -> Zeek should match that immediately, report a Sighting to Threat Bus and that should be logged as valid STIX-2 (debug logging)

@lgtm-com
Copy link

lgtm-com bot commented Mar 4, 2021

This pull request introduces 2 alerts when merging 5ac2124 into 1ba54e7 - view on LGTM.com

new alerts:

  • 2 for Unused import

@0snap 0snap force-pushed the story/ch22586 branch 3 times, most recently from 03f3bd0 to 4e940bc Compare March 4, 2021 10:51
@lgtm-com
Copy link

lgtm-com bot commented Mar 4, 2021

This pull request introduces 2 alerts when merging 5cba369 into bf33351 - view on LGTM.com

new alerts:

  • 2 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Mar 4, 2021

This pull request introduces 2 alerts when merging 90b452f into a082f2d - view on LGTM.com

new alerts:

  • 2 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Mar 4, 2021

This pull request introduces 2 alerts when merging 73b3762 into a082f2d - view on LGTM.com

new alerts:

  • 2 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Mar 4, 2021

This pull request introduces 1 alert when merging b4d40a5 into a082f2d - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'

Base automatically changed from story/ch22586 to master March 8, 2021 09:46
@lgtm-com
Copy link

lgtm-com bot commented Mar 8, 2021

This pull request introduces 1 alert when merging b4d40a5 into 5ad3665 - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'

@lgtm-com
Copy link

lgtm-com bot commented Mar 8, 2021

This pull request introduces 1 alert when merging 67c46e0 into 5ad3665 - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'

@lgtm-com
Copy link

lgtm-com bot commented Mar 9, 2021

This pull request introduces 1 alert when merging ce57817 into 5ad3665 - view on LGTM.com

new alerts:

  • 1 for Except block handles 'BaseException'

@0snap 0snap added bug Incorrect behavior feature New functionality labels Mar 10, 2021
@0snap 0snap requested review from mavam and tobim March 10, 2021 10:07
@0snap 0snap marked this pull request as ready for review March 10, 2021 10:07
@tobim tobim self-assigned this Mar 11, 2021
Copy link
Member

@tobim tobim left a comment

Choose a reason for hiding this comment

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

I tested this locally and can vouch that sightings are logged from threatbus when zeek detects them.

I didn't do a very thorough code review, most of it is in tests which are repetitive by nature. I only have a few suggestions and questions which can be resolved by adding comments.

@0snap 0snap requested a review from tobim March 16, 2021 13:27
Copy link
Member

@tobim tobim left a comment

Choose a reason for hiding this comment

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

Tested again with the latest changes. Everything seems to work as expected.

@0snap 0snap merged commit e94196a into master Mar 16, 2021
@0snap 0snap deleted the story/ch22585 branch March 16, 2021 14:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Incorrect behavior feature New functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants