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

Add OpenCTI Connector Charms #3

Open
wants to merge 77 commits into
base: main
Choose a base branch
from
Open

Add OpenCTI Connector Charms #3

wants to merge 77 commits into from

Conversation

weiiwang01
Copy link
Collaborator

Overview

Add the framework for OpenCTI connector charms, including a charm library that serves as the foundation for all OpenCTI connector charms and a template for generating OpenCTI connector charm projects.

This pull request also introduces 18 connector charms.

Crowdstrike
Sekoia
VirusTotal
AbuseIPDB
MISP Feed
MalwareBazaar Recent Additions
CISA Know Exploited Vulnerabilities
urlscan.io
Cyber Campaign Collection
URLHaus
AlienVault
VX Vault
Mitre ATT&CK
Import Document
Import File STIX
Export File CSV
Export File STIX
Export File TXT

Rationale

Juju Events Changes

Module Changes

Library Changes

Checklist

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has checked 153 files.

Valid Invalid Ignored Fixed
14 75 64 0
Click to see the invalid file list
  • connectors/abuseipdb_ipblacklist/charmcraft.yaml
  • connectors/abuseipdb_ipblacklist/lib/charms/opencti/v0/opencti_connector.py
  • connectors/abuseipdb_ipblacklist/rock/rockcraft.yaml
  • connectors/abuseipdb_ipblacklist/src/charm.py
  • connectors/alienvault/charmcraft.yaml
  • connectors/alienvault/lib/charms/opencti/v0/opencti_connector.py
  • connectors/alienvault/rock/rockcraft.yaml
  • connectors/alienvault/src/charm.py
  • connectors/cisa_known_exploited_vulnerabilities/charmcraft.yaml
  • connectors/cisa_known_exploited_vulnerabilities/lib/charms/opencti/v0/opencti_connector.py
  • connectors/cisa_known_exploited_vulnerabilities/rock/rockcraft.yaml
  • connectors/cisa_known_exploited_vulnerabilities/src/charm.py
  • connectors/crowdstrike/charmcraft.yaml
  • connectors/crowdstrike/lib/charms/opencti/v0/opencti_connector.py
  • connectors/crowdstrike/rock/rockcraft.yaml
  • connectors/crowdstrike/src/charm.py
  • connectors/cyber_campaign_collection/charmcraft.yaml
  • connectors/cyber_campaign_collection/lib/charms/opencti/v0/opencti_connector.py
  • connectors/cyber_campaign_collection/rock/rockcraft.yaml
  • connectors/cyber_campaign_collection/src/charm.py
  • connectors/export_file_csv/charmcraft.yaml
  • connectors/export_file_csv/lib/charms/opencti/v0/opencti_connector.py
  • connectors/export_file_csv/rock/rockcraft.yaml
  • connectors/export_file_csv/src/charm.py
  • connectors/export_file_stix/charmcraft.yaml
  • connectors/export_file_stix/lib/charms/opencti/v0/opencti_connector.py
  • connectors/export_file_stix/rock/rockcraft.yaml
  • connectors/export_file_stix/src/charm.py
  • connectors/export_file_txt/charmcraft.yaml
  • connectors/export_file_txt/lib/charms/opencti/v0/opencti_connector.py
  • connectors/export_file_txt/rock/rockcraft.yaml
  • connectors/export_file_txt/src/charm.py
  • connectors/import_document/charmcraft.yaml
  • connectors/import_document/lib/charms/opencti/v0/opencti_connector.py
  • connectors/import_document/rock/rockcraft.yaml
  • connectors/import_document/src/charm.py
  • connectors/import_file_stix/charmcraft.yaml
  • connectors/import_file_stix/lib/charms/opencti/v0/opencti_connector.py
  • connectors/import_file_stix/rock/rockcraft.yaml
  • connectors/import_file_stix/src/charm.py
  • connectors/malwarebazaar_recent_additions/charmcraft.yaml
  • connectors/malwarebazaar_recent_additions/lib/charms/opencti/v0/opencti_connector.py
  • connectors/malwarebazaar_recent_additions/rock/rockcraft.yaml
  • connectors/malwarebazaar_recent_additions/src/charm.py
  • connectors/misp_feed/charmcraft.yaml
  • connectors/misp_feed/lib/charms/opencti/v0/opencti_connector.py
  • connectors/misp_feed/rock/rockcraft.yaml
  • connectors/misp_feed/src/charm.py
  • connectors/mitre/charmcraft.yaml
  • connectors/mitre/lib/charms/opencti/v0/opencti_connector.py
  • connectors/mitre/rock/rockcraft.yaml
  • connectors/mitre/src/charm.py
  • connectors/sekoia/charmcraft.yaml
  • connectors/sekoia/lib/charms/opencti/v0/opencti_connector.py
  • connectors/sekoia/rock/rockcraft.yaml
  • connectors/sekoia/src/charm.py
  • connectors/urlscan/charmcraft.yaml
  • connectors/urlscan/lib/charms/opencti/v0/opencti_connector.py
  • connectors/urlscan/rock/rockcraft.yaml
  • connectors/urlscan/src/charm.py
  • connectors/urlscan_enrichment/charmcraft.yaml
  • connectors/urlscan_enrichment/lib/charms/opencti/v0/opencti_connector.py
  • connectors/urlscan_enrichment/rock/rockcraft.yaml
  • connectors/urlscan_enrichment/src/charm.py
  • connectors/virustotal_livehunt_notifications/charmcraft.yaml
  • connectors/virustotal_livehunt_notifications/lib/charms/opencti/v0/opencti_connector.py
  • connectors/virustotal_livehunt_notifications/rock/rockcraft.yaml
  • connectors/virustotal_livehunt_notifications/src/charm.py
  • connectors/vxvault/charmcraft.yaml
  • connectors/vxvault/lib/charms/opencti/v0/opencti_connector.py
  • connectors/vxvault/rock/rockcraft.yaml
  • connectors/vxvault/src/charm.py
  • scripts/gen_connector_charm.py
  • src/opencti.py
  • tests/unit/test_connectors.py
