STIX2
Introduction¶
The stix2 module allows to use the RisklistMgr, LookupMgr and AnalystNoteMgr and transform their output into STIX2 compatible format.
See the API Reference for internal details of the module.
Examples¶
Warning
Below are some examples of usage of the module. Consider adding error handling as necessary. All the errors that can be raised by each method or function are specified in the API Reference page.
Also, you need to configure the RF_TOKEN environment variable before starting. See Learn.
Example 1: Transform an analyst note as STIX RFBundle.¶
In this example we are taking an analyst note with ID o6_lui using the AnalystNoteMgr.lookup method, fetching the attachment with the AnalystNoteMgr.fetch_attachment method and we create the bundle with the RFBundle.from_analyst_note method.
This create an object that can be serialized with the serialize method and written to file.
Example 2: Transform a risklist as STIX RFBundle.¶
Similar to example 1, in this example we are using the RisklistMgr.fetch_risklist method to fetch the IP risklist recentLinkedToAPT. We validate the entries returned with the validate argument and the risklist returned is generates the bundle with RFBundle.from_default_risklist.
The bundle is then saved to file after being serialized.
Example 3: Transform enriched IOCs as STIX RFBundles.¶
In this example we use the LookupMgr to enrich 4 IOCs using the links, riskMapping and aiInsights fields. For each IOC, if it has been eneriched, an EnrichedIndicator object is created, and the related bundle is saved to file.