[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EVEH5S6P4FFXWSN87PNYWG":3,"skill-same:01M6EVEH5S6P4FFXWSN87PNYWG":113},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":74,"commitSha":75,"skillDirectory":76,"forksCount":14,"repositoryHtmlUrl":77,"repositoryHomepageUrl":78,"ownerHtmlUrl":79,"ownerBlogUrl":6,"ownerDescription":80,"updatedAt":81,"install":82,"resources":95},"01M6EVEH5S6P4FFXWSN87PNYWG","implementing-security-information-sharing-with-stix2",null,"Create, validate, and share STIX 2.1 threat intelligence objects using the stix2 Python library. Covers indicators, malware, campaigns, relationships, bundles, and TAXII 2.1 publishing.","henriquescastilho\u002Fmy-claude","henriquescastilho","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F153296945?v=4","01M6ESH7EXPXTH9CVQ4K16SRG8","Henrique Scheer","01M6ESH7JHEK2PTNNH4HEH787Z",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-security-information-sharing-with-stix2\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"stix2","with","information","security","implementing security information sharing with stix2","sharing","malware","threat-intelligence","library","analysis","create","command","cm","conversion","objects","intelligence","message","de","threat intelligence","cybersecurity","2026-11-10 10:12:30",false,"---\nname: implementing-security-information-sharing-with-stix2\ndescription: 'Create, validate, and share STIX 2.1 threat intelligence objects using\n  the stix2 Python library. Covers indicators, malware, campaigns, relationships,\n  bundles, and TAXII 2.1 publishing.\n\n  '\ndomain: cybersecurity\nsubdomain: threat-intelligence\ntags:\n- stix\n- taxii\n- threat-sharing\n- intelligence-exchange\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nd3fend_techniques:\n- File Metadata Consistency Validation\n- Application Protocol Command Analysis\n- Identifier Analysis\n- Content Format Conversion\n- Message Analysis\nnist_csf:\n- ID.RA-01\n- ID.RA-05\n- DE.CM-01\n- DE.AE-02\nmitre_attack:\n- T1591\n- T1592\n- T1593\n- T1589\n- T1027\n---\n\n# Implementing Security Information Sharing with STIX 2.1\n\nBuild and share structured threat intelligence using STIX 2.1 objects\nwith the stix2 Python library and TAXII 2.1 transport protocol.\n\n## When to Use\n\n- Building a threat intelligence platform that exchanges IOCs with partner organizations\n- Automating ingestion and export of indicators from MISP, OpenCTI, or other TIP platforms\n- Creating machine-readable intelligence reports for ISAC\u002FISAO sharing communities\n- Publishing threat data to a TAXII 2.1 server for downstream consumption by SIEMs and SOARs\n- Converting unstructured threat reports into standardized STIX 2.1 bundles\n- Enriching detection rules with context by linking indicators to malware, campaigns, and threat actors\n\n**Do not use** for sharing simple IP blocklists or CSV-based IOC feeds that do not require relationship context; plain-text feeds with simpler formats like CSV or OpenIOC may be more efficient in those cases.\n\n## Prerequisites\n\n- Python 3.8+ with `stix2` library (`pip install stix2`)\n- `taxii2-client` for consuming TAXII feeds (`pip install taxii2-client`)\n- A TAXII 2.1 server endpoint for publishing (e.g., OpenTAXII, Medallion, or MISP TAXII service)\n- Familiarity with STIX 2.1 SDO types: Indicator, Malware, Threat Actor, Campaign, Attack Pattern, Identity\n- Familiarity with STIX 2.1 SRO types: Relationship, Sighting\n- Optional: OpenCTI or MISP instance for end-to-end integration testing\n\n## Workflow\n\n### Step 1: Install Dependencies\n\n```bash\npip install stix2 taxii2-client requests\n```\n\n### Step 2: Create STIX 2.1 Domain Objects (SDOs)\n\nCreate core intelligence objects that describe threats, actors, and campaigns:\n\n```python\nfrom stix2 import (\n    Indicator, Malware, ThreatActor, Campaign,\n    AttackPattern, Identity, Relationship, Bundle,\n    ExternalReference\n)\nfrom datetime import datetime\n\n# Create a producer identity\nproducer = Identity(\n    name=\"ACME Threat Intel Team\",\n    identity_class=\"organization\",\n    sectors=[\"technology\"],\n    contact_information=\"threatintel@acme.example.com\"\n)\n\n# Create a malware object\nemotet_malware = Malware(\n    name=\"Emotet\",\n    description=\"Banking trojan turned modular botnet loader. \"\n                \"Distributed via malspam with macro-enabled Office documents.\",\n    malware_types=[\"trojan\", \"bot\"],\n    is_family=True,\n    created_by_ref=producer.id\n)\n\n# Create an attack pattern referencing MITRE ATT&CK\nspearphishing_pattern = AttackPattern(\n    name=\"Spearphishing Attachment\",\n    description=\"Adversaries send spearphishing emails with a malicious attachment.\",\n    external_references=[\n        ExternalReference(\n            source_name=\"mitre-attack\",\n            external_id=\"T1566.001\",\n            url=\"https:\u002F\u002Fattack.mitre.org\u002Ftechniques\u002FT1566\u002F001\u002F\"\n        )\n    ],\n    created_by_ref=producer.id\n)\n\n# Create a threat actor\nthreat_actor = ThreatActor(\n    name=\"Mummy Spider\",\n    description=\"Cybercriminal group operating the Emotet botnet infrastructure.\",\n    threat_actor_types=[\"crime-syndicate\"],\n    aliases=[\"TA542\", \"Gold Crestwood\"],\n    primary_motivation=\"personal-gain\",\n    created_by_ref=producer.id\n)\n\n# Create a campaign\ncampaign = Campaign(\n    name=\"Emotet Q1 2026 Resurgence\",\n    description=\"Renewed Emotet distribution campaign using thread-hijacked \"\n                \"reply-chain emails with OneNote lure attachments.\",\n    first_seen=\"2026-01-15T00:00:00Z\",\n    created_by_ref=producer.id\n)\n\nprint(f\"Created malware SDO: {emotet_malware.id}\")\nprint(f\"Created threat actor SDO: {threat_actor.id}\")\nprint(f\"Created campaign SDO: {campaign.id}\")\n```\n\n### Step 3: Create STIX Indicators with Patterns\n\nDefine detection patterns using the STIX Patterning Language:\n\n```python\n# File hash indicator\nhash_indicator = Indicator(\n    name=\"Emotet dropper hash\",\n    description=\"SHA-256 hash of Emotet first-stage dropper observed in Jan 2026 campaign.\",\n    indicator_types=[\"malicious-activity\"],\n    pattern_type=\"stix\",\n    pattern=\"[file:hashes.'SHA-256' = 'a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2']\",\n    valid_from=\"2026-01-15T00:00:00Z\",\n    created_by_ref=producer.id\n)\n\n# Network indicator for C2 domain\nc2_indicator = Indicator(\n    name=\"Emotet C2 domain\",\n    description=\"Command and control domain observed in Emotet tier-1 botnet infrastructure.\",\n    indicator_types=[\"malicious-activity\"],\n    pattern_type=\"stix\",\n    pattern=\"[domain-name:value = 'malicious-c2.example.com']\",\n    valid_from=\"2026-01-20T00:00:00Z\",\n    created_by_ref=producer.id\n)\n\n# Compound pattern: process spawning with suspicious command line\nprocess_indicator = Indicator(\n    name=\"Emotet PowerShell download cradle\",\n    description=\"PowerShell execution pattern used by Emotet to download next-stage payload.\",\n    indicator_types=[\"malicious-activity\"],\n    pattern_type=\"stix\",\n    pattern=(\n        \"[process:command_line MATCHES 'powershell.*-enc.*' \"\n        \"AND process:parent_ref.name = 'winword.exe']\"\n    ),\n    valid_from=\"2026-01-15T00:00:00Z\",\n    created_by_ref=producer.id\n)\n\n# Email subject indicator\nemail_indicator = Indicator(\n    name=\"Emotet phishing subject line pattern\",\n    description=\"Subject line pattern seen in thread-hijacked Emotet phishing emails.\",\n    indicator_types=[\"malicious-activity\"],\n    pattern_type=\"stix\",\n    pattern=\"[email-message:subject MATCHES '^RE:.*Invoice.*[0-9]{6}']\",\n    valid_from=\"2026-01-15T00:00:00Z\",\n    created_by_ref=producer.id\n)\n\nprint(f\"Created {4} indicator objects\")\n```\n\n### Step 4: Build Relationships Between Objects\n\nLink SDOs together using Relationship objects to express how threats are connected:\n\n```python\n# Malware uses attack pattern\nrel_malware_attack = Relationship(\n    relationship_type=\"uses\",\n    source_ref=emotet_malware.id,\n    target_ref=spearphishing_pattern.id,\n    description=\"Emotet is distributed via spearphishing attachments.\",\n    created_by_ref=producer.id\n)\n\n# Threat actor uses malware\nrel_actor_malware = Relationship(\n    relationship_type=\"uses\",\n    source_ref=threat_actor.id,\n    target_ref=emotet_malware.id,\n    description=\"Mummy Spider operates the Emotet malware infrastructure.\",\n    created_by_ref=producer.id\n)\n\n# Indicator indicates malware\nrel_indicator_malware = Relationship(\n    relationship_type=\"indicates\",\n    source_ref=hash_indicator.id,\n    target_ref=emotet_malware.id,\n    description=\"File hash indicator for Emotet dropper binary.\",\n    created_by_ref=producer.id\n)\n\n# Campaign uses malware\nrel_campaign_malware = Relationship(\n    relationship_type=\"uses\",\n    source_ref=campaign.id,\n    target_ref=emotet_malware.id,\n    created_by_ref=producer.id\n)\n\n# Threat actor attributed to campaign\nrel_actor_campaign = Relationship(\n    relationship_type=\"attributed-to\",\n    source_ref=campaign.id,\n    target_ref=threat_actor.id,\n    created_by_ref=producer.id\n)\n\nprint(f\"Created {5} relationship objects linking threat intelligence\")\n```\n\n### Step 5: Assemble and Serialize a STIX Bundle\n\nPackage all objects into a bundle for sharing:\n\n```python\nimport json\n\nbundle = Bundle(\n    objects=[\n        producer,\n        emotet_malware,\n        spearphishing_pattern,\n        threat_actor,\n        campaign,\n        hash_indicator,\n        c2_indicator,\n        process_indicator,\n        email_indicator,\n        rel_malware_attack,\n        rel_actor_malware,\n        rel_indicator_malware,\n        rel_campaign_malware,\n        rel_actor_campaign,\n    ]\n)\n\n# Serialize to JSON\nbundle_json = bundle.serialize(pretty=True)\n\n# Write bundle to file for sharing\nwith open(\"emotet_campaign_bundle.json\", \"w\") as f:\n    f.write(bundle_json)\n\nprint(f\"Bundle {bundle.id} contains {len(bundle.objects)} objects\")\nprint(f\"Written to emotet_campaign_bundle.json\")\n\n# Validate the bundle by re-parsing\nfrom stix2 import parse\nparsed = parse(bundle_json, allow_custom=False)\nprint(f\"Bundle validation passed: {len(parsed.objects)} objects parsed successfully\")\n```\n\n### Step 6: Consume Intelligence from a TAXII 2.1 Server\n\nRetrieve published threat intelligence from a TAXII feed:\n\n```python\nfrom taxii2client.v21 import Server, Collection, as_pages\nimport json\n\n# Connect to a TAXII 2.1 server\ntaxii_server = Server(\n    \"https:\u002F\u002Ftaxii.example.com\u002Ftaxii2\u002F\",\n    user=\"readonly\",\n    password=\"readonly_password\"\n)\n\n# Discover API roots and collections\napi_root = taxii_server.api_roots[0]\nprint(f\"API Root: {api_root.title}\")\n\nfor collection in api_root.collections:\n    print(f\"  Collection: {collection.title} (ID: {collection.id})\")\n\n# Fetch indicators from a specific collection\ntarget_collection = Collection(\n    f\"https:\u002F\u002Ftaxii.example.com\u002Ftaxii2\u002Fcollections\u002F{api_root.collections[0].id}\u002F\",\n    user=\"readonly\",\n    password=\"readonly_password\"\n)\n\n# Retrieve objects with filtering\nresponse = target_collection.get_objects(\n    added_after=\"2026-01-01T00:00:00Z\",\n    type=[\"indicator\", \"malware\"]\n)\n\nstix_data = json.loads(response.text)\nprint(f\"Retrieved {len(stix_data.get('objects', []))} objects from TAXII server\")\n\n# Process each retrieved object\nfor obj in stix_data.get(\"objects\", []):\n    if obj[\"type\"] == \"indicator\":\n        print(f\"  Indicator: {obj['name']} | Pattern: {obj['pattern'][:60]}...\")\n    elif obj[\"type\"] == \"malware\":\n        print(f\"  Malware: {obj['name']} | Family: {obj.get('is_family', False)}\")\n```\n\n### Step 7: Publish Intelligence to a TAXII 2.1 Server\n\nPush your STIX bundle to a writable TAXII collection:\n\n```python\nimport requests\nimport json\n\nTAXII_URL = \"https:\u002F\u002Ftaxii.example.com\u002Ftaxii2\u002Fcollections\u002FCOLLECTION_ID\u002Fobjects\u002F\"\nTAXII_USER = \"publisher\"\nTAXII_PASS = \"publisher_password\"\n\nheaders = {\n    \"Content-Type\": \"application\u002Ftaxii+json;version=2.1\",\n    \"Accept\": \"application\u002Ftaxii+json;version=2.1\"\n}\n\n# Read the bundle we created earlier\nwith open(\"emotet_campaign_bundle.json\", \"r\") as f:\n    bundle_data = f.read()\n\nresponse = requests.post(\n    TAXII_URL,\n    headers=headers,\n    auth=(TAXII_USER, TAXII_PASS),\n    data=bundle_data,\n    timeout=30\n)\n\nif response.status_code in (200, 201, 202):\n    status = response.json()\n    print(f\"Published successfully. Status ID: {status.get('id')}\")\n    print(f\"  Total count: {status.get('total_count')}\")\n    print(f\"  Success count: {status.get('success_count')}\")\n    print(f\"  Failure count: {status.get('failure_count')}\")\nelse:\n    print(f\"Publishing failed: {response.status_code} - {response.text}\")\n```\n\n### Step 8: Validate and Lint STIX Objects\n\nEnsure objects comply with the STIX 2.1 specification:\n\n```python\nfrom stix2 import parse, exceptions\nimport json\n\ndef validate_stix_bundle(bundle_path):\n    \"\"\"Validate all objects in a STIX bundle against the 2.1 spec.\"\"\"\n    with open(bundle_path, \"r\") as f:\n        raw = json.load(f)\n\n    errors = []\n    valid_count = 0\n\n    for obj in raw.get(\"objects\", []):\n        try:\n            parsed = parse(json.dumps(obj), allow_custom=False)\n            valid_count += 1\n        except (exceptions.InvalidValueError, exceptions.MissingPropertiesError) as e:\n            errors.append({\n                \"object_id\": obj.get(\"id\", \"unknown\"),\n                \"object_type\": obj.get(\"type\", \"unknown\"),\n                \"error\": str(e)\n            })\n\n    print(f\"Validation results: {valid_count} valid, {len(errors)} errors\")\n    for err in errors:\n        print(f\"  ERROR in {err['object_type']} ({err['object_id']}): {err['error']}\")\n\n    return len(errors) == 0\n\nvalidate_stix_bundle(\"emotet_campaign_bundle.json\")\n```\n\n## Verification\n\n- Confirm all STIX objects serialize to valid JSON and include required properties (`type`, `id`, `created`, `modified`)\n- Verify relationship `source_ref` and `target_ref` point to existing object IDs within the bundle\n- Validate indicator patterns parse correctly using the STIX patterning grammar\n- Test TAXII publishing returns a success status with `success_count` matching the number of objects sent\n- Re-retrieve published objects from the TAXII server and confirm they round-trip without data loss\n- Check that consuming systems (SIEM, SOAR, TIP) can ingest the bundle and create corresponding detection rules or enrichment data\n- Run `stix2-validator` CLI tool against exported bundles: `stix2_validator emotet_campaign_bundle.json`\n","# Implementing Security Information Sharing with STIX 2.1\n\nBuild and share structured threat intelligence using STIX 2.1 objects\nwith the stix2 Python library and TAXII 2.1 transport protocol.\n\n## When to Use\n\n- Building a threat intelligence platform that exchanges IOCs with partner organizations\n- Automating ingestion and export of indicators from MISP, OpenCTI, or other TIP platforms\n- Creating machine-readable intelligence reports for ISAC\u002FISAO sharing communities\n- Publishing threat data to a TAXII 2.1 server for downstream consumption by SIEMs and SOARs\n- Converting unstructured threat reports into standardized STIX 2.1 bundles\n- Enriching detection rules with context by linking indicators to malware, campaigns, and threat actors\n\n**Do not use** for sharing simple IP blocklists or CSV-based IOC feeds that do not require relationship context; plain-text feeds with simpler formats like CSV or OpenIOC may be more efficient in those cases.\n\n## Prerequisites\n\n- Python 3.8+ with `stix2` library (`pip install stix2`)\n- `taxii2-client` for consuming TAXII feeds (`pip install taxii2-client`)\n- A TAXII 2.1 server endpoint for publishing (e.g., OpenTAXII, Medallion, or MISP TAXII service)\n- Familiarity with STIX 2.1 SDO types: Indicator, Malware, Threat Actor, Campaign, Attack Pattern, Identity\n- Familiarity with STIX 2.1 SRO types: Relationship, Sighting\n- Optional: OpenCTI or MISP instance for end-to-end integration testing\n\n## Workflow\n\n### Step 1: Install Dependencies\n\n```bash\npip install stix2 taxii2-client requests\n```\n\n### Step 2: Create STIX 2.1 Domain Objects (SDOs)\n\nCreate core intelligence objects that describe threats, actors, and campaigns:\n\n```python\nfrom stix2 import (\n    Indicator, Malware, ThreatActor, Campaign,\n    AttackPattern, Identity, Relationship, Bundle,\n    ExternalReference\n)\nfrom datetime import datetime\n\n# Create a producer identity\nproducer = Identity(\n    name=\"ACME Threat Intel Team\",\n    identity_class=\"organization\",\n    sectors=[\"technology\"],\n    contact_information=\"threatintel@acme.example.com\"\n)\n\n# Create a malware object\nemotet_malware = Malware(\n    name=\"Emotet\",\n    description=\"Banking trojan turned modular botnet loader. \"\n                \"Distributed via malspam with macro-enabled Office documents.\",\n    malware_types=[\"trojan\", \"bot\"],\n    is_family=True,\n    created_by_ref=producer.id\n)\n\n# Create an attack pattern referencing MITRE ATT&CK\nspearphishing_pattern = AttackPattern(\n    name=\"Spearphishing Attachment\",\n    description=\"Adversaries send spearphishing emails with a malicious attachment.\",\n    external_references=[\n        ExternalReference(\n            source_name=\"mitre-attack\",\n            external_id=\"T1566.001\",\n            url=\"https:\u002F\u002Fattack.mitre.org\u002Ftechniques\u002FT1566\u002F001\u002F\"\n        )\n    ],\n    created_by_ref=producer.id\n)\n\n# Create a threat actor\nthreat_actor = ThreatActor(\n    name=\"Mummy Spider\",\n    description=\"Cybercriminal group operating the Emotet botnet infrastructure.\",\n    threat_actor_types=[\"crime-syndicate\"],\n    aliases=[\"TA542\", \"Gold Crestwood\"],\n    primary_motivation=\"personal-gain\",\n    created_by_ref=producer.id\n)\n\n# Create a campaign\ncampaign = Campaign(\n    name=\"Emotet Q1 2026 Resurgence\",\n    description=\"Renewed Emotet distribution campaign using thread-hijacked \"\n                \"reply-chain emails with OneNote lure attachments.\",\n    first_seen=\"2026-01-15T00:00:00Z\",\n    created_by_ref=producer.id\n)\n\nprint(f\"Created malware SDO: {emotet_malware.id}\")\nprint(f\"Created threat actor SDO: {threat_actor.id}\")\nprint(f\"Created campaign SDO: {campaign.id}\")\n```\n\n### Step 3: Create STIX Indicators with Patterns\n\nDefine detection patterns using the STIX Patterning Language:\n\n```python\n# File hash indicator\nhash_indicator = Indicator(\n    name=\"Emotet dropper hash\",\n    description=\"SHA-256 hash of Emotet first-stage dropper observed in Jan 2026 campaign.\",\n    indicator_types=[\"malicious-activity\"],\n    pattern_type=\"stix\",\n    pattern=\"[file:hashes.'SHA-256' = 'a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2']\",\n    valid_from=\"2026-01-15T00:00:00Z\",\n    created_by_ref=producer.id\n)\n\n# Network indicator for C2 domain\nc2_indicator = Indicator(\n    name=\"Emotet C2 domain\",\n    description=\"Command and control domain observed in Emotet tier-1 botnet infrastructure.\",\n    indicator_types=[\"malicious-activity\"],\n    pattern_type=\"stix\",\n    pattern=\"[domain-name:value = 'malicious-c2.example.com']\",\n    valid_from=\"2026-01-20T00:00:00Z\",\n    created_by_ref=producer.id\n)\n\n# Compound pattern: process spawning with suspicious command line\nprocess_indicator = Indicator(\n    name=\"Emotet PowerShell download cradle\",\n    description=\"PowerShell execution pattern used by Emotet to download next-stage payload.\",\n    indicator_types=[\"malicious-activity\"],\n    pattern_type=\"stix\",\n    pattern=(\n        \"[process:command_line MATCHES 'powershell.*-enc.*' \"\n        \"AND process:parent_ref.name = 'winword.exe']\"\n    ),\n    valid_from=\"2026-01-15T00:00:00Z\",\n    created_by_ref=producer.id\n)\n\n# Email subject indicator\nemail_indicator = Indicator(\n    name=\"Emotet phishing subject line pattern\",\n    description=\"Subject line pattern seen in thread-hijacked Emotet phishing emails.\",\n    indicator_types=[\"malicious-activity\"],\n    pattern_type=\"stix\",\n    pattern=\"[email-message:subject MATCHES '^RE:.*Invoice.*[0-9]{6}']\",\n    valid_from=\"2026-01-15T00:00:00Z\",\n    created_by_ref=producer.id\n)\n\nprint(f\"Created {4} indicator objects\")\n```\n\n### Step 4: Build Relationships Between Objects\n\nLink SDOs together using Relationship objects to express how threats are connected:\n\n```python\n# Malware uses attack pattern\nrel_malware_attack = Relationship(\n    relationship_type=\"uses\",\n    source_ref=emotet_malware.id,\n    target_ref=spearphishing_pattern.id,\n    description=\"Emotet is distributed via spearphishing attachments.\",\n    created_by_ref=producer.id\n)\n\n# Threat actor uses malware\nrel_actor_malware = Relationship(\n    relationship_type=\"uses\",\n    source_ref=threat_actor.id,\n    target_ref=emotet_malware.id,\n    description=\"Mummy Spider operates the Emotet malware infrastructure.\",\n    created_by_ref=producer.id\n)\n\n# Indicator indicates malware\nrel_indicator_malware = Relationship(\n    relationship_type=\"indicates\",\n    source_ref=hash_indicator.id,\n    target_ref=emotet_malware.id,\n    description=\"File hash indicator for Emotet dropper binary.\",\n    created_by_ref=producer.id\n)\n\n# Campaign uses malware\nrel_campaign_malware = Relationship(\n    relationship_type=\"uses\",\n    source_ref=campaign.id,\n    target_ref=emotet_malware.id,\n    created_by_ref=producer.id\n)\n\n# Threat actor attributed to campaign\nrel_actor_campaign = Relationship(\n    relationship_type=\"attributed-to\",\n    source_ref=campaign.id,\n    target_ref=threat_actor.id,\n    created_by_ref=producer.id\n)\n\nprint(f\"Created {5} relationship objects linking threat intelligence\")\n```\n\n### Step 5: Assemble and Serialize a STIX Bundle\n\nPackage all objects into a bundle for sharing:\n\n```python\nimport json\n\nbundle = Bundle(\n    objects=[\n        producer,\n        emotet_malware,\n        spearphishing_pattern,\n        threat_actor,\n        campaign,\n        hash_indicator,\n        c2_indicator,\n        process_indicator,\n        email_indicator,\n        rel_malware_attack,\n        rel_actor_malware,\n        rel_indicator_malware,\n        rel_campaign_malware,\n        rel_actor_campaign,\n    ]\n)\n\n# Serialize to JSON\nbundle_json = bundle.serialize(pretty=True)\n\n# Write bundle to file for sharing\nwith open(\"emotet_campaign_bundle.json\", \"w\") as f:\n    f.write(bundle_json)\n\nprint(f\"Bundle {bundle.id} contains {len(bundle.objects)} objects\")\nprint(f\"Written to emotet_campaign_bundle.json\")\n\n# Validate the bundle by re-parsing\nfrom stix2 import parse\nparsed = parse(bundle_json, allow_custom=False)\nprint(f\"Bundle validation passed: {len(parsed.objects)} objects parsed successfully\")\n```\n\n### Step 6: Consume Intelligence from a TAXII 2.1 Server\n\nRetrieve published threat intelligence from a TAXII feed:\n\n```python\nfrom taxii2client.v21 import Server, Collection, as_pages\nimport json\n\n# Connect to a TAXII 2.1 server\ntaxii_server = Server(\n    \"https:\u002F\u002Ftaxii.example.com\u002Ftaxii2\u002F\",\n    user=\"readonly\",\n    password=\"readonly_password\"\n)\n\n# Discover API roots and collections\napi_root = taxii_server.api_roots[0]\nprint(f\"API Root: {api_root.title}\")\n\nfor collection in api_root.collections:\n    print(f\"  Collection: {collection.title} (ID: {collection.id})\")\n\n# Fetch indicators from a specific collection\ntarget_collection = Collection(\n    f\"https:\u002F\u002Ftaxii.example.com\u002Ftaxii2\u002Fcollections\u002F{api_root.collections[0].id}\u002F\",\n    user=\"readonly\",\n    password=\"readonly_password\"\n)\n\n# Retrieve objects with filtering\nresponse = target_collection.get_objects(\n    added_after=\"2026-01-01T00:00:00Z\",\n    type=[\"indicator\", \"malware\"]\n)\n\nstix_data = json.loads(response.text)\nprint(f\"Retrieved {len(stix_data.get('objects', []))} objects from TAXII server\")\n\n# Process each retrieved object\nfor obj in stix_data.get(\"objects\", []):\n    if obj[\"type\"] == \"indicator\":\n        print(f\"  Indicator: {obj['name']} | Pattern: {obj['pattern'][:60]}...\")\n    elif obj[\"type\"] == \"malware\":\n        print(f\"  Malware: {obj['name']} | Family: {obj.get('is_family', False)}\")\n```\n\n### Step 7: Publish Intelligence to a TAXII 2.1 Server\n\nPush your STIX bundle to a writable TAXII collection:\n\n```python\nimport requests\nimport json\n\nTAXII_URL = \"https:\u002F\u002Ftaxii.example.com\u002Ftaxii2\u002Fcollections\u002FCOLLECTION_ID\u002Fobjects\u002F\"\nTAXII_USER = \"publisher\"\nTAXII_PASS = \"publisher_password\"\n\nheaders = {\n    \"Content-Type\": \"application\u002Ftaxii+json;version=2.1\",\n    \"Accept\": \"application\u002Ftaxii+json;version=2.1\"\n}\n\n# Read the bundle we created earlier\nwith open(\"emotet_campaign_bundle.json\", \"r\") as f:\n    bundle_data = f.read()\n\nresponse = requests.post(\n    TAXII_URL,\n    headers=headers,\n    auth=(TAXII_USER, TAXII_PASS),\n    data=bundle_data,\n    timeout=30\n)\n\nif response.status_code in (200, 201, 202):\n    status = response.json()\n    print(f\"Published successfully. Status ID: {status.get('id')}\")\n    print(f\"  Total count: {status.get('total_count')}\")\n    print(f\"  Success count: {status.get('success_count')}\")\n    print(f\"  Failure count: {status.get('failure_count')}\")\nelse:\n    print(f\"Publishing failed: {response.status_code} - {response.text}\")\n```\n\n### Step 8: Validate and Lint STIX Objects\n\nEnsure objects comply with the STIX 2.1 specification:\n\n```python\nfrom stix2 import parse, exceptions\nimport json\n\ndef validate_stix_bundle(bundle_path):\n    \"\"\"Validate all objects in a STIX bundle against the 2.1 spec.\"\"\"\n    with open(bundle_path, \"r\") as f:\n        raw = json.load(f)\n\n    errors = []\n    valid_count = 0\n\n    for obj in raw.get(\"objects\", []):\n        try:\n            parsed = parse(json.dumps(obj), allow_custom=False)\n            valid_count += 1\n        except (exceptions.InvalidValueError, exceptions.MissingPropertiesError) as e:\n            errors.append({\n                \"object_id\": obj.get(\"id\", \"unknown\"),\n                \"object_type\": obj.get(\"type\", \"unknown\"),\n                \"error\": str(e)\n            })\n\n    print(f\"Validation results: {valid_count} valid, {len(errors)} errors\")\n    for err in errors:\n        print(f\"  ERROR in {err['object_type']} ({err['object_id']}): {err['error']}\")\n\n    return len(errors) == 0\n\nvalidate_stix_bundle(\"emotet_campaign_bundle.json\")\n```\n\n## Verification\n\n- Confirm all STIX objects serialize to valid JSON and include required properties (`type`, `id`, `created`, `modified`)\n- Verify relationship `source_ref` and `target_ref` point to existing object IDs within the bundle\n- Validate indicator patterns parse correctly using the STIX patterning grammar\n- Test TAXII publishing returns a success status with `success_count` matching the number of objects sent\n- Re-retrieve published objects from the TAXII server and confirm they round-trip without data loss\n- Check that consuming systems (SIEM, SOAR, TIP) can ingest the bundle and create corresponding detection rules or enrichment data\n- Run `stix2-validator` CLI tool against exported bundles: `stix2_validator emotet_campaign_bundle.json`\n",{"name":5,"tags":49,"author":54,"domain":43,"license":15,"version":55,"nist_csf":56,"subdomain":31,"description":61,"mitre_attack":62,"d3fend_techniques":68},[50,51,52,53],"stix","taxii","threat-sharing","intelligence-exchange","mahipal","1.0",[57,58,59,60],"ID.RA-01","ID.RA-05","DE.CM-01","DE.AE-02","Create, validate, and share STIX 2.1 threat intelligence objects using the stix2 Python library. Covers indicators, malware, campaigns, relationships, bundles, and TAXII 2.1 publishing.\n",[63,64,65,66,67],"T1591","T1592","T1593","T1589","T1027",[69,70,71,72,73],"File Metadata Consistency Validation","Application Protocol Command Analysis","Identifier Analysis","Content Format Conversion","Message Analysis","main","7925716f065257435fdb12e97f7e52842147d5ad",".claude\u002Fskills\u002Fimplementing-security-information-sharing-with-stix2","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude","https:\u002F\u002Fclaude.com\u002Fclaude-code","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho","Software · Applied AI · Quantitative Modeling · Building with Claude.","2026-06-10 12:24:46",{"source":8,"skillName":5,"commands":83,"prompt":93,"zipAvailable":94},[84,87,90],{"tool":85,"command":86},"npx","npx skills add henriquescastilho\u002Fmy-claude --skill implementing-security-information-sharing-with-stix2",{"tool":88,"command":89},"bunx","bunx skills add henriquescastilho\u002Fmy-claude --skill implementing-security-information-sharing-with-stix2",{"tool":91,"command":92},"pnpm","pnpm dlx skills add henriquescastilho\u002Fmy-claude --skill implementing-security-information-sharing-with-stix2","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-security-information-sharing-with-stix2\u002FSKILL.md",true,[96,101,107],{"path":97,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":99,"sourceHtmlUrl":100},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-security-information-sharing-with-stix2\u002FLICENSE",{"path":102,"resourceType":103,"resourceTypeDesc":104,"sizeBytes":105,"sourceHtmlUrl":106},"references\u002Fapi-reference.md","REFERENCE","参考文档",2070,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-security-information-sharing-with-stix2\u002Freferences\u002Fapi-reference.md",{"path":108,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":111,"sourceHtmlUrl":112},"scripts\u002Fagent.py","SCRIPT","脚本",7185,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-security-information-sharing-with-stix2\u002Fscripts\u002Fagent.py",[114,154,163,172,194,219],{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":118,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":135,"publishedAt":44},"01M6F0B6XPQ65AX2X0DWK8KT3E","markitdown","Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.","MIT","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[121,124,127,130],{"categoryNo":122,"categoryName":123,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理",{"categoryNo":125,"categoryName":126,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":128,"categoryName":129,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000004","电子表格",{"categoryNo":131,"categoryName":132,"taxonomyType":133,"taxonomyTypeDesc":134},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[116,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,25],"docx","PDF","pptx","xlsx","documents","csv","ocr","Audio","Bash","markdown","convert","read","write","edit","html","images","files","youtube",{"skillNo":155,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":118,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":162,"publishedAt":44},"01M6F06SBHR9F0SDWE282Y8075","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002Fscientific_writer\u002F.claude\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[158,159,160,161],{"categoryNo":122,"categoryName":123,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":125,"categoryName":126,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":128,"categoryName":129,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":131,"categoryName":132,"taxonomyType":133,"taxonomyTypeDesc":134},[116,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,25],{"skillNo":164,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":118,"licenseFileUrl":6,"sourceHtmlUrl":165,"categories":166,"keywords":171,"publishedAt":44},"01M6F02D4R14EJAPBWVDF9J9VQ","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002F.claude\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[167,168,169,170],{"categoryNo":122,"categoryName":123,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":125,"categoryName":126,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":128,"categoryName":129,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":131,"categoryName":132,"taxonomyType":133,"taxonomyTypeDesc":134},[116,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,25],{"skillNo":173,"name":174,"nameZh":6,"description":175,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":118,"licenseFileUrl":6,"sourceHtmlUrl":176,"categories":177,"keywords":178,"publishedAt":44},"01M6F000KS6YB4MKS774G4R8ND","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fzarr-python\u002FSKILL.md",[],[179,180,181,182,183,184,185,186,187,188,189,190,191,192,193],"python","zarr python","storage","integration","s3","gcs","cloud","dask","parallel","pipelines","arrays","numpy","scientific computing","scale","scientific",{"skillNo":195,"name":196,"nameZh":6,"description":197,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":118,"licenseFileUrl":6,"sourceHtmlUrl":198,"categories":199,"keywords":201,"publishedAt":44},"01M6EZZJWFXM1GR78KTW6J0DN8","what-if-oracle","Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like \"what if...\", \"what would happen if...\", \"what are the possibilities\", \"explore scenarios\", \"scenario analysis\", \"possibility space\", \"what could go wrong\", \"best case \u002F worst case\", \"risk analysis\", \"contingency planning\", \"strategic options\", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fwhat-if-oracle\u002FSKILL.md",[200],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[202,203,204,205,206,207,33,208,209,210,211,147,148,212,213,214,215,216,217,218],"oracle","what if oracle","go","run","ux","futures","explore","decision","branch","question","idea","exploration","options","stress-test","strategies","scenario","stress",{"skillNo":220,"name":221,"nameZh":6,"description":222,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":118,"licenseFileUrl":6,"sourceHtmlUrl":223,"categories":224,"keywords":235,"publishedAt":44},"01M6EZZCXAEB49RXGQCJX5E8GB","venue-templates","Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fvenue-templates\u002FSKILL.md",[225,228,231,232],{"categoryNo":226,"categoryName":227,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":229,"categoryName":230,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000021","资料检索与研究",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":233,"categoryName":234,"taxonomyType":133,"taxonomyTypeDesc":134},"01JBSEEDCAT000000000000036","内容创作者",[236,237,238,239,240,241,242,243,144,244,147,148,149,245,246,247,248,249,193,250],"templates","venue templates","research","guidelines","NeurIPS","ICML","LaTeX","science","access","proposals","Academic","requirements","formatting","journal","chi"]