Use this command to fix any missing license headers
```bash

docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix

</details>

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has checked 153 files.

Valid Invalid Ignored Fixed
17 72 64 0
Click to see the invalid file list
  • connectors/abuseipdb_ipblacklist/charmcraft.yaml
  • connectors/abuseipdb_ipblacklist/lib/charms/opencti/v0/opencti_connector.py
  • connectors/abuseipdb_ipblacklist/rock/rockcraft.yaml
  • connectors/abuseipdb_ipblacklist/src/charm.py
  • connectors/alienvault/charmcraft.yaml
  • connectors/alienvault/lib/charms/opencti/v0/opencti_connector.py
  • connectors/alienvault/rock/rockcraft.yaml
  • connectors/alienvault/src/charm.py
  • connectors/cisa_kve/charmcraft.yaml
  • connectors/cisa_kve/lib/charms/opencti/v0/opencti_connector.py
  • connectors/cisa_kve/rock/rockcraft.yaml
  • connectors/cisa_kve/src/charm.py
  • connectors/crowdstrike/charmcraft.yaml
  • connectors/crowdstrike/lib/charms/opencti/v0/opencti_connector.py
  • connectors/crowdstrike/rock/rockcraft.yaml
  • connectors/crowdstrike/src/charm.py
  • connectors/cyber_campaign/charmcraft.yaml
  • connectors/cyber_campaign/lib/charms/opencti/v0/opencti_connector.py
  • connectors/cyber_campaign/rock/rockcraft.yaml
  • connectors/cyber_campaign/src/charm.py
  • connectors/export_file_csv/charmcraft.yaml
  • connectors/export_file_csv/lib/charms/opencti/v0/opencti_connector.py
  • connectors/export_file_csv/rock/rockcraft.yaml
  • connectors/export_file_csv/src/charm.py
  • connectors/export_file_stix/charmcraft.yaml
  • connectors/export_file_stix/lib/charms/opencti/v0/opencti_connector.py
  • connectors/export_file_stix/rock/rockcraft.yaml
  • connectors/export_file_stix/src/charm.py
  • connectors/export_file_txt/charmcraft.yaml
  • connectors/export_file_txt/lib/charms/opencti/v0/opencti_connector.py
  • connectors/export_file_txt/rock/rockcraft.yaml
  • connectors/export_file_txt/src/charm.py
  • connectors/import_document/charmcraft.yaml
  • connectors/import_document/lib/charms/opencti/v0/opencti_connector.py
  • connectors/import_document/rock/rockcraft.yaml
  • connectors/import_document/src/charm.py
  • connectors/import_file_stix/charmcraft.yaml
  • connectors/import_file_stix/lib/charms/opencti/v0/opencti_connector.py
  • connectors/import_file_stix/rock/rockcraft.yaml
  • connectors/import_file_stix/src/charm.py
  • connectors/malwarebazaar/charmcraft.yaml
  • connectors/malwarebazaar/lib/charms/opencti/v0/opencti_connector.py
  • connectors/malwarebazaar/rock/rockcraft.yaml
  • connectors/malwarebazaar/src/charm.py
  • connectors/misp_feed/charmcraft.yaml
  • connectors/misp_feed/lib/charms/opencti/v0/opencti_connector.py
  • connectors/misp_feed/rock/rockcraft.yaml
  • connectors/misp_feed/src/charm.py
  • connectors/mitre/charmcraft.yaml
  • connectors/mitre/lib/charms/opencti/v0/opencti_connector.py
  • connectors/mitre/rock/rockcraft.yaml
  • connectors/mitre/src/charm.py
  • connectors/sekoia/charmcraft.yaml
  • connectors/sekoia/lib/charms/opencti/v0/opencti_connector.py
  • connectors/sekoia/rock/rockcraft.yaml
  • connectors/sekoia/src/charm.py
  • connectors/urlscan/charmcraft.yaml
  • connectors/urlscan/lib/charms/opencti/v0/opencti_connector.py
  • connectors/urlscan/rock/rockcraft.yaml
  • connectors/urlscan/src/charm.py
  • connectors/urlscan_enrichment/charmcraft.yaml
  • connectors/urlscan_enrichment/lib/charms/opencti/v0/opencti_connector.py
  • connectors/urlscan_enrichment/rock/rockcraft.yaml
  • connectors/urlscan_enrichment/src/charm.py
  • connectors/virustotal_livehunt/charmcraft.yaml
  • connectors/virustotal_livehunt/lib/charms/opencti/v0/opencti_connector.py
  • connectors/virustotal_livehunt/rock/rockcraft.yaml
  • connectors/virustotal_livehunt/src/charm.py
  • connectors/vxvault/charmcraft.yaml
  • connectors/vxvault/lib/charms/opencti/v0/opencti_connector.py
  • connectors/vxvault/rock/rockcraft.yaml
  • connectors/vxvault/src/charm.py
Use this command to fix any missing license headers
```bash

docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix

</details>

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has checked 153 files.

Valid Invalid Ignored Fixed
17 72 64 0
Click to see the invalid file list
  • connectors/abuseipdb_ipblacklist/charmcraft.yaml
  • connectors/abuseipdb_ipblacklist/lib/charms/opencti/v0/opencti_connector.py
  • connectors/abuseipdb_ipblacklist/rock/rockcraft.yaml
  • connectors/abuseipdb_ipblacklist/src/charm.py
  • connectors/alienvault/charmcraft.yaml
  • connectors/alienvault/lib/charms/opencti/v0/opencti_connector.py
  • connectors/alienvault/rock/rockcraft.yaml
  • connectors/alienvault/src/charm.py
  • connectors/cisa_kve/charmcraft.yaml
  • connectors/cisa_kve/lib/charms/opencti/v0/opencti_connector.py
  • connectors/cisa_kve/rock/rockcraft.yaml
  • connectors/cisa_kve/src/charm.py
  • connectors/crowdstrike/charmcraft.yaml
  • connectors/crowdstrike/lib/charms/opencti/v0/opencti_connector.py
  • connectors/crowdstrike/rock/rockcraft.yaml
  • connectors/crowdstrike/src/charm.py
  • connectors/cyber_campaign/charmcraft.yaml
  • connectors/cyber_campaign/lib/charms/opencti/v0/opencti_connector.py
  • connectors/cyber_campaign/rock/rockcraft.yaml
  • connectors/cyber_campaign/src/charm.py
  • connectors/export_file_csv/charmcraft.yaml
  • connectors/export_file_csv/lib/charms/opencti/v0/opencti_connector.py
  • connectors/export_file_csv/rock/rockcraft.yaml
  • connectors/export_file_csv/src/charm.py
  • connectors/export_file_stix/charmcraft.yaml
  • connectors/export_file_stix/lib/charms/opencti/v0/opencti_connector.py
  • connectors/export_file_stix/rock/rockcraft.yaml
  • connectors/export_file_stix/src/charm.py
  • connectors/export_file_txt/charmcraft.yaml
  • connectors/export_file_txt/lib/charms/opencti/v0/opencti_connector.py
  • connectors/export_file_txt/rock/rockcraft.yaml
  • connectors/export_file_txt/src/charm.py
  • connectors/import_document/charmcraft.yaml
  • connectors/import_document/lib/charms/opencti/v0/opencti_connector.py
  • connectors/import_document/rock/rockcraft.yaml
  • connectors/import_document/src/charm.py
  • connectors/import_file_stix/charmcraft.yaml
  • connectors/import_file_stix/lib/charms/opencti/v0/opencti_connector.py
  • connectors/import_file_stix/rock/rockcraft.yaml
  • connectors/import_file_stix/src/charm.py
  • connectors/malwarebazaar/charmcraft.yaml
  • connectors/malwarebazaar/lib/charms/opencti/v0/opencti_connector.py
  • connectors/malwarebazaar/rock/rockcraft.yaml
  • connectors/malwarebazaar/src/charm.py
  • connectors/misp_feed/charmcraft.yaml
  • connectors/misp_feed/lib/charms/opencti/v0/opencti_connector.py
  • connectors/misp_feed/rock/rockcraft.yaml
  • connectors/misp_feed/src/charm.py
  • connectors/mitre/charmcraft.yaml
  • connectors/mitre/lib/charms/opencti/v0/opencti_connector.py
  • connectors/mitre/rock/rockcraft.yaml
  • connectors/mitre/src/charm.py
  • connectors/sekoia/charmcraft.yaml
  • connectors/sekoia/lib/charms/opencti/v0/opencti_connector.py
  • connectors/sekoia/rock/rockcraft.yaml
  • connectors/sekoia/src/charm.py
  • connectors/urlscan/charmcraft.yaml
  • connectors/urlscan/lib/charms/opencti/v0/opencti_connector.py
  • connectors/urlscan/rock/rockcraft.yaml
  • connectors/urlscan/src/charm.py
  • connectors/urlscan_enrichment/charmcraft.yaml
  • connectors/urlscan_enrichment/lib/charms/opencti/v0/opencti_connector.py
  • connectors/urlscan_enrichment/rock/rockcraft.yaml
  • connectors/urlscan_enrichment/src/charm.py
  • connectors/virustotal_livehunt/charmcraft.yaml
  • connectors/virustotal_livehunt/lib/charms/opencti/v0/opencti_connector.py
  • connectors/virustotal_livehunt/rock/rockcraft.yaml
  • connectors/virustotal_livehunt/src/charm.py
  • connectors/vxvault/charmcraft.yaml
  • connectors/vxvault/lib/charms/opencti/v0/opencti_connector.py
  • connectors/vxvault/rock/rockcraft.yaml
  • connectors/vxvault/src/charm.py
