[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78TT82SW7N1V6AZ70R09MHZ":3,"skill-same:01M78TT82SW7N1V6AZ70R09MHZ":94},{"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":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":44,"updatedAt":45,"install":46,"resources":59},"01M78TT82SW7N1V6AZ70R09MHZ","performing-malware-ioc-extraction",null,"Malware IOC extraction is the process of analyzing malicious software to identify actionable indicators of compromise including file hashes, network indicators (C2 domains, IP addresses, URLs), regist","jukeyman\u002Fjukeyman-skills","jukeyman","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F142960420?v=4","01M78FR4Y3DHMMCBCC0GXXNB3F","RICK JEFFERSON","01M78FR4Z8RVQRAD31Y5J7V6EB",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-malware-ioc-extraction\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-malware-ioc-extraction\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: performing-malware-ioc-extraction\ndescription: Malware IOC extraction is the process of analyzing malicious software to identify actionable indicators of compromise including file hashes, network indicators (C2 domains, IP addresses, URLs), regist\ndomain: cybersecurity\nsubdomain: threat-intelligence\ntags: [threat-intelligence, cti, ioc, mitre-attack, stix, malware-analysis, yara, reverse-engineering]\nversion: \"1.0\"\nauthor: mahipal\nlicense: Apache-2.0\n---\n# Performing Malware IOC Extraction\n\n## Overview\n\nMalware IOC extraction is the process of analyzing malicious software to identify actionable indicators of compromise including file hashes, network indicators (C2 domains, IP addresses, URLs), registry modifications, mutex names, embedded strings, and behavioral artifacts. This skill covers static analysis with PE parsing and string extraction, dynamic analysis with sandbox detonation, automated IOC extraction using tools like YARA, and formatting results as STIX 2.1 indicators for sharing.\n\n\n## When to Use\n\n- When conducting security assessments that involve performing malware ioc extraction\n- When following incident response procedures for related security events\n- When performing scheduled security testing or auditing activities\n- When validating security controls through hands-on testing\n\n## Prerequisites\n\n- Python 3.9+ with `pefile`, `yara-python`, `oletools`, `stix2` libraries\n- Access to malware analysis sandbox (Cuckoo, CAPE, Any.Run, Joe Sandbox)\n- VirusTotal API key for enrichment\n- Isolated analysis environment (VM or container)\n- Understanding of PE file format, common packing techniques\n- Familiarity with YARA rule syntax\n\n## Key Concepts\n\n### Static Analysis IOCs\n- **File Hashes**: MD5, SHA-1, SHA-256 of the sample and any dropped files\n- **Import Hash (imphash)**: Hash of imported function table, groups malware families\n- **Rich Header Hash**: PE rich header hash for compiler fingerprinting\n- **Strings**: Embedded URLs, IP addresses, domain names, registry paths, mutex names\n- **PE Metadata**: Compilation timestamp, section names, resources, digital signatures\n- **Embedded Artifacts**: PDB paths, version info, certificate details\n\n### Dynamic Analysis IOCs\n- **Network Activity**: DNS queries, HTTP requests, TCP\u002FUDP connections, SSL certificates\n- **File System**: Created\u002Fmodified\u002Fdeleted files and directories\n- **Registry**: Created\u002Fmodified registry keys and values\n- **Process**: Spawned processes, injected processes, service creation\n- **Behavioral**: API calls, mutex creation, scheduled tasks, persistence mechanisms\n\n### YARA Rules\nYARA is a pattern-matching tool for identifying and classifying malware. Rules consist of strings (text, hex, regex) and conditions that define matching logic. Rules can detect malware families, packers, exploit kits, and specific campaign tools.\n\n## Workflow\n\n### Step 1: Static Analysis - PE Parsing and Hash Generation\n\n```python\nimport pefile\nimport hashlib\nimport os\n\ndef analyze_pe(filepath):\n    \"\"\"Extract IOCs from a PE file through static analysis.\"\"\"\n    iocs = {\"hashes\": {}, \"pe_info\": {}, \"strings\": [], \"imports\": []}\n\n    # Calculate file hashes\n    with open(filepath, \"rb\") as f:\n        data = f.read()\n    iocs[\"hashes\"][\"md5\"] = hashlib.md5(data).hexdigest()\n    iocs[\"hashes\"][\"sha1\"] = hashlib.sha1(data).hexdigest()\n    iocs[\"hashes\"][\"sha256\"] = hashlib.sha256(data).hexdigest()\n    iocs[\"hashes\"][\"file_size\"] = len(data)\n\n    # Parse PE headers\n    try:\n        pe = pefile.PE(filepath)\n        iocs[\"hashes\"][\"imphash\"] = pe.get_imphash()\n        iocs[\"pe_info\"][\"compilation_time\"] = str(pe.FILE_HEADER.TimeDateStamp)\n        iocs[\"pe_info\"][\"machine_type\"] = hex(pe.FILE_HEADER.Machine)\n        iocs[\"pe_info\"][\"subsystem\"] = pe.OPTIONAL_HEADER.Subsystem\n\n        # Extract sections\n        iocs[\"pe_info\"][\"sections\"] = []\n        for section in pe.sections:\n            iocs[\"pe_info\"][\"sections\"].append({\n                \"name\": section.Name.decode(\"utf-8\", errors=\"ignore\").strip(\"\\x00\"),\n                \"virtual_size\": section.Misc_VirtualSize,\n                \"raw_size\": section.SizeOfRawData,\n                \"entropy\": section.get_entropy(),\n                \"md5\": section.get_hash_md5(),\n            })\n\n        # Extract imports\n        if hasattr(pe, \"DIRECTORY_ENTRY_IMPORT\"):\n            for entry in pe.DIRECTORY_ENTRY_IMPORT:\n                dll_name = entry.dll.decode(\"utf-8\", errors=\"ignore\")\n                functions = [\n                    imp.name.decode(\"utf-8\", errors=\"ignore\")\n                    for imp in entry.imports\n                    if imp.name\n                ]\n                iocs[\"imports\"].append({\"dll\": dll_name, \"functions\": functions})\n\n        # Check for suspicious characteristics\n        iocs[\"pe_info\"][\"is_dll\"] = pe.is_dll()\n        iocs[\"pe_info\"][\"is_driver\"] = pe.is_driver()\n        iocs[\"pe_info\"][\"is_exe\"] = pe.is_exe()\n\n        # Version info\n        if hasattr(pe, \"VS_VERSIONINFO\"):\n            for entry in pe.FileInfo:\n                for st in entry:\n                    for item in st.entries.items():\n                        key = item[0].decode(\"utf-8\", errors=\"ignore\")\n                        val = item[1].decode(\"utf-8\", errors=\"ignore\")\n                        iocs[\"pe_info\"][f\"version_{key}\"] = val\n\n        pe.close()\n\n    except pefile.PEFormatError as e:\n        iocs[\"pe_info\"][\"error\"] = str(e)\n\n    return iocs\n```\n\n### Step 2: String Extraction and IOC Pattern Matching\n\n```python\nimport re\n\ndef extract_ioc_strings(filepath):\n    \"\"\"Extract IOC-relevant strings from binary file.\"\"\"\n    patterns = {\n        \"ipv4\": re.compile(\n            r\"\\b(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}\"\n            r\"(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\b\"\n        ),\n        \"domain\": re.compile(\n            r\"\\b(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+\"\n            r\"(?:com|net|org|io|ru|cn|tk|xyz|top|info|biz|cc|ws|pw)\\b\"\n        ),\n        \"url\": re.compile(\n            r\"https?:\u002F\u002F[^\\s\\\"'\u003C>]{5,200}\"\n        ),\n        \"email\": re.compile(\n            r\"\\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\\b\"\n        ),\n        \"registry\": re.compile(\n            r\"(?:HKEY_[A-Z_]+|HKLM|HKCU|HKU|HKCR|HKCC)\"\n            r\"\\\\[\\\\a-zA-Z0-9_ .{}-]+\"\n        ),\n        \"filepath_windows\": re.compile(\n            r\"[A-Z]:\\\\(?:[^\\\\\u002F:*?\\\"\u003C>|\\r\\n]+\\\\)*[^\\\\\u002F:*?\\\"\u003C>|\\r\\n]+\"\n        ),\n        \"mutex\": re.compile(\n            r\"(?:Global\\\\|Local\\\\)[a-zA-Z0-9_\\-{}.]{4,}\"\n        ),\n        \"useragent\": re.compile(\n            r\"Mozilla\u002F[45]\\.0[^\\\"']{10,200}\"\n        ),\n        \"bitcoin\": re.compile(\n            r\"\\b[13][a-km-zA-HJ-NP-Z1-9]{25,34}\\b\"\n        ),\n        \"pdb_path\": re.compile(\n            r\"[A-Z]:\\\\[^\\\"]{5,200}\\.pdb\"\n        ),\n    }\n\n    with open(filepath, \"rb\") as f:\n        data = f.read()\n\n    # Extract ASCII strings (min length 4)\n    ascii_strings = re.findall(rb\"[\\x20-\\x7e]{4,}\", data)\n    # Extract Unicode strings\n    unicode_strings = re.findall(\n        rb\"(?:[\\x20-\\x7e]\\x00){4,}\", data\n    )\n\n    all_strings = [s.decode(\"ascii\", errors=\"ignore\") for s in ascii_strings]\n    all_strings += [\n        s.decode(\"utf-16-le\", errors=\"ignore\") for s in unicode_strings\n    ]\n\n    extracted = {category: set() for category in patterns}\n\n    for string in all_strings:\n        for category, pattern in patterns.items():\n            matches = pattern.findall(string)\n            for match in matches:\n                extracted[category].add(match)\n\n    # Convert sets to sorted lists\n    return {k: sorted(v) for k, v in extracted.items() if v}\n```\n\n### Step 3: YARA Rule Scanning\n\n```python\nimport yara\n\ndef scan_with_yara(filepath, rules_path):\n    \"\"\"Scan file with YARA rules for malware classification.\"\"\"\n    rules = yara.compile(filepath=rules_path)\n    matches = rules.match(filepath)\n\n    results = []\n    for match in matches:\n        result = {\n            \"rule\": match.rule,\n            \"namespace\": match.namespace,\n            \"tags\": match.tags,\n            \"meta\": match.meta,\n            \"strings\": [],\n        }\n        for offset, identifier, data in match.strings:\n            result[\"strings\"].append({\n                \"offset\": hex(offset),\n                \"identifier\": identifier,\n                \"data\": data.hex() if len(data) \u003C 100 else data[:100].hex() + \"...\",\n            })\n        results.append(result)\n\n    return results\n\n\n# Example YARA rule for common malware indicators\nSAMPLE_YARA_RULE = \"\"\"\nrule Suspicious_Network_Indicators {\n    meta:\n        description = \"Detects suspicious network-related strings\"\n        author = \"CTI Analyst\"\n        severity = \"medium\"\n    strings:\n        $ua1 = \"Mozilla\u002F5.0\" ascii\n        $cmd1 = \"cmd.exe \u002Fc\" ascii nocase\n        $ps1 = \"powershell\" ascii nocase\n        $wget = \"wget\" ascii nocase\n        $curl = \"curl\" ascii nocase\n        $b64 = \"base64\" ascii nocase\n        $reg1 = \"HKLM\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run\" ascii nocase\n    condition:\n        uint16(0) == 0x5A4D and\n        (2 of ($ua1, $cmd1, $ps1, $wget, $curl, $b64)) or $reg1\n}\n\nrule Packed_Binary {\n    meta:\n        description = \"Detects potentially packed binary\"\n        author = \"CTI Analyst\"\n    condition:\n        uint16(0) == 0x5A4D and\n        for any section in pe.sections : (\n            section.entropy >= 7.0\n        )\n}\n\"\"\"\n```\n\n### Step 4: Generate STIX 2.1 Indicators\n\n```python\nfrom stix2 import (\n    Bundle, Indicator, Malware, Relationship,\n    File as STIXFile, DomainName, IPv4Address,\n    ObservedData,\n)\nfrom datetime import datetime\n\ndef create_stix_bundle(pe_iocs, string_iocs, yara_results, sample_name):\n    \"\"\"Create STIX 2.1 bundle from extracted IOCs.\"\"\"\n    objects = []\n\n    # Create Malware SDO\n    malware = Malware(\n        name=sample_name,\n        is_family=False,\n        malware_types=[\"unknown\"],\n        description=f\"Malware sample analyzed: {pe_iocs['hashes']['sha256']}\",\n        allow_custom=True,\n    )\n    objects.append(malware)\n\n    # File hash indicator\n    sha256 = pe_iocs[\"hashes\"][\"sha256\"]\n    hash_indicator = Indicator(\n        name=f\"Malware hash: {sha256[:16]}...\",\n        pattern=f\"[file:hashes.'SHA-256' = '{sha256}']\",\n        pattern_type=\"stix\",\n        valid_from=datetime.now().strftime(\"%Y-%m-%dT%H:%M:%SZ\"),\n        indicator_types=[\"malicious-activity\"],\n        allow_custom=True,\n    )\n    objects.append(hash_indicator)\n    objects.append(Relationship(\n        relationship_type=\"indicates\",\n        source_ref=hash_indicator.id,\n        target_ref=malware.id,\n    ))\n\n    # Network indicators from strings\n    for ip in string_iocs.get(\"ipv4\", []):\n        if not ip.startswith((\"10.\", \"172.\", \"192.168.\", \"127.\")):\n            ip_indicator = Indicator(\n                name=f\"C2 IP: {ip}\",\n                pattern=f\"[ipv4-addr:value = '{ip}']\",\n                pattern_type=\"stix\",\n                valid_from=datetime.now().strftime(\"%Y-%m-%dT%H:%M:%SZ\"),\n                indicator_types=[\"malicious-activity\"],\n                allow_custom=True,\n            )\n            objects.append(ip_indicator)\n            objects.append(Relationship(\n                relationship_type=\"indicates\",\n                source_ref=ip_indicator.id,\n                target_ref=malware.id,\n            ))\n\n    for domain in string_iocs.get(\"domain\", []):\n        domain_indicator = Indicator(\n            name=f\"C2 Domain: {domain}\",\n            pattern=f\"[domain-name:value = '{domain}']\",\n            pattern_type=\"stix\",\n            valid_from=datetime.now().strftime(\"%Y-%m-%dT%H:%M:%SZ\"),\n            indicator_types=[\"malicious-activity\"],\n            allow_custom=True,\n        )\n        objects.append(domain_indicator)\n        objects.append(Relationship(\n            relationship_type=\"indicates\",\n            source_ref=domain_indicator.id,\n            target_ref=malware.id,\n        ))\n\n    bundle = Bundle(objects=objects, allow_custom=True)\n    return bundle\n```\n\n## Validation Criteria\n\n- PE file parsed successfully with hashes, imports, and section analysis\n- String extraction identifies network IOCs (IPs, domains, URLs)\n- YARA rules match against known malware characteristics\n- STIX 2.1 bundle contains valid Indicator and Malware objects\n- Private IP ranges and benign strings filtered from IOC output\n- IOCs are actionable for blocking and detection rule creation\n\n## References\n\n- [pefile Documentation](https:\u002F\u002Fgithub.com\u002Ferocarrera\u002Fpefile)\n- [YARA Documentation](https:\u002F\u002Fyara.readthedocs.io\u002F)\n- [MITRE ATT&CK Software](https:\u002F\u002Fattack.mitre.org\u002Fsoftware\u002F)\n- [VirusTotal API](https:\u002F\u002Fdocs.virustotal.com\u002F)\n- [CAPE Sandbox](https:\u002F\u002Fgithub.com\u002Fkevoreilly\u002FCAPEv2)\n- [MalwareBazaar](https:\u002F\u002Fbazaar.abuse.ch\u002F)\n","# Performing Malware IOC Extraction\n\n## Overview\n\nMalware IOC extraction is the process of analyzing malicious software to identify actionable indicators of compromise including file hashes, network indicators (C2 domains, IP addresses, URLs), registry modifications, mutex names, embedded strings, and behavioral artifacts. This skill covers static analysis with PE parsing and string extraction, dynamic analysis with sandbox detonation, automated IOC extraction using tools like YARA, and formatting results as STIX 2.1 indicators for sharing.\n\n\n## When to Use\n\n- When conducting security assessments that involve performing malware ioc extraction\n- When following incident response procedures for related security events\n- When performing scheduled security testing or auditing activities\n- When validating security controls through hands-on testing\n\n## Prerequisites\n\n- Python 3.9+ with `pefile`, `yara-python`, `oletools`, `stix2` libraries\n- Access to malware analysis sandbox (Cuckoo, CAPE, Any.Run, Joe Sandbox)\n- VirusTotal API key for enrichment\n- Isolated analysis environment (VM or container)\n- Understanding of PE file format, common packing techniques\n- Familiarity with YARA rule syntax\n\n## Key Concepts\n\n### Static Analysis IOCs\n- **File Hashes**: MD5, SHA-1, SHA-256 of the sample and any dropped files\n- **Import Hash (imphash)**: Hash of imported function table, groups malware families\n- **Rich Header Hash**: PE rich header hash for compiler fingerprinting\n- **Strings**: Embedded URLs, IP addresses, domain names, registry paths, mutex names\n- **PE Metadata**: Compilation timestamp, section names, resources, digital signatures\n- **Embedded Artifacts**: PDB paths, version info, certificate details\n\n### Dynamic Analysis IOCs\n- **Network Activity**: DNS queries, HTTP requests, TCP\u002FUDP connections, SSL certificates\n- **File System**: Created\u002Fmodified\u002Fdeleted files and directories\n- **Registry**: Created\u002Fmodified registry keys and values\n- **Process**: Spawned processes, injected processes, service creation\n- **Behavioral**: API calls, mutex creation, scheduled tasks, persistence mechanisms\n\n### YARA Rules\nYARA is a pattern-matching tool for identifying and classifying malware. Rules consist of strings (text, hex, regex) and conditions that define matching logic. Rules can detect malware families, packers, exploit kits, and specific campaign tools.\n\n## Workflow\n\n### Step 1: Static Analysis - PE Parsing and Hash Generation\n\n```python\nimport pefile\nimport hashlib\nimport os\n\ndef analyze_pe(filepath):\n    \"\"\"Extract IOCs from a PE file through static analysis.\"\"\"\n    iocs = {\"hashes\": {}, \"pe_info\": {}, \"strings\": [], \"imports\": []}\n\n    # Calculate file hashes\n    with open(filepath, \"rb\") as f:\n        data = f.read()\n    iocs[\"hashes\"][\"md5\"] = hashlib.md5(data).hexdigest()\n    iocs[\"hashes\"][\"sha1\"] = hashlib.sha1(data).hexdigest()\n    iocs[\"hashes\"][\"sha256\"] = hashlib.sha256(data).hexdigest()\n    iocs[\"hashes\"][\"file_size\"] = len(data)\n\n    # Parse PE headers\n    try:\n        pe = pefile.PE(filepath)\n        iocs[\"hashes\"][\"imphash\"] = pe.get_imphash()\n        iocs[\"pe_info\"][\"compilation_time\"] = str(pe.FILE_HEADER.TimeDateStamp)\n        iocs[\"pe_info\"][\"machine_type\"] = hex(pe.FILE_HEADER.Machine)\n        iocs[\"pe_info\"][\"subsystem\"] = pe.OPTIONAL_HEADER.Subsystem\n\n        # Extract sections\n        iocs[\"pe_info\"][\"sections\"] = []\n        for section in pe.sections:\n            iocs[\"pe_info\"][\"sections\"].append({\n                \"name\": section.Name.decode(\"utf-8\", errors=\"ignore\").strip(\"\\x00\"),\n                \"virtual_size\": section.Misc_VirtualSize,\n                \"raw_size\": section.SizeOfRawData,\n                \"entropy\": section.get_entropy(),\n                \"md5\": section.get_hash_md5(),\n            })\n\n        # Extract imports\n        if hasattr(pe, \"DIRECTORY_ENTRY_IMPORT\"):\n            for entry in pe.DIRECTORY_ENTRY_IMPORT:\n                dll_name = entry.dll.decode(\"utf-8\", errors=\"ignore\")\n                functions = [\n                    imp.name.decode(\"utf-8\", errors=\"ignore\")\n                    for imp in entry.imports\n                    if imp.name\n                ]\n                iocs[\"imports\"].append({\"dll\": dll_name, \"functions\": functions})\n\n        # Check for suspicious characteristics\n        iocs[\"pe_info\"][\"is_dll\"] = pe.is_dll()\n        iocs[\"pe_info\"][\"is_driver\"] = pe.is_driver()\n        iocs[\"pe_info\"][\"is_exe\"] = pe.is_exe()\n\n        # Version info\n        if hasattr(pe, \"VS_VERSIONINFO\"):\n            for entry in pe.FileInfo:\n                for st in entry:\n                    for item in st.entries.items():\n                        key = item[0].decode(\"utf-8\", errors=\"ignore\")\n                        val = item[1].decode(\"utf-8\", errors=\"ignore\")\n                        iocs[\"pe_info\"][f\"version_{key}\"] = val\n\n        pe.close()\n\n    except pefile.PEFormatError as e:\n        iocs[\"pe_info\"][\"error\"] = str(e)\n\n    return iocs\n```\n\n### Step 2: String Extraction and IOC Pattern Matching\n\n```python\nimport re\n\ndef extract_ioc_strings(filepath):\n    \"\"\"Extract IOC-relevant strings from binary file.\"\"\"\n    patterns = {\n        \"ipv4\": re.compile(\n            r\"\\b(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}\"\n            r\"(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\b\"\n        ),\n        \"domain\": re.compile(\n            r\"\\b(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+\"\n            r\"(?:com|net|org|io|ru|cn|tk|xyz|top|info|biz|cc|ws|pw)\\b\"\n        ),\n        \"url\": re.compile(\n            r\"https?:\u002F\u002F[^\\s\\\"'\u003C>]{5,200}\"\n        ),\n        \"email\": re.compile(\n            r\"\\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\\b\"\n        ),\n        \"registry\": re.compile(\n            r\"(?:HKEY_[A-Z_]+|HKLM|HKCU|HKU|HKCR|HKCC)\"\n            r\"\\\\[\\\\a-zA-Z0-9_ .{}-]+\"\n        ),\n        \"filepath_windows\": re.compile(\n            r\"[A-Z]:\\\\(?:[^\\\\\u002F:*?\\\"\u003C>|\\r\\n]+\\\\)*[^\\\\\u002F:*?\\\"\u003C>|\\r\\n]+\"\n        ),\n        \"mutex\": re.compile(\n            r\"(?:Global\\\\|Local\\\\)[a-zA-Z0-9_\\-{}.]{4,}\"\n        ),\n        \"useragent\": re.compile(\n            r\"Mozilla\u002F[45]\\.0[^\\\"']{10,200}\"\n        ),\n        \"bitcoin\": re.compile(\n            r\"\\b[13][a-km-zA-HJ-NP-Z1-9]{25,34}\\b\"\n        ),\n        \"pdb_path\": re.compile(\n            r\"[A-Z]:\\\\[^\\\"]{5,200}\\.pdb\"\n        ),\n    }\n\n    with open(filepath, \"rb\") as f:\n        data = f.read()\n\n    # Extract ASCII strings (min length 4)\n    ascii_strings = re.findall(rb\"[\\x20-\\x7e]{4,}\", data)\n    # Extract Unicode strings\n    unicode_strings = re.findall(\n        rb\"(?:[\\x20-\\x7e]\\x00){4,}\", data\n    )\n\n    all_strings = [s.decode(\"ascii\", errors=\"ignore\") for s in ascii_strings]\n    all_strings += [\n        s.decode(\"utf-16-le\", errors=\"ignore\") for s in unicode_strings\n    ]\n\n    extracted = {category: set() for category in patterns}\n\n    for string in all_strings:\n        for category, pattern in patterns.items():\n            matches = pattern.findall(string)\n            for match in matches:\n                extracted[category].add(match)\n\n    # Convert sets to sorted lists\n    return {k: sorted(v) for k, v in extracted.items() if v}\n```\n\n### Step 3: YARA Rule Scanning\n\n```python\nimport yara\n\ndef scan_with_yara(filepath, rules_path):\n    \"\"\"Scan file with YARA rules for malware classification.\"\"\"\n    rules = yara.compile(filepath=rules_path)\n    matches = rules.match(filepath)\n\n    results = []\n    for match in matches:\n        result = {\n            \"rule\": match.rule,\n            \"namespace\": match.namespace,\n            \"tags\": match.tags,\n            \"meta\": match.meta,\n            \"strings\": [],\n        }\n        for offset, identifier, data in match.strings:\n            result[\"strings\"].append({\n                \"offset\": hex(offset),\n                \"identifier\": identifier,\n                \"data\": data.hex() if len(data) \u003C 100 else data[:100].hex() + \"...\",\n            })\n        results.append(result)\n\n    return results\n\n\n# Example YARA rule for common malware indicators\nSAMPLE_YARA_RULE = \"\"\"\nrule Suspicious_Network_Indicators {\n    meta:\n        description = \"Detects suspicious network-related strings\"\n        author = \"CTI Analyst\"\n        severity = \"medium\"\n    strings:\n        $ua1 = \"Mozilla\u002F5.0\" ascii\n        $cmd1 = \"cmd.exe \u002Fc\" ascii nocase\n        $ps1 = \"powershell\" ascii nocase\n        $wget = \"wget\" ascii nocase\n        $curl = \"curl\" ascii nocase\n        $b64 = \"base64\" ascii nocase\n        $reg1 = \"HKLM\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run\" ascii nocase\n    condition:\n        uint16(0) == 0x5A4D and\n        (2 of ($ua1, $cmd1, $ps1, $wget, $curl, $b64)) or $reg1\n}\n\nrule Packed_Binary {\n    meta:\n        description = \"Detects potentially packed binary\"\n        author = \"CTI Analyst\"\n    condition:\n        uint16(0) == 0x5A4D and\n        for any section in pe.sections : (\n            section.entropy >= 7.0\n        )\n}\n\"\"\"\n```\n\n### Step 4: Generate STIX 2.1 Indicators\n\n```python\nfrom stix2 import (\n    Bundle, Indicator, Malware, Relationship,\n    File as STIXFile, DomainName, IPv4Address,\n    ObservedData,\n)\nfrom datetime import datetime\n\ndef create_stix_bundle(pe_iocs, string_iocs, yara_results, sample_name):\n    \"\"\"Create STIX 2.1 bundle from extracted IOCs.\"\"\"\n    objects = []\n\n    # Create Malware SDO\n    malware = Malware(\n        name=sample_name,\n        is_family=False,\n        malware_types=[\"unknown\"],\n        description=f\"Malware sample analyzed: {pe_iocs['hashes']['sha256']}\",\n        allow_custom=True,\n    )\n    objects.append(malware)\n\n    # File hash indicator\n    sha256 = pe_iocs[\"hashes\"][\"sha256\"]\n    hash_indicator = Indicator(\n        name=f\"Malware hash: {sha256[:16]}...\",\n        pattern=f\"[file:hashes.'SHA-256' = '{sha256}']\",\n        pattern_type=\"stix\",\n        valid_from=datetime.now().strftime(\"%Y-%m-%dT%H:%M:%SZ\"),\n        indicator_types=[\"malicious-activity\"],\n        allow_custom=True,\n    )\n    objects.append(hash_indicator)\n    objects.append(Relationship(\n        relationship_type=\"indicates\",\n        source_ref=hash_indicator.id,\n        target_ref=malware.id,\n    ))\n\n    # Network indicators from strings\n    for ip in string_iocs.get(\"ipv4\", []):\n        if not ip.startswith((\"10.\", \"172.\", \"192.168.\", \"127.\")):\n            ip_indicator = Indicator(\n                name=f\"C2 IP: {ip}\",\n                pattern=f\"[ipv4-addr:value = '{ip}']\",\n                pattern_type=\"stix\",\n                valid_from=datetime.now().strftime(\"%Y-%m-%dT%H:%M:%SZ\"),\n                indicator_types=[\"malicious-activity\"],\n                allow_custom=True,\n            )\n            objects.append(ip_indicator)\n            objects.append(Relationship(\n                relationship_type=\"indicates\",\n                source_ref=ip_indicator.id,\n                target_ref=malware.id,\n            ))\n\n    for domain in string_iocs.get(\"domain\", []):\n        domain_indicator = Indicator(\n            name=f\"C2 Domain: {domain}\",\n            pattern=f\"[domain-name:value = '{domain}']\",\n            pattern_type=\"stix\",\n            valid_from=datetime.now().strftime(\"%Y-%m-%dT%H:%M:%SZ\"),\n            indicator_types=[\"malicious-activity\"],\n            allow_custom=True,\n        )\n        objects.append(domain_indicator)\n        objects.append(Relationship(\n            relationship_type=\"indicates\",\n            source_ref=domain_indicator.id,\n            target_ref=malware.id,\n        ))\n\n    bundle = Bundle(objects=objects, allow_custom=True)\n    return bundle\n```\n\n## Validation Criteria\n\n- PE file parsed successfully with hashes, imports, and section analysis\n- String extraction identifies network IOCs (IPs, domains, URLs)\n- YARA rules match against known malware characteristics\n- STIX 2.1 bundle contains valid Indicator and Malware objects\n- Private IP ranges and benign strings filtered from IOC output\n- IOCs are actionable for blocking and detection rule creation\n\n## References\n\n- [pefile Documentation](https:\u002F\u002Fgithub.com\u002Ferocarrera\u002Fpefile)\n- [YARA Documentation](https:\u002F\u002Fyara.readthedocs.io\u002F)\n- [MITRE ATT&CK Software](https:\u002F\u002Fattack.mitre.org\u002Fsoftware\u002F)\n- [VirusTotal API](https:\u002F\u002Fdocs.virustotal.com\u002F)\n- [CAPE Sandbox](https:\u002F\u002Fgithub.com\u002Fkevoreilly\u002FCAPEv2)\n- [MalwareBazaar](https:\u002F\u002Fbazaar.abuse.ch\u002F)\n",{"name":5,"tags":25,"author":34,"domain":35,"license":15,"version":36,"subdomain":26,"description":7},[26,27,28,29,30,31,32,33],"threat-intelligence","cti","ioc","mitre-attack","stix","malware-analysis","yara","reverse-engineering","mahipal","cybersecurity","1.0","main","99825ad3f3bcc6597ddcc7294a14e6e922f2b67b","skills\u002Fperforming-malware-ioc-extraction",0,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills","https:\u002F\u002Fgithub.com\u002Fjukeyman","https:\u002F\u002FRJBUSINESSSOLUTIONS.ORG","Credit and Finance Expert | Developer\r\n\r\nI'm Rick Jefferson, a seasoned credit and finance expert with over a decade of experience in financial literacy,","2026-07-13 07:03:29",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add jukeyman\u002Fjukeyman-skills --skill performing-malware-ioc-extraction",{"tool":52,"command":53},"bunx","bunx skills add jukeyman\u002Fjukeyman-skills --skill performing-malware-ioc-extraction",{"tool":55,"command":56},"pnpm","pnpm dlx skills add jukeyman\u002Fjukeyman-skills --skill performing-malware-ioc-extraction","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-malware-ioc-extraction\u002FSKILL.md",true,[60,66,70,76,80,84,90],{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":65},"assets\u002Ftemplate.md","ASSET","资产文件",2294,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-malware-ioc-extraction\u002Fassets\u002Ftemplate.md",{"path":67,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":69,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":71,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":74,"sourceHtmlUrl":75},"references\u002Fapi-reference.md","REFERENCE","参考文档",1720,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-malware-ioc-extraction\u002Freferences\u002Fapi-reference.md",{"path":77,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fstandards.md",2949,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-malware-ioc-extraction\u002Freferences\u002Fstandards.md",{"path":81,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fworkflows.md",4140,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-malware-ioc-extraction\u002Freferences\u002Fworkflows.md",{"path":85,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":88,"sourceHtmlUrl":89},"scripts\u002Fagent.py","SCRIPT","脚本",6173,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-malware-ioc-extraction\u002Fscripts\u002Fagent.py",{"path":91,"resourceType":86,"resourceTypeDesc":87,"sizeBytes":92,"sourceHtmlUrl":93},"scripts\u002Fprocess.py",16560,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fperforming-malware-ioc-extraction\u002Fscripts\u002Fprocess.py",[95,103,110,117,124,132],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":99,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":20},"01M79ANS2SM329NEP5ZCX106RR","zustand-store-creator","Create zustand store creator operations. Auto-activating skill for Frontend Development.\nTriggers on: zustand store creator, zustand store creator\nPart of the Frontend Development skill category. Use when working with zustand store creator functionality. Trigger with phrases like \"zustand store creator\", \"zustand creator\", \"zustand\".","MIT","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzustand-store-creator\u002FSKILL.md",[],[],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":99,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":20},"01M79AMZKP4YDEZ7EHG1Y7PP74","zero-trust-config-helper","Configure with zero trust config helper operations. Auto-activating skill for Security Advanced.\nTriggers on: zero trust config helper, zero trust config helper\nPart of the Security Advanced skill category. Use when configuring systems or services. Trigger with phrases like \"zero trust config helper\", \"zero helper\", \"zero\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzero-trust-config-helper\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":99,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":20},"01M79AMJSBCEJQNBTYNAHYN5HM","zapier-integration-helper","Assist with zapier integration helper operations. Auto-activating skill for Business Automation.\nTriggers on: zapier integration helper, zapier integration helper\nPart of the Business Automation skill category. Use when working with APIs or building integrations. Trigger with phrases like \"zapier integration helper\", \"zapier helper\", \"zapier\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzapier-integration-helper\u002FSKILL.md",[],[],{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":99,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":20},"01M79AHJZGVMARS13VFQYRR1MP","yaml-config-validator","Validate yaml config validator operations. Auto-activating skill for DevOps Basics.\nTriggers on: yaml config validator, yaml config validator\nPart of the DevOps Basics skill category. Use when configuring systems or services. Trigger with phrases like \"yaml config validator\", \"yaml validator\", \"yaml\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fyaml-config-validator\u002FSKILL.md",[],[],{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":99,"licenseFileUrl":128,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":20},"01M79AHGDZRN0020RDQSQDPAM8","xvary-stock-research","Thesis-driven equity analysis from public SEC EDGAR and market data; \u002Fanalyze, \u002Fscore, \u002Fcompare workflows with bundled Python tools (Claude Code, Cursor, Codex).","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FSKILL.md",[],[],{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":99,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":138,"publishedAt":20},"01M79AHCYJ9FV9RMHQ24HDRN33","xss-vulnerability-scanner","Scan xss vulnerability scanner operations. Auto-activating skill for Security Fundamentals.\nTriggers on: xss vulnerability scanner, xss vulnerability scanner\nPart of the Security Fundamentals skill category. Use when working with xss vulnerability scanner functionality. Trigger with phrases like \"xss vulnerability scanner\", \"xss scanner\", \"xss\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxss-vulnerability-scanner\u002FSKILL.md",[],[]]