-
Notifications
You must be signed in to change notification settings - Fork 295
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
Feat: Add support for running Censys queries via analytics #988
Conversation
Related PR for the frontend: yeti-platform/yeti-feeds-frontend#142 |
plugins/analytics/public/censys.py
Outdated
ip_object.tag(query.relevant_tags) | ||
query.link_to(ip_object, 'censys', f'IP found with Censys query: {query.pattern}') | ||
|
||
def query_censys(self, api, query: str) -> set[str]: |
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.
def query_censys(self, api, query: str) -> set[str]: | |
def query_censys(self, api: CensysHosts, query: str) -> set[str]: |
plugins/analytics/public/censys.py
Outdated
hosts_api = CensysHosts( | ||
api_id=yeti_config.get("censys", "api_key"), | ||
api_secret=yeti_config.get("censys", "secret") | ||
) |
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.
Please check that these two config settings are set and bail with a warning (logging.warning) if they're 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.
Please give it a ruff formatter pass (We'll add a github action check soon)
tests/analytics_test.py
Outdated
class AnalyticsTest(unittest.TestCase): | ||
@classmethod | ||
def setUpClass(cls) -> None: | ||
database_arango.db.connect(database="yeti-test") |
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.
database_arango.db.connect(database="yeti-test") | |
database_arango.db.connect(database="yeti_test") |
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.
Same comment as the other file, please give this a ruff formatter pass
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, thanks!!
This allows Yeti users to add Censys queries as indicators, which will then be ran through the Censys API every 24 hours, tagging the identified IP addresses in Yeti. This will allow for infrastructure tracking/hunting directly from within Yeti.