Use this command to fix any missing license headers
```bash

docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix

</details>

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has checked 153 files.

Valid Invalid Ignored Fixed
17 72 64 0
Click to see the invalid file list
  • connectors/abuseipdb_ipblacklist/charmcraft.yaml
  • connectors/abuseipdb_ipblacklist/lib/charms/opencti/v0/opencti_connector.py
  • connectors/abuseipdb_ipblacklist/rock/rockcraft.yaml
  • connectors/abuseipdb_ipblacklist/src/charm.py
  • connectors/alienvault/charmcraft.yaml
  • connectors/alienvault/lib/charms/opencti/v0/opencti_connector.py
  • connectors/alienvault/rock/rockcraft.yaml
  • connectors/alienvault/src/charm.py
  • connectors/cisa_kve/charmcraft.yaml
  • connectors/cisa_kve/lib/charms/opencti/v0/opencti_connector.py
  • connectors/cisa_kve/rock/rockcraft.yaml
  • connectors/cisa_kve/src/charm.py
  • connectors/crowdstrike/charmcraft.yaml
  • connectors/crowdstrike/lib/charms/opencti/v0/opencti_connector.py
  • connectors/crowdstrike/rock/rockcraft.yaml
  • connectors/crowdstrike/src/charm.py
  • connectors/cyber_campaign/charmcraft.yaml
  • connectors/cyber_campaign/lib/charms/opencti/v0/opencti_connector.py
  • connectors/cyber_campaign/rock/rockcraft.yaml
  • connectors/cyber_campaign/src/charm.py
  • connectors/export_file_csv/charmcraft.yaml
  • connectors/export_file_csv/lib/charms/opencti/v0/opencti_connector.py
  • connectors/export_file_csv/rock/rockcraft.yaml
  • connectors/export_file_csv/src/charm.py
  • connectors/export_file_stix/charmcraft.yaml
  • connectors/export_file_stix/lib/charms/opencti/v0/opencti_connector.py
  • connectors/export_file_stix/rock/rockcraft.yaml
  • connectors/export_file_stix/src/charm.py
  • connectors/export_file_txt/charmcraft.yaml
  • connectors/export_file_txt/lib/charms/opencti/v0/opencti_connector.py
  • connectors/export_file_txt/rock/rockcraft.yaml
  • connectors/export_file_txt/src/charm.py
  • connectors/import_document/charmcraft.yaml
  • connectors/import_document/lib/charms/opencti/v0/opencti_connector.py
  • connectors/import_document/rock/rockcraft.yaml
  • connectors/import_document/src/charm.py
  • connectors/import_file_stix/charmcraft.yaml
  • connectors/import_file_stix/lib/charms/opencti/v0/opencti_connector.py
  • connectors/import_file_stix/rock/rockcraft.yaml
  • connectors/import_file_stix/src/charm.py
  • connectors/malwarebazaar/charmcraft.yaml
  • connectors/malwarebazaar/lib/charms/opencti/v0/opencti_connector.py
  • connectors/malwarebazaar/rock/rockcraft.yaml
  • connectors/malwarebazaar/src/charm.py
  • connectors/misp_feed/charmcraft.yaml
  • connectors/misp_feed/lib/charms/opencti/v0/opencti_connector.py
  • connectors/misp_feed/rock/rockcraft.yaml
  • connectors/misp_feed/src/charm.py
  • connectors/mitre/charmcraft.yaml
  • connectors/mitre/lib/charms/opencti/v0/opencti_connector.py
  • connectors/mitre/rock/rockcraft.yaml
  • connectors/mitre/src/charm.py
  • connectors/sekoia/charmcraft.yaml
  • connectors/sekoia/lib/charms/opencti/v0/opencti_connector.py
  • connectors/sekoia/rock/rockcraft.yaml
  • connectors/sekoia/src/charm.py
  • connectors/urlscan/charmcraft.yaml
  • connectors/urlscan/lib/charms/opencti/v0/opencti_connector.py
  • connectors/urlscan/rock/rockcraft.yaml
  • connectors/urlscan/src/charm.py
  • connectors/urlscan_enrichment/charmcraft.yaml
  • connectors/urlscan_enrichment/lib/charms/opencti/v0/opencti_connector.py
  • connectors/urlscan_enrichment/rock/rockcraft.yaml
  • connectors/urlscan_enrichment/src/charm.py
  • connectors/virustotal_livehunt/charmcraft.yaml
  • connectors/virustotal_livehunt/lib/charms/opencti/v0/opencti_connector.py
  • connectors/virustotal_livehunt/rock/rockcraft.yaml
  • connectors/virustotal_livehunt/src/charm.py
  • connectors/vxvault/charmcraft.yaml
  • connectors/vxvault/lib/charms/opencti/v0/opencti_connector.py
  • connectors/vxvault/rock/rockcraft.yaml
  • connectors/vxvault/src/charm.py
Use this command to fix any missing license headers
```bash

docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix

</details>

@@ -8,5 +8,14 @@ jobs:
uses: canonical/operator-workflows/.github/workflows/test.yaml@main
secrets: inherit
with:
self-hosted-runner: true
self-hosted-runner-label: "edge"
self-hosted-runner: false
Copy link

Choose a reason for hiding this comment

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

I think our team should be using the edge self hosted runners.

Copy link

Choose a reason for hiding this comment

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

Missing newline at the end of the file.


name: opencti-abuseipdb-ipblacklist-connector
title: OpenCTI abuseipdb ipblacklist Charm
summary: OpenCTI abuseipdb ipblacklist charm.
Copy link

Choose a reason for hiding this comment

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

I think this summary is a bit unclear.

Copy link

Choose a reason for hiding this comment

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

I think our team generally add newline to end of file.

Copy link

Choose a reason for hiding this comment

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

No newline at the end of multiple files.


name: opencti-alienvault-connector
title: OpenCTI AlienVault Charm
summary: OpenCTI AlienVault charm.
Copy link

Choose a reason for hiding this comment

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

I think this can be a one line summary on what this charm is for.

# Conflicts:
#	.woke.yaml
#	charmcraft.yaml
#	src/charm.py
#	tests/conftest.py
#	tests/integration/conftest.py
#	tests/integration/test_charm.py
#	tests/unit/conftest.py
#	tests/unit/state.py
#	tests/unit/test_charm.py
Copy link

Test coverage for dc90606

Name             Stmts   Miss Branch BrPart  Cover   Missing
------------------------------------------------------------
src/charm.py       302     32     78     11    86%   129, 204-216, 234-235, 452-453, 540-546, 664, 668, 673, 688, 690->686, 696, 716, 731-732, 735->739, 740-742
src/opencti.py      64     42     14      0    28%   58-61, 82-93, 101-134, 149-194, 202-224, 237-460
------------------------------------------------------------
TOTAL              366     74     92     11    76%

Static code analysis report

Run started:2025-01-15 13:28:47.924054

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 1068
  Total lines skipped (#nosec): 3
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants