[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7B5501YYJS72J0R54SQJ59M":3,"skill-same:01M7B5501YYJS72J0R54SQJ59M":83},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":15,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":13,"repositoryHtmlUrl":50,"repositoryHomepageUrl":6,"ownerHtmlUrl":51,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":52,"install":53,"resources":66},"01M7B5501YYJS72J0R54SQJ59M","building-adversary-infrastructure-tracking-system",null,"Build an automated adversary infrastructure tracking system in Python (dnspython, python-whois, shodan, networkx) that pivots across passive DNS, certificate transparency logs, WHOIS records, and IP enrichment to map threat-actor C2 networks and flag newly registered domains matching known patterns. Use when pivoting from known indicators to discover related C2 infrastructure or maintaining a continuously updated map of a threat actor's network.","vikasvardhanv\u002Fjerry_skills","vikasvardhanv","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99010657?v=4","01M7B2B0VN78W7529RQX5BR6DZ","01M7B2B0WDNTXJHRK3QNPNWRP6",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fcurated_premium_skills\u002FAnthropic-Cybersecurity-Skills\u002Fskills\u002Fbuilding-adversary-infrastructure-tracking-system\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fcurated_premium_skills\u002FAnthropic-Cybersecurity-Skills\u002Fskills\u002Fbuilding-adversary-infrastructure-tracking-system\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: building-adversary-infrastructure-tracking-system\ndescription: Build an automated adversary infrastructure tracking system in Python (dnspython, python-whois, shodan, networkx) that pivots across passive DNS, certificate transparency logs, WHOIS records, and IP enrichment to map threat-actor C2 networks and flag newly registered domains matching known patterns. Use when pivoting from known indicators to discover related C2 infrastructure or maintaining a continuously updated map of a threat actor's network.\ndomain: cybersecurity\nsubdomain: threat-intelligence\ntags:\n- infrastructure-tracking\n- passive-dns\n- c2\n- whois\n- threat-actor\n- pivoting\n- threat-intelligence\n- domain-analysis\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- ID.RA-01\n- ID.RA-05\n- DE.CM-01\n- DE.AE-02\nmitre_attack:\n- T1583.001\n- T1583.004\n- T1596.001\n- T1590.002\n- T1071.001\n---\n# Building Adversary Infrastructure Tracking System\n\n## Overview\n\nAdversary infrastructure tracking uses passive DNS records, certificate transparency logs, WHOIS registration data, and IP enrichment to discover, map, and monitor threat actor command-and-control (C2) networks. Attackers frequently reuse hosting providers, registrars, SSL certificates, and naming patterns across campaigns, enabling analysts to pivot from known indicators to discover new infrastructure. This skill covers building an automated tracking system that identifies infrastructure relationships, detects newly registered domains matching adversary patterns, and maintains a continuously updated map of threat actor networks.\n\n\n## When to Use\n\n- When deploying or configuring building adversary infrastructure tracking system capabilities in your environment\n- When establishing security controls aligned to compliance requirements\n- When building or improving security architecture for this domain\n- When conducting security assessments that require this implementation\n\n## Prerequisites\n\n- Python 3.9+ with `requests`, `dnspython`, `python-whois`, `shodan`, `networkx` libraries\n- API keys: SecurityTrails, PassiveTotal\u002FRiskIQ, Shodan, VirusTotal\n- Access to passive DNS data sources\n- Understanding of DNS infrastructure, hosting, and domain registration\n- Graph database (Neo4j) or NetworkX for relationship visualization\n\n## Key Concepts\n\n### Passive DNS\n\nPassive DNS captures historical DNS resolution data, recording which domains resolved to which IPs and when. Unlike active DNS queries, passive DNS preserves historical relationships even after records change, enabling analysts to track infrastructure changes, identify shared hosting patterns, and discover related domains that resolved to the same IP addresses over time.\n\n### Infrastructure Pivoting\n\nPivoting identifies related infrastructure by following connections: IP pivot (find all domains on an IP), domain pivot (find all IPs a domain resolved to), WHOIS pivot (find domains with same registrant), certificate pivot (find hosts sharing SSL certificates), and NS\u002FMX pivot (find domains using same name servers or mail servers).\n\n### Adversary Infrastructure Patterns\n\nThreat actors exhibit patterns: preferred registrars (Namecheap, REG.RU, Tucows), preferred hosting (bulletproof hosting providers, cloud services), domain generation algorithms (DGA), consistent naming patterns, and certificate reuse across campaigns.\n\n## Workflow\n\n### Step 1: Passive DNS Infrastructure Discovery\n\n```python\nimport requests\nimport json\nfrom collections import defaultdict\nfrom datetime import datetime\n\nclass InfrastructureTracker:\n    def __init__(self, securitytrails_key=None, vt_key=None, shodan_key=None):\n        self.st_key = securitytrails_key\n        self.vt_key = vt_key\n        self.shodan_key = shodan_key\n        self.infrastructure_graph = defaultdict(lambda: {\"nodes\": set(), \"edges\": []})\n\n    def passive_dns_lookup(self, domain):\n        \"\"\"Query passive DNS for domain resolution history.\"\"\"\n        headers = {\"apikey\": self.st_key}\n        url = f\"https:\u002F\u002Fapi.securitytrails.com\u002Fv1\u002Fhistory\u002F{domain}\u002Fdns\u002Fa\"\n        resp = requests.get(url, headers=headers, timeout=30)\n        if resp.status_code == 200:\n            records = resp.json().get(\"records\", [])\n            history = []\n            for record in records:\n                for value in record.get(\"values\", []):\n                    history.append({\n                        \"domain\": domain,\n                        \"ip\": value.get(\"ip\", \"\"),\n                        \"first_seen\": record.get(\"first_seen\", \"\"),\n                        \"last_seen\": record.get(\"last_seen\", \"\"),\n                        \"type\": record.get(\"type\", \"a\"),\n                    })\n            print(f\"[+] Passive DNS for {domain}: {len(history)} records\")\n            return history\n        return []\n\n    def reverse_ip_lookup(self, ip_address):\n        \"\"\"Find all domains hosted on an IP address.\"\"\"\n        headers = {\"apikey\": self.st_key}\n        url = f\"https:\u002F\u002Fapi.securitytrails.com\u002Fv1\u002Fips\u002Fnearby\u002F{ip_address}\"\n        resp = requests.get(url, headers=headers, timeout=30)\n        if resp.status_code == 200:\n            blocks = resp.json().get(\"blocks\", [])\n            domains = []\n            for block in blocks:\n                for site in block.get(\"sites\", []):\n                    domains.append(site)\n            print(f\"[+] Reverse IP for {ip_address}: {len(domains)} domains\")\n            return domains\n        return []\n\n    def whois_lookup(self, domain):\n        \"\"\"Get WHOIS registration data for pivoting.\"\"\"\n        headers = {\"apikey\": self.st_key}\n        url = f\"https:\u002F\u002Fapi.securitytrails.com\u002Fv1\u002Fdomain\u002F{domain}\u002Fwhois\"\n        resp = requests.get(url, headers=headers, timeout=30)\n        if resp.status_code == 200:\n            data = resp.json()\n            whois_data = {\n                \"domain\": domain,\n                \"registrar\": data.get(\"registrar\", \"\"),\n                \"registrant_org\": data.get(\"registrant_org\", \"\"),\n                \"registrant_email\": data.get(\"registrant_email\", \"\"),\n                \"name_servers\": data.get(\"nameServers\", []),\n                \"created_date\": data.get(\"createdDate\", \"\"),\n                \"updated_date\": data.get(\"updatedDate\", \"\"),\n                \"expires_date\": data.get(\"expiresDate\", \"\"),\n            }\n            return whois_data\n        return {}\n\n    def pivot_from_seed(self, seed_indicator, indicator_type=\"domain\", depth=2):\n        \"\"\"Recursively pivot from a seed indicator to discover infrastructure.\"\"\"\n        discovered = {\"domains\": set(), \"ips\": set(), \"relationships\": []}\n\n        if indicator_type == \"domain\":\n            discovered[\"domains\"].add(seed_indicator)\n            # Get IPs for domain\n            pdns = self.passive_dns_lookup(seed_indicator)\n            for record in pdns:\n                ip = record[\"ip\"]\n                discovered[\"ips\"].add(ip)\n                discovered[\"relationships\"].append({\n                    \"source\": seed_indicator, \"target\": ip,\n                    \"type\": \"resolves_to\",\n                    \"first_seen\": record[\"first_seen\"],\n                    \"last_seen\": record[\"last_seen\"],\n                })\n\n                if depth > 1:\n                    # Reverse lookup on discovered IPs\n                    reverse_domains = self.reverse_ip_lookup(ip)\n                    for rd in reverse_domains[:20]:\n                        discovered[\"domains\"].add(rd)\n                        discovered[\"relationships\"].append({\n                            \"source\": rd, \"target\": ip,\n                            \"type\": \"hosted_on\",\n                        })\n\n        elif indicator_type == \"ip\":\n            discovered[\"ips\"].add(seed_indicator)\n            domains = self.reverse_ip_lookup(seed_indicator)\n            for domain in domains[:20]:\n                discovered[\"domains\"].add(domain)\n                discovered[\"relationships\"].append({\n                    \"source\": domain, \"target\": seed_indicator,\n                    \"type\": \"hosted_on\",\n                })\n\n        print(f\"[+] Pivot from {seed_indicator}: \"\n              f\"{len(discovered['domains'])} domains, \"\n              f\"{len(discovered['ips'])} IPs, \"\n              f\"{len(discovered['relationships'])} relationships\")\n        return discovered\n\ntracker = InfrastructureTracker(\n    securitytrails_key=\"YOUR_ST_KEY\",\n    vt_key=\"YOUR_VT_KEY\",\n)\n```\n\n### Step 2: Build Infrastructure Graph\n\n```python\nimport networkx as nx\n\nclass InfrastructureGraph:\n    def __init__(self):\n        self.graph = nx.Graph()\n\n    def add_discovery(self, discovery_data):\n        \"\"\"Add discovered infrastructure to graph.\"\"\"\n        for domain in discovery_data[\"domains\"]:\n            self.graph.add_node(domain, type=\"domain\")\n        for ip in discovery_data[\"ips\"]:\n            self.graph.add_node(ip, type=\"ip\")\n        for rel in discovery_data[\"relationships\"]:\n            self.graph.add_edge(\n                rel[\"source\"], rel[\"target\"],\n                relationship=rel[\"type\"],\n                first_seen=rel.get(\"first_seen\", \"\"),\n                last_seen=rel.get(\"last_seen\", \"\"),\n            )\n\n    def find_clusters(self):\n        \"\"\"Identify infrastructure clusters.\"\"\"\n        components = list(nx.connected_components(self.graph))\n        clusters = []\n        for component in components:\n            domains = [n for n in component if self.graph.nodes[n].get(\"type\") == \"domain\"]\n            ips = [n for n in component if self.graph.nodes[n].get(\"type\") == \"ip\"]\n            clusters.append({\n                \"size\": len(component),\n                \"domains\": sorted(domains),\n                \"ips\": sorted(ips),\n                \"domain_count\": len(domains),\n                \"ip_count\": len(ips),\n            })\n        clusters.sort(key=lambda x: x[\"size\"], reverse=True)\n        print(f\"[+] Infrastructure clusters: {len(clusters)}\")\n        return clusters\n\n    def find_hub_nodes(self, top_n=10):\n        \"\"\"Find high-centrality nodes (shared infrastructure).\"\"\"\n        centrality = nx.degree_centrality(self.graph)\n        top_nodes = sorted(centrality.items(), key=lambda x: x[1], reverse=True)[:top_n]\n        hubs = []\n        for node, score in top_nodes:\n            hubs.append({\n                \"node\": node,\n                \"type\": self.graph.nodes[node].get(\"type\", \"unknown\"),\n                \"centrality\": round(score, 4),\n                \"connections\": self.graph.degree(node),\n            })\n        return hubs\n\n    def export_graph(self, output_file=\"infrastructure_graph.json\"):\n        data = nx.node_link_data(self.graph)\n        with open(output_file, \"w\") as f:\n            json.dump(data, f, indent=2)\n        print(f\"[+] Graph exported: {self.graph.number_of_nodes()} nodes, \"\n              f\"{self.graph.number_of_edges()} edges\")\n\ninfra_graph = InfrastructureGraph()\ndiscovery = tracker.pivot_from_seed(\"evil-domain.com\", depth=2)\ninfra_graph.add_discovery(discovery)\nclusters = infra_graph.find_clusters()\nhubs = infra_graph.find_hub_nodes()\ninfra_graph.export_graph()\n```\n\n### Step 3: Monitor for New Infrastructure\n\n```python\nimport time\n\nclass InfrastructureMonitor:\n    def __init__(self, tracker, known_indicators):\n        self.tracker = tracker\n        self.known = set(known_indicators)\n        self.alerts = []\n\n    def check_new_registrations(self, patterns):\n        \"\"\"Check for newly registered domains matching adversary patterns.\"\"\"\n        import re\n        new_domains = []\n        for pattern in patterns:\n            # Query SecurityTrails for new domains matching pattern\n            headers = {\"apikey\": self.tracker.st_key}\n            url = \"https:\u002F\u002Fapi.securitytrails.com\u002Fv1\u002Fdomains\u002Flist\"\n            params = {\"include_ips\": \"true\", \"page\": 1}\n            body = {\"filter\": {\"keyword\": pattern}}\n            resp = requests.post(url, headers=headers, json=body, timeout=30)\n            if resp.status_code == 200:\n                records = resp.json().get(\"records\", [])\n                for record in records:\n                    domain = record.get(\"hostname\", \"\")\n                    if domain not in self.known:\n                        new_domains.append({\n                            \"domain\": domain,\n                            \"pattern_matched\": pattern,\n                            \"first_seen\": datetime.now().isoformat(),\n                        })\n                        self.known.add(domain)\n\n        if new_domains:\n            print(f\"[ALERT] {len(new_domains)} new domains matching patterns\")\n            self.alerts.extend(new_domains)\n        return new_domains\n\n    def generate_infrastructure_report(self, clusters, hubs):\n        report = f\"\"\"# Adversary Infrastructure Tracking Report\nGenerated: {datetime.now().isoformat()}\n\n## Summary\n- Infrastructure clusters identified: {len(clusters)}\n- Total domains tracked: {sum(c['domain_count'] for c in clusters)}\n- Total IPs tracked: {sum(c['ip_count'] for c in clusters)}\n- New domains detected: {len(self.alerts)}\n\n## Top Infrastructure Hubs\n| Node | Type | Connections | Centrality |\n|------|------|-------------|------------|\n\"\"\"\n        for hub in hubs[:10]:\n            report += (f\"| {hub['node']} | {hub['type']} \"\n                       f\"| {hub['connections']} | {hub['centrality']} |\\n\")\n\n        report += \"\\n## Infrastructure Clusters\\n\"\n        for i, cluster in enumerate(clusters[:5], 1):\n            report += f\"\\n### Cluster {i} ({cluster['size']} nodes)\\n\"\n            report += f\"- Domains: {', '.join(cluster['domains'][:5])}\\n\"\n            report += f\"- IPs: {', '.join(cluster['ips'][:5])}\\n\"\n\n        with open(\"infrastructure_report.md\", \"w\") as f:\n            f.write(report)\n        print(\"[+] Infrastructure report saved\")\n\nmonitor = InfrastructureMonitor(tracker, known_indicators=set())\n```\n\n## Validation Criteria\n\n- Passive DNS queries return historical resolution data\n- Reverse IP lookups discover co-hosted domains\n- Infrastructure pivoting expands from seed indicators\n- Graph analysis identifies clusters and hub nodes\n- New infrastructure detected through pattern monitoring\n- Reports generated with actionable recommendations\n\n## References\n\n- [Juniper: Threat Hunting with Passive DNS](https:\u002F\u002Fblogs.juniper.net\u002Fen-us\u002Fthreat-research\u002Fthreat-hunting-with-passive-dns-discovering-the-attacker-infrastructure)\n- [Censys: Advanced Persistent Infrastructure Tracking](https:\u002F\u002Fcensys.com\u002Fblog\u002Fadvanced-persistent-infrastructure-tracking)\n- [Embee Research: Malware Infrastructure with DNS Pivoting](https:\u002F\u002Fwww.embeeresearch.io\u002Finfrastructure-analysis-with-dns-pivoting\u002F)\n- [Validin: Passive DNS Threat Hunting](https:\u002F\u002Fwww.validin.com\u002Fblog\u002Fannouncing_validin_threat_hunting_platform\u002F)\n- [SecurityTrails API](https:\u002F\u002Fsecuritytrails.com\u002Fcorp\u002Fapi)\n- [Hunt.io: Uncovering Malicious Infrastructure](https:\u002F\u002Fhunt.io\u002Fblog\u002Fpractical-guide-unconvering-malicious-infrastructure)\n","# Building Adversary Infrastructure Tracking System\n\n## Overview\n\nAdversary infrastructure tracking uses passive DNS records, certificate transparency logs, WHOIS registration data, and IP enrichment to discover, map, and monitor threat actor command-and-control (C2) networks. Attackers frequently reuse hosting providers, registrars, SSL certificates, and naming patterns across campaigns, enabling analysts to pivot from known indicators to discover new infrastructure. This skill covers building an automated tracking system that identifies infrastructure relationships, detects newly registered domains matching adversary patterns, and maintains a continuously updated map of threat actor networks.\n\n\n## When to Use\n\n- When deploying or configuring building adversary infrastructure tracking system capabilities in your environment\n- When establishing security controls aligned to compliance requirements\n- When building or improving security architecture for this domain\n- When conducting security assessments that require this implementation\n\n## Prerequisites\n\n- Python 3.9+ with `requests`, `dnspython`, `python-whois`, `shodan`, `networkx` libraries\n- API keys: SecurityTrails, PassiveTotal\u002FRiskIQ, Shodan, VirusTotal\n- Access to passive DNS data sources\n- Understanding of DNS infrastructure, hosting, and domain registration\n- Graph database (Neo4j) or NetworkX for relationship visualization\n\n## Key Concepts\n\n### Passive DNS\n\nPassive DNS captures historical DNS resolution data, recording which domains resolved to which IPs and when. Unlike active DNS queries, passive DNS preserves historical relationships even after records change, enabling analysts to track infrastructure changes, identify shared hosting patterns, and discover related domains that resolved to the same IP addresses over time.\n\n### Infrastructure Pivoting\n\nPivoting identifies related infrastructure by following connections: IP pivot (find all domains on an IP), domain pivot (find all IPs a domain resolved to), WHOIS pivot (find domains with same registrant), certificate pivot (find hosts sharing SSL certificates), and NS\u002FMX pivot (find domains using same name servers or mail servers).\n\n### Adversary Infrastructure Patterns\n\nThreat actors exhibit patterns: preferred registrars (Namecheap, REG.RU, Tucows), preferred hosting (bulletproof hosting providers, cloud services), domain generation algorithms (DGA), consistent naming patterns, and certificate reuse across campaigns.\n\n## Workflow\n\n### Step 1: Passive DNS Infrastructure Discovery\n\n```python\nimport requests\nimport json\nfrom collections import defaultdict\nfrom datetime import datetime\n\nclass InfrastructureTracker:\n    def __init__(self, securitytrails_key=None, vt_key=None, shodan_key=None):\n        self.st_key = securitytrails_key\n        self.vt_key = vt_key\n        self.shodan_key = shodan_key\n        self.infrastructure_graph = defaultdict(lambda: {\"nodes\": set(), \"edges\": []})\n\n    def passive_dns_lookup(self, domain):\n        \"\"\"Query passive DNS for domain resolution history.\"\"\"\n        headers = {\"apikey\": self.st_key}\n        url = f\"https:\u002F\u002Fapi.securitytrails.com\u002Fv1\u002Fhistory\u002F{domain}\u002Fdns\u002Fa\"\n        resp = requests.get(url, headers=headers, timeout=30)\n        if resp.status_code == 200:\n            records = resp.json().get(\"records\", [])\n            history = []\n            for record in records:\n                for value in record.get(\"values\", []):\n                    history.append({\n                        \"domain\": domain,\n                        \"ip\": value.get(\"ip\", \"\"),\n                        \"first_seen\": record.get(\"first_seen\", \"\"),\n                        \"last_seen\": record.get(\"last_seen\", \"\"),\n                        \"type\": record.get(\"type\", \"a\"),\n                    })\n            print(f\"[+] Passive DNS for {domain}: {len(history)} records\")\n            return history\n        return []\n\n    def reverse_ip_lookup(self, ip_address):\n        \"\"\"Find all domains hosted on an IP address.\"\"\"\n        headers = {\"apikey\": self.st_key}\n        url = f\"https:\u002F\u002Fapi.securitytrails.com\u002Fv1\u002Fips\u002Fnearby\u002F{ip_address}\"\n        resp = requests.get(url, headers=headers, timeout=30)\n        if resp.status_code == 200:\n            blocks = resp.json().get(\"blocks\", [])\n            domains = []\n            for block in blocks:\n                for site in block.get(\"sites\", []):\n                    domains.append(site)\n            print(f\"[+] Reverse IP for {ip_address}: {len(domains)} domains\")\n            return domains\n        return []\n\n    def whois_lookup(self, domain):\n        \"\"\"Get WHOIS registration data for pivoting.\"\"\"\n        headers = {\"apikey\": self.st_key}\n        url = f\"https:\u002F\u002Fapi.securitytrails.com\u002Fv1\u002Fdomain\u002F{domain}\u002Fwhois\"\n        resp = requests.get(url, headers=headers, timeout=30)\n        if resp.status_code == 200:\n            data = resp.json()\n            whois_data = {\n                \"domain\": domain,\n                \"registrar\": data.get(\"registrar\", \"\"),\n                \"registrant_org\": data.get(\"registrant_org\", \"\"),\n                \"registrant_email\": data.get(\"registrant_email\", \"\"),\n                \"name_servers\": data.get(\"nameServers\", []),\n                \"created_date\": data.get(\"createdDate\", \"\"),\n                \"updated_date\": data.get(\"updatedDate\", \"\"),\n                \"expires_date\": data.get(\"expiresDate\", \"\"),\n            }\n            return whois_data\n        return {}\n\n    def pivot_from_seed(self, seed_indicator, indicator_type=\"domain\", depth=2):\n        \"\"\"Recursively pivot from a seed indicator to discover infrastructure.\"\"\"\n        discovered = {\"domains\": set(), \"ips\": set(), \"relationships\": []}\n\n        if indicator_type == \"domain\":\n            discovered[\"domains\"].add(seed_indicator)\n            # Get IPs for domain\n            pdns = self.passive_dns_lookup(seed_indicator)\n            for record in pdns:\n                ip = record[\"ip\"]\n                discovered[\"ips\"].add(ip)\n                discovered[\"relationships\"].append({\n                    \"source\": seed_indicator, \"target\": ip,\n                    \"type\": \"resolves_to\",\n                    \"first_seen\": record[\"first_seen\"],\n                    \"last_seen\": record[\"last_seen\"],\n                })\n\n                if depth > 1:\n                    # Reverse lookup on discovered IPs\n                    reverse_domains = self.reverse_ip_lookup(ip)\n                    for rd in reverse_domains[:20]:\n                        discovered[\"domains\"].add(rd)\n                        discovered[\"relationships\"].append({\n                            \"source\": rd, \"target\": ip,\n                            \"type\": \"hosted_on\",\n                        })\n\n        elif indicator_type == \"ip\":\n            discovered[\"ips\"].add(seed_indicator)\n            domains = self.reverse_ip_lookup(seed_indicator)\n            for domain in domains[:20]:\n                discovered[\"domains\"].add(domain)\n                discovered[\"relationships\"].append({\n                    \"source\": domain, \"target\": seed_indicator,\n                    \"type\": \"hosted_on\",\n                })\n\n        print(f\"[+] Pivot from {seed_indicator}: \"\n              f\"{len(discovered['domains'])} domains, \"\n              f\"{len(discovered['ips'])} IPs, \"\n              f\"{len(discovered['relationships'])} relationships\")\n        return discovered\n\ntracker = InfrastructureTracker(\n    securitytrails_key=\"YOUR_ST_KEY\",\n    vt_key=\"YOUR_VT_KEY\",\n)\n```\n\n### Step 2: Build Infrastructure Graph\n\n```python\nimport networkx as nx\n\nclass InfrastructureGraph:\n    def __init__(self):\n        self.graph = nx.Graph()\n\n    def add_discovery(self, discovery_data):\n        \"\"\"Add discovered infrastructure to graph.\"\"\"\n        for domain in discovery_data[\"domains\"]:\n            self.graph.add_node(domain, type=\"domain\")\n        for ip in discovery_data[\"ips\"]:\n            self.graph.add_node(ip, type=\"ip\")\n        for rel in discovery_data[\"relationships\"]:\n            self.graph.add_edge(\n                rel[\"source\"], rel[\"target\"],\n                relationship=rel[\"type\"],\n                first_seen=rel.get(\"first_seen\", \"\"),\n                last_seen=rel.get(\"last_seen\", \"\"),\n            )\n\n    def find_clusters(self):\n        \"\"\"Identify infrastructure clusters.\"\"\"\n        components = list(nx.connected_components(self.graph))\n        clusters = []\n        for component in components:\n            domains = [n for n in component if self.graph.nodes[n].get(\"type\") == \"domain\"]\n            ips = [n for n in component if self.graph.nodes[n].get(\"type\") == \"ip\"]\n            clusters.append({\n                \"size\": len(component),\n                \"domains\": sorted(domains),\n                \"ips\": sorted(ips),\n                \"domain_count\": len(domains),\n                \"ip_count\": len(ips),\n            })\n        clusters.sort(key=lambda x: x[\"size\"], reverse=True)\n        print(f\"[+] Infrastructure clusters: {len(clusters)}\")\n        return clusters\n\n    def find_hub_nodes(self, top_n=10):\n        \"\"\"Find high-centrality nodes (shared infrastructure).\"\"\"\n        centrality = nx.degree_centrality(self.graph)\n        top_nodes = sorted(centrality.items(), key=lambda x: x[1], reverse=True)[:top_n]\n        hubs = []\n        for node, score in top_nodes:\n            hubs.append({\n                \"node\": node,\n                \"type\": self.graph.nodes[node].get(\"type\", \"unknown\"),\n                \"centrality\": round(score, 4),\n                \"connections\": self.graph.degree(node),\n            })\n        return hubs\n\n    def export_graph(self, output_file=\"infrastructure_graph.json\"):\n        data = nx.node_link_data(self.graph)\n        with open(output_file, \"w\") as f:\n            json.dump(data, f, indent=2)\n        print(f\"[+] Graph exported: {self.graph.number_of_nodes()} nodes, \"\n              f\"{self.graph.number_of_edges()} edges\")\n\ninfra_graph = InfrastructureGraph()\ndiscovery = tracker.pivot_from_seed(\"evil-domain.com\", depth=2)\ninfra_graph.add_discovery(discovery)\nclusters = infra_graph.find_clusters()\nhubs = infra_graph.find_hub_nodes()\ninfra_graph.export_graph()\n```\n\n### Step 3: Monitor for New Infrastructure\n\n```python\nimport time\n\nclass InfrastructureMonitor:\n    def __init__(self, tracker, known_indicators):\n        self.tracker = tracker\n        self.known = set(known_indicators)\n        self.alerts = []\n\n    def check_new_registrations(self, patterns):\n        \"\"\"Check for newly registered domains matching adversary patterns.\"\"\"\n        import re\n        new_domains = []\n        for pattern in patterns:\n            # Query SecurityTrails for new domains matching pattern\n            headers = {\"apikey\": self.tracker.st_key}\n            url = \"https:\u002F\u002Fapi.securitytrails.com\u002Fv1\u002Fdomains\u002Flist\"\n            params = {\"include_ips\": \"true\", \"page\": 1}\n            body = {\"filter\": {\"keyword\": pattern}}\n            resp = requests.post(url, headers=headers, json=body, timeout=30)\n            if resp.status_code == 200:\n                records = resp.json().get(\"records\", [])\n                for record in records:\n                    domain = record.get(\"hostname\", \"\")\n                    if domain not in self.known:\n                        new_domains.append({\n                            \"domain\": domain,\n                            \"pattern_matched\": pattern,\n                            \"first_seen\": datetime.now().isoformat(),\n                        })\n                        self.known.add(domain)\n\n        if new_domains:\n            print(f\"[ALERT] {len(new_domains)} new domains matching patterns\")\n            self.alerts.extend(new_domains)\n        return new_domains\n\n    def generate_infrastructure_report(self, clusters, hubs):\n        report = f\"\"\"# Adversary Infrastructure Tracking Report\nGenerated: {datetime.now().isoformat()}\n\n## Summary\n- Infrastructure clusters identified: {len(clusters)}\n- Total domains tracked: {sum(c['domain_count'] for c in clusters)}\n- Total IPs tracked: {sum(c['ip_count'] for c in clusters)}\n- New domains detected: {len(self.alerts)}\n\n## Top Infrastructure Hubs\n| Node | Type | Connections | Centrality |\n|------|------|-------------|------------|\n\"\"\"\n        for hub in hubs[:10]:\n            report += (f\"| {hub['node']} | {hub['type']} \"\n                       f\"| {hub['connections']} | {hub['centrality']} |\\n\")\n\n        report += \"\\n## Infrastructure Clusters\\n\"\n        for i, cluster in enumerate(clusters[:5], 1):\n            report += f\"\\n### Cluster {i} ({cluster['size']} nodes)\\n\"\n            report += f\"- Domains: {', '.join(cluster['domains'][:5])}\\n\"\n            report += f\"- IPs: {', '.join(cluster['ips'][:5])}\\n\"\n\n        with open(\"infrastructure_report.md\", \"w\") as f:\n            f.write(report)\n        print(\"[+] Infrastructure report saved\")\n\nmonitor = InfrastructureMonitor(tracker, known_indicators=set())\n```\n\n## Validation Criteria\n\n- Passive DNS queries return historical resolution data\n- Reverse IP lookups discover co-hosted domains\n- Infrastructure pivoting expands from seed indicators\n- Graph analysis identifies clusters and hub nodes\n- New infrastructure detected through pattern monitoring\n- Reports generated with actionable recommendations\n\n## References\n\n- [Juniper: Threat Hunting with Passive DNS](https:\u002F\u002Fblogs.juniper.net\u002Fen-us\u002Fthreat-research\u002Fthreat-hunting-with-passive-dns-discovering-the-attacker-infrastructure)\n- [Censys: Advanced Persistent Infrastructure Tracking](https:\u002F\u002Fcensys.com\u002Fblog\u002Fadvanced-persistent-infrastructure-tracking)\n- [Embee Research: Malware Infrastructure with DNS Pivoting](https:\u002F\u002Fwww.embeeresearch.io\u002Finfrastructure-analysis-with-dns-pivoting\u002F)\n- [Validin: Passive DNS Threat Hunting](https:\u002F\u002Fwww.validin.com\u002Fblog\u002Fannouncing_validin_threat_hunting_platform\u002F)\n- [SecurityTrails API](https:\u002F\u002Fsecuritytrails.com\u002Fcorp\u002Fapi)\n- [Hunt.io: Uncovering Malicious Infrastructure](https:\u002F\u002Fhunt.io\u002Fblog\u002Fpractical-guide-unconvering-malicious-infrastructure)\n",{"name":5,"tags":24,"author":33,"domain":34,"license":14,"version":35,"nist_csf":36,"subdomain":31,"description":7,"mitre_attack":41},[25,26,27,28,29,30,31,32],"infrastructure-tracking","passive-dns","c2","whois","threat-actor","pivoting","threat-intelligence","domain-analysis","mahipal","cybersecurity","1.0",[37,38,39,40],"ID.RA-01","ID.RA-05","DE.CM-01","DE.AE-02",[42,43,44,45,46],"T1583.001","T1583.004","T1596.001","T1590.002","T1071.001","main","1eb986d0b0ecc180291597e08eb5a58288843536","skills\u002Fcurated_premium_skills\u002FAnthropic-Cybersecurity-Skills\u002Fskills\u002Fbuilding-adversary-infrastructure-tracking-system","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv","2026-08-25 13:16:33",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add vikasvardhanv\u002Fjerry_skills --skill building-adversary-infrastructure-tracking-system",{"tool":59,"command":60},"bunx","bunx skills add vikasvardhanv\u002Fjerry_skills --skill building-adversary-infrastructure-tracking-system",{"tool":62,"command":63},"pnpm","pnpm dlx skills add vikasvardhanv\u002Fjerry_skills --skill building-adversary-infrastructure-tracking-system","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fcurated_premium_skills\u002FAnthropic-Cybersecurity-Skills\u002Fskills\u002Fbuilding-adversary-infrastructure-tracking-system\u002FSKILL.md",true,[67,71,77],{"path":68,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":15},"LICENSE","许可证",11255,{"path":72,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Fapi-reference.md","REFERENCE","参考文档",1504,"https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fcurated_premium_skills\u002FAnthropic-Cybersecurity-Skills\u002Fskills\u002Fbuilding-adversary-infrastructure-tracking-system\u002Freferences\u002Fapi-reference.md",{"path":78,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":81,"sourceHtmlUrl":82},"scripts\u002Fagent.py","SCRIPT","脚本",4517,"https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fcurated_premium_skills\u002FAnthropic-Cybersecurity-Skills\u002Fskills\u002Fbuilding-adversary-infrastructure-tracking-system\u002Fscripts\u002Fagent.py",[84,92,99,106,113,120],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7BESR1CJ3H5SP9XM8KYJZ9W","syllabus","Generates a curated supplementary reading list from any course syllabus using Consensus academic search. Grill-me intake (syllabus input format + course audience + year range) plus a grouping forcing-options checkpoint before any search runs — so the reading list matches the course's level and recency need. Parses the syllabus to extract topics and learning outcomes, searches Consensus for recent peer-reviewed papers per topic, and produces a professionally formatted .docx with clickable Consensus links, plain-language summaries calibrated to audience level, and Bloom-higher-order discussion questions tied to course learning goals. Use when the user uploads a syllabus, course outline, or curriculum document and wants supplementary readings (e.g., 'create a reading list from this syllabus', 'find recent papers for my course') — even casual mentions with a syllabus attached should trigger this skill.","MIT","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fsyllabus\u002Fskills\u002Fsyllabus\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M7BES1YA6R97W7QPMFFM1PED","pulse","Multi-source recency research skill that takes the pulse of any topic across Reddit, Hacker News, the open web, and optionally X\u002FTwitter within a configurable recent window (default 30 days). Forcing intake clarifies topic specificity, angle (trend\u002Fsentiment\u002Fproblems\u002Fopportunities\u002Fcomparison), time window, and platform scope before searching. Returns a synthesized briefing with citations, engagement metrics, and cross-platform pattern analysis. Use when the user requests multi-source recency intelligence on a topic (e.g., 'pulse on [topic]', 'what's happening with [topic]', 'what are people saying about [topic]', 'current conversation about [topic]', 'take the pulse of [topic]', 'trending: [topic]', 'find me info on [topic]'), and for competitor research, trend discovery, tool comparisons, and audience sentiment analysis.","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fpulse\u002Fskills\u002Fpulse\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":19},"01M7BERNHYGY035AR00VRT03KE","patent","Patent prior-art and landscape intelligence skill — not generic patent help. Commits to one of five sub-use-cases via forcing intake (novelty search \u002F freedom-to-operate \u002F competitive landscape \u002F acquisition diligence \u002F litigation prior-art) before any search runs. Searches Google Patents, Espacenet, USPTO, and optionally Lens.org for citation-graph signals. Output is an editable Word document (.docx) with verdict, ranked closest art (claim-text extracted), CPC-class-aware landscape, family-resolved hits, geographic coverage, FTO flags where applicable, strategy recommendations, and full audit log. Use when the user asks for patent searching or analysis (e.g., 'prior art search for [invention]', 'freedom to operate analysis for [product]'). Produces search signal, not legal advice — always recommends consulting a patent attorney before filing or licensing decisions. Trademark, copyright, and trade-secret questions are out of scope.","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fpatent\u002Fskills\u002Fpatent\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":19},"01M7BERCK1EAKTWW7R436WAR0J","notebooklm","Browser automation skill for controlling Google's NotebookLM. Use when the user wants anything done in NotebookLM (e.g., 'open NotebookLM', 'check my [name] notebook', 'ask my notebook about X', 'add [source] to NotebookLM', 'generate a Video Overview from my notebook', 'use NotebookLM Studio'). Handles reading and querying notebooks, adding sources (URLs, text, files, YouTube links, synthesized content), generating Studio outputs (Audio\u002FVideo Overviews, Mind Maps, Reports incl. Briefing Doc\u002FStudy Guide\u002FFAQ, Flashcards, Quiz, slide decks, infographics — discover the exact set from the live Studio panel; the UI evolves fast), and creating new notebooks. Requires browser automation environment — fails gracefully when unavailable.","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fnotebooklm\u002Fskills\u002Fnotebooklm\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":19},"01M7BEQZAZAQRTXFJRY7RHV3TY","litreview","Academic literature orientation skill that searches papers via free keyless APIs (PubMed E-utilities + OpenAlex) by default — with the Consensus MCP as an optional enhancement lane when connected — builds a strategic search plan using PICO (default) or SPIDER \u002F Decomposition \u002F hybrid as fallbacks, and synthesizes findings into a formatted Word (.docx) research guide. Grill-me intake (research question specificity + framework hint + tentative depth) before the recon search; a second forcing checkpoint after Phase 2 confirms framework + sub-areas + depth before searches consume budget. Configurable depth (5\u002F10\u002F20 queries) controls coverage vs. speed. Output is a 'launching pad' — an orientation guide that lets a researcher dive in confidently, not a finished review. Use when the user starts literature-oriented research (e.g., 'litreview on [topic]', 'literature review on [topic]', 'I'm starting a literature review on X', 'I'm writing a paper on X', 'help me research X', 'I'm doing research on X', 'can you help me research X'). Do NOT use for single one-off paper searches wanting a quick list — that's a plain PubMed\u002FOpenAlex (or Consensus) query.","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Flitreview\u002Fskills\u002Flitreview\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":88,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":19},"01M7BEQKJ45K31QK5VRAQSVJCJ","grants","NIH grant research skill for clinical researchers. Grill-me intake (research idea + career stage + preliminary data + environment + submission posture + known institute targets) locks down the funding strategy before any search runs. Runs a 5-facet Consensus positioning analysis (with draft Significance\u002FInnovation language), maps the research to the right NIH institutes and study sections via RePORTER, finds NOSIs and funded overlap, and produces an editable Word document (.docx) with budget\u002Fscope-aware mechanism recommendations, submission timelines, and a mandatory program officer recommendation. Use when the user asks about research funding or makes any grant-related request (e.g., 'grants for [topic]', 'find grants for my research idea', 'what grants match my research', 'help me find NIH funding', 'grant opportunities for my research'). NIH-only scope — non-NIH funders (PCORI, DOD CDMRP, VA, foundations) are out of scope and flagged at intake.","https:\u002F\u002Fgithub.com\u002Fvikasvardhanv\u002Fjerry_skills\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fgrants\u002Fskills\u002Fgrants\u002FSKILL.md",[],[]]