[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ET8JWBF2KGW511APP1138B":3,"skill-same:01M6ET8JWBF2KGW511APP1138B":118},{"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":79,"commitSha":80,"skillDirectory":81,"forksCount":14,"repositoryHtmlUrl":82,"repositoryHomepageUrl":83,"ownerHtmlUrl":84,"ownerBlogUrl":6,"ownerDescription":85,"updatedAt":86,"install":87,"resources":100},"01M6ET8JWBF2KGW511APP1138B","detecting-anomalies-in-industrial-control-systems",null,"This skill covers deploying anomaly detection systems for industrial control environments using machine learning models trained on OT network baselines, physics-based process models, and behavioral analysis of industrial protocol communications. It addresses building normal behavior profiles for SCADA polling patterns, detecting deviations in Modbus\u002FDNP3\u002FOPC UA traffic, identifying rogue devices, and correlating network anomalies with physical process data from historians.","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\u002Fdetecting-anomalies-in-industrial-control-systems\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],"systems","control","detecting anomalies in industrial control systems","control systems","behavioral","communications","de","physics","map","patterns","cm","security","aml","ICS-security","analysis","modbus","data","network","pr","cybersecurity","2026-11-10 10:12:30",false,"---\nname: detecting-anomalies-in-industrial-control-systems\ndescription: 'This skill covers deploying anomaly detection systems for industrial\n  control environments using machine learning models trained on OT network baselines,\n  physics-based process models, and behavioral analysis of industrial protocol communications.\n  It addresses building normal behavior profiles for SCADA polling patterns, detecting\n  deviations in Modbus\u002FDNP3\u002FOPC UA traffic, identifying rogue devices, and correlating\n  network anomalies with physical process data from historians.\n\n  '\ndomain: cybersecurity\nsubdomain: ot-ics-security\ntags:\n- ot-security\n- ics\n- scada\n- industrial-control\n- iec62443\n- anomaly-detection\n- machine-learning\nversion: 1.0.0\nauthor: mahipal\nlicense: Apache-2.0\natlas_techniques:\n- AML.T0043\n- AML.T0018\nnist_ai_rmf:\n- MEASURE-2.7\n- MEASURE-2.5\n- MAP-5.1\nnist_csf:\n- PR.IR-01\n- DE.CM-01\n- ID.AM-05\n- GV.OC-02\nmitre_attack:\n- T0836\n- T0831\n- T0832\n- T0814\n- T0801\n---\n\n# Detecting Anomalies in Industrial Control Systems\n\n## When to Use\n\n- When deploying continuous monitoring for OT environments that lack intrusion detection\n- When building behavior-based detection to complement signature-based IDS in OT networks\n- When establishing baselines for deterministic SCADA communications to detect deviations\n- When integrating machine learning anomaly detection with OT security monitoring platforms\n- When investigating alerts from Nozomi Guardian or Dragos Platform that require deeper analysis\n\n**Do not use** for signature-based detection of known exploits (see detecting-attacks-on-scada-systems), for IT network anomaly detection without OT protocols, or as a replacement for process safety systems (SIS).\n\n## Prerequisites\n\n- Passive network monitoring sensors on OT network SPAN\u002FTAP ports\n- Minimum 2-4 weeks of baseline traffic capture during normal operations\n- Python 3.9+ with scikit-learn, numpy, pandas for ML model training\n- Process historian access for physical process correlation data\n- Understanding of normal operational patterns including shift changes, batch processes, and maintenance windows\n\n## Workflow\n\n### Step 1: Build Multi-Dimensional Baseline Model\n\nCapture and model the deterministic behavior of ICS communications across multiple dimensions: timing, protocol behavior, and network topology.\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"ICS Anomaly Detection System.\n\nBuilds multi-dimensional baselines from OT network traffic and\ndetects anomalies using statistical and machine learning methods.\nDesigned for deterministic SCADA communication patterns.\n\"\"\"\n\nimport json\nimport sys\nimport time\nimport warnings\nfrom collections import defaultdict\nfrom datetime import datetime, timedelta\nfrom dataclasses import dataclass, field\n\nimport numpy as np\nimport pandas as pd\nfrom sklearn.ensemble import IsolationForest\nfrom sklearn.preprocessing import StandardScaler\n\nwarnings.filterwarnings(\"ignore\")\n\n\n@dataclass\nclass CommunicationProfile:\n    \"\"\"Profile for a single master-slave communication pair.\"\"\"\n    src_ip: str\n    dst_ip: str\n    protocol: str\n    port: int\n    avg_interval_ms: float = 0.0\n    std_interval_ms: float = 0.0\n    avg_payload_size: float = 0.0\n    function_codes: dict = field(default_factory=dict)\n    packets_per_minute: float = 0.0\n    first_seen: str = \"\"\n    last_seen: str = \"\"\n\n\nclass ICSAnomalyDetector:\n    \"\"\"Multi-dimensional anomaly detection for ICS environments.\"\"\"\n\n    def __init__(self):\n        self.profiles = {}\n        self.topology_baseline = set()\n        self.timing_model = None\n        self.isolation_forest = None\n        self.scaler = StandardScaler()\n        self.anomalies = []\n        self.training_data = []\n\n    def build_baseline_from_pcap(self, pcap_data):\n        \"\"\"Build baselines from parsed pcap data (list of flow records).\"\"\"\n        print(\"[*] Building ICS communication baselines...\")\n\n        for flow in pcap_data:\n            key = f\"{flow['src']}->{flow['dst']}:{flow['port']}\"\n\n            if key not in self.profiles:\n                self.profiles[key] = CommunicationProfile(\n                    src_ip=flow[\"src\"],\n                    dst_ip=flow[\"dst\"],\n                    protocol=flow.get(\"protocol\", \"TCP\"),\n                    port=flow[\"port\"],\n                    first_seen=flow.get(\"timestamp\", \"\"),\n                )\n\n            profile = self.profiles[key]\n            profile.last_seen = flow.get(\"timestamp\", \"\")\n\n            # Track function codes for industrial protocols\n            fc = flow.get(\"function_code\")\n            if fc is not None:\n                profile.function_codes[fc] = profile.function_codes.get(fc, 0) + 1\n\n            # Add to topology baseline\n            self.topology_baseline.add((flow[\"src\"], flow[\"dst\"], flow[\"port\"]))\n\n        # Calculate interval statistics\n        self._calculate_timing_stats(pcap_data)\n\n        print(f\"  Communication pairs: {len(self.profiles)}\")\n        print(f\"  Topology entries: {len(self.topology_baseline)}\")\n\n    def _calculate_timing_stats(self, flows):\n        \"\"\"Calculate packet timing statistics per communication pair.\"\"\"\n        timestamps = defaultdict(list)\n        for flow in flows:\n            key = f\"{flow['src']}->{flow['dst']}:{flow['port']}\"\n            ts = flow.get(\"timestamp_epoch\")\n            if ts:\n                timestamps[key].append(ts)\n\n        for key, ts_list in timestamps.items():\n            if key in self.profiles and len(ts_list) > 1:\n                ts_sorted = sorted(ts_list)\n                intervals = [\n                    (ts_sorted[i+1] - ts_sorted[i]) * 1000\n                    for i in range(len(ts_sorted) - 1)\n                ]\n                self.profiles[key].avg_interval_ms = np.mean(intervals)\n                self.profiles[key].std_interval_ms = np.std(intervals)\n                duration_min = (ts_sorted[-1] - ts_sorted[0]) \u002F 60\n                if duration_min > 0:\n                    self.profiles[key].packets_per_minute = len(ts_list) \u002F duration_min\n\n    def train_isolation_forest(self, features_df):\n        \"\"\"Train Isolation Forest model on feature vectors from baseline traffic.\"\"\"\n        print(\"[*] Training Isolation Forest model...\")\n\n        feature_cols = [\n            \"interval_ms\", \"payload_size\", \"packets_per_window\",\n            \"unique_func_codes\", \"new_connection_flag\",\n        ]\n\n        available_cols = [c for c in feature_cols if c in features_df.columns]\n        X = features_df[available_cols].fillna(0).values\n\n        X_scaled = self.scaler.fit_transform(X)\n\n        self.isolation_forest = IsolationForest(\n            n_estimators=200,\n            contamination=0.01,  # Expect 1% anomaly rate in baseline\n            random_state=42,\n            n_jobs=-1,\n        )\n        self.isolation_forest.fit(X_scaled)\n\n        scores = self.isolation_forest.decision_function(X_scaled)\n        print(f\"  Model trained on {len(X)} samples\")\n        print(f\"  Anomaly score range: [{scores.min():.4f}, {scores.max():.4f}]\")\n        print(f\"  Threshold: {np.percentile(scores, 1):.4f}\")\n\n    def detect_topology_anomaly(self, src_ip, dst_ip, port):\n        \"\"\"Detect new\u002Funauthorized communication pairs.\"\"\"\n        if (src_ip, dst_ip, port) not in self.topology_baseline:\n            return {\n                \"type\": \"NEW_COMMUNICATION_PAIR\",\n                \"severity\": \"high\",\n                \"detail\": f\"New connection: {src_ip} -> {dst_ip}:{port} not in baseline\",\n                \"recommendation\": \"Verify if this is an authorized new device or configuration change\",\n            }\n        return None\n\n    def detect_timing_anomaly(self, src_ip, dst_ip, port, interval_ms):\n        \"\"\"Detect polling interval deviations.\"\"\"\n        key = f\"{src_ip}->{dst_ip}:{port}\"\n        profile = self.profiles.get(key)\n\n        if profile and profile.std_interval_ms > 0:\n            z_score = abs(interval_ms - profile.avg_interval_ms) \u002F profile.std_interval_ms\n            if z_score > 4.0:\n                return {\n                    \"type\": \"TIMING_ANOMALY\",\n                    \"severity\": \"medium\",\n                    \"detail\": (\n                        f\"Interval {interval_ms:.1f}ms deviates from baseline \"\n                        f\"{profile.avg_interval_ms:.1f}ms (z-score: {z_score:.1f})\"\n                    ),\n                    \"recommendation\": \"Check for network congestion, device malfunction, or MITM attack\",\n                }\n        return None\n\n    def detect_function_code_anomaly(self, src_ip, dst_ip, port, func_code):\n        \"\"\"Detect unauthorized Modbus\u002FDNP3 function codes.\"\"\"\n        key = f\"{src_ip}->{dst_ip}:{port}\"\n        profile = self.profiles.get(key)\n\n        if profile and func_code not in profile.function_codes:\n            severity = \"critical\" if func_code in {5, 6, 15, 16, 8} else \"high\"\n            return {\n                \"type\": \"UNAUTHORIZED_FUNCTION_CODE\",\n                \"severity\": severity,\n                \"detail\": (\n                    f\"Function code {func_code} from {src_ip} to {dst_ip}:{port} \"\n                    f\"not in baseline. Allowed: {list(profile.function_codes.keys())}\"\n                ),\n                \"recommendation\": \"Investigate source - possible command injection attack\",\n            }\n        return None\n\n    def analyze_flow(self, flow):\n        \"\"\"Analyze a single network flow against all detection models.\"\"\"\n        results = []\n\n        # Topology check\n        topo = self.detect_topology_anomaly(flow[\"src\"], flow[\"dst\"], flow[\"port\"])\n        if topo:\n            results.append(topo)\n\n        # Timing check\n        if \"interval_ms\" in flow:\n            timing = self.detect_timing_anomaly(\n                flow[\"src\"], flow[\"dst\"], flow[\"port\"], flow[\"interval_ms\"])\n            if timing:\n                results.append(timing)\n\n        # Function code check\n        if \"function_code\" in flow:\n            fc = self.detect_function_code_anomaly(\n                flow[\"src\"], flow[\"dst\"], flow[\"port\"], flow[\"function_code\"])\n            if fc:\n                results.append(fc)\n\n        self.anomalies.extend(results)\n        return results\n\n    def generate_report(self):\n        \"\"\"Generate anomaly detection report.\"\"\"\n        print(f\"\\n{'='*60}\")\n        print(f\"ICS ANOMALY DETECTION REPORT\")\n        print(f\"{'='*60}\")\n        print(f\"Baseline Profiles: {len(self.profiles)}\")\n        print(f\"Anomalies Detected: {len(self.anomalies)}\")\n\n        severity_counts = defaultdict(int)\n        for a in self.anomalies:\n            severity_counts[a[\"severity\"]] += 1\n\n        for sev in [\"critical\", \"high\", \"medium\", \"low\"]:\n            if severity_counts[sev]:\n                print(f\"  {sev.upper()}: {severity_counts[sev]}\")\n\n        for a in self.anomalies[:20]:\n            print(f\"\\n  [{a['severity'].upper()}] {a['type']}\")\n            print(f\"    {a['detail']}\")\n\n\nif __name__ == \"__main__\":\n    print(\"ICS Anomaly Detection System\")\n    print(\"Load baseline data and call analyze_flow() for real-time detection\")\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Deterministic Traffic | ICS networks exhibit highly predictable communication patterns where the same master polls the same slaves at fixed intervals with identical function codes |\n| Isolation Forest | Unsupervised machine learning algorithm that isolates anomalies by randomly partitioning feature space, effective for OT traffic with low anomaly rates |\n| Polling Interval | Time between consecutive SCADA master requests to a slave device, typically fixed and configurable (100ms to 10s) |\n| Function Code Allowlist | Set of permitted industrial protocol operations for each communication pair, enforced by anomaly detection rules |\n| Topology Baseline | Complete map of all authorized device-to-device communication paths in the OT network |\n| Physics-Based Detection | Using physical process models (thermodynamics, fluid dynamics) to detect attacks that manipulate the process while spoofing sensor data |\n\n## Tools & Systems\n\n- **Nozomi Networks Guardian**: OT anomaly detection with AI-powered baseline learning and industrial protocol analysis\n- **Dragos Platform**: Threat detection using behavioral analytics and threat intelligence specific to ICS environments\n- **Scikit-learn**: Python ML library with Isolation Forest, One-Class SVM, and Local Outlier Factor for anomaly detection\n- **Zeek with OT plugins**: Network security monitor with Modbus, DNP3, and BACnet protocol analyzers for baseline building\n\n## Output Format\n\n```\nICS Anomaly Detection Report\n==============================\nDetection Period: YYYY-MM-DD to YYYY-MM-DD\nBaseline Size: [N] communication profiles\n\nANOMALIES DETECTED: [N]\n  Critical: [N]  High: [N]  Medium: [N]  Low: [N]\n\n[SEVERITY] ANOMALY_TYPE\n  Source: [IP] -> Target: [IP]:[Port]\n  Detail: [Description of deviation from baseline]\n  Baseline: [Expected behavior]\n  Observed: [Actual behavior]\n```\n","# Detecting Anomalies in Industrial Control Systems\n\n## When to Use\n\n- When deploying continuous monitoring for OT environments that lack intrusion detection\n- When building behavior-based detection to complement signature-based IDS in OT networks\n- When establishing baselines for deterministic SCADA communications to detect deviations\n- When integrating machine learning anomaly detection with OT security monitoring platforms\n- When investigating alerts from Nozomi Guardian or Dragos Platform that require deeper analysis\n\n**Do not use** for signature-based detection of known exploits (see detecting-attacks-on-scada-systems), for IT network anomaly detection without OT protocols, or as a replacement for process safety systems (SIS).\n\n## Prerequisites\n\n- Passive network monitoring sensors on OT network SPAN\u002FTAP ports\n- Minimum 2-4 weeks of baseline traffic capture during normal operations\n- Python 3.9+ with scikit-learn, numpy, pandas for ML model training\n- Process historian access for physical process correlation data\n- Understanding of normal operational patterns including shift changes, batch processes, and maintenance windows\n\n## Workflow\n\n### Step 1: Build Multi-Dimensional Baseline Model\n\nCapture and model the deterministic behavior of ICS communications across multiple dimensions: timing, protocol behavior, and network topology.\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"ICS Anomaly Detection System.\n\nBuilds multi-dimensional baselines from OT network traffic and\ndetects anomalies using statistical and machine learning methods.\nDesigned for deterministic SCADA communication patterns.\n\"\"\"\n\nimport json\nimport sys\nimport time\nimport warnings\nfrom collections import defaultdict\nfrom datetime import datetime, timedelta\nfrom dataclasses import dataclass, field\n\nimport numpy as np\nimport pandas as pd\nfrom sklearn.ensemble import IsolationForest\nfrom sklearn.preprocessing import StandardScaler\n\nwarnings.filterwarnings(\"ignore\")\n\n\n@dataclass\nclass CommunicationProfile:\n    \"\"\"Profile for a single master-slave communication pair.\"\"\"\n    src_ip: str\n    dst_ip: str\n    protocol: str\n    port: int\n    avg_interval_ms: float = 0.0\n    std_interval_ms: float = 0.0\n    avg_payload_size: float = 0.0\n    function_codes: dict = field(default_factory=dict)\n    packets_per_minute: float = 0.0\n    first_seen: str = \"\"\n    last_seen: str = \"\"\n\n\nclass ICSAnomalyDetector:\n    \"\"\"Multi-dimensional anomaly detection for ICS environments.\"\"\"\n\n    def __init__(self):\n        self.profiles = {}\n        self.topology_baseline = set()\n        self.timing_model = None\n        self.isolation_forest = None\n        self.scaler = StandardScaler()\n        self.anomalies = []\n        self.training_data = []\n\n    def build_baseline_from_pcap(self, pcap_data):\n        \"\"\"Build baselines from parsed pcap data (list of flow records).\"\"\"\n        print(\"[*] Building ICS communication baselines...\")\n\n        for flow in pcap_data:\n            key = f\"{flow['src']}->{flow['dst']}:{flow['port']}\"\n\n            if key not in self.profiles:\n                self.profiles[key] = CommunicationProfile(\n                    src_ip=flow[\"src\"],\n                    dst_ip=flow[\"dst\"],\n                    protocol=flow.get(\"protocol\", \"TCP\"),\n                    port=flow[\"port\"],\n                    first_seen=flow.get(\"timestamp\", \"\"),\n                )\n\n            profile = self.profiles[key]\n            profile.last_seen = flow.get(\"timestamp\", \"\")\n\n            # Track function codes for industrial protocols\n            fc = flow.get(\"function_code\")\n            if fc is not None:\n                profile.function_codes[fc] = profile.function_codes.get(fc, 0) + 1\n\n            # Add to topology baseline\n            self.topology_baseline.add((flow[\"src\"], flow[\"dst\"], flow[\"port\"]))\n\n        # Calculate interval statistics\n        self._calculate_timing_stats(pcap_data)\n\n        print(f\"  Communication pairs: {len(self.profiles)}\")\n        print(f\"  Topology entries: {len(self.topology_baseline)}\")\n\n    def _calculate_timing_stats(self, flows):\n        \"\"\"Calculate packet timing statistics per communication pair.\"\"\"\n        timestamps = defaultdict(list)\n        for flow in flows:\n            key = f\"{flow['src']}->{flow['dst']}:{flow['port']}\"\n            ts = flow.get(\"timestamp_epoch\")\n            if ts:\n                timestamps[key].append(ts)\n\n        for key, ts_list in timestamps.items():\n            if key in self.profiles and len(ts_list) > 1:\n                ts_sorted = sorted(ts_list)\n                intervals = [\n                    (ts_sorted[i+1] - ts_sorted[i]) * 1000\n                    for i in range(len(ts_sorted) - 1)\n                ]\n                self.profiles[key].avg_interval_ms = np.mean(intervals)\n                self.profiles[key].std_interval_ms = np.std(intervals)\n                duration_min = (ts_sorted[-1] - ts_sorted[0]) \u002F 60\n                if duration_min > 0:\n                    self.profiles[key].packets_per_minute = len(ts_list) \u002F duration_min\n\n    def train_isolation_forest(self, features_df):\n        \"\"\"Train Isolation Forest model on feature vectors from baseline traffic.\"\"\"\n        print(\"[*] Training Isolation Forest model...\")\n\n        feature_cols = [\n            \"interval_ms\", \"payload_size\", \"packets_per_window\",\n            \"unique_func_codes\", \"new_connection_flag\",\n        ]\n\n        available_cols = [c for c in feature_cols if c in features_df.columns]\n        X = features_df[available_cols].fillna(0).values\n\n        X_scaled = self.scaler.fit_transform(X)\n\n        self.isolation_forest = IsolationForest(\n            n_estimators=200,\n            contamination=0.01,  # Expect 1% anomaly rate in baseline\n            random_state=42,\n            n_jobs=-1,\n        )\n        self.isolation_forest.fit(X_scaled)\n\n        scores = self.isolation_forest.decision_function(X_scaled)\n        print(f\"  Model trained on {len(X)} samples\")\n        print(f\"  Anomaly score range: [{scores.min():.4f}, {scores.max():.4f}]\")\n        print(f\"  Threshold: {np.percentile(scores, 1):.4f}\")\n\n    def detect_topology_anomaly(self, src_ip, dst_ip, port):\n        \"\"\"Detect new\u002Funauthorized communication pairs.\"\"\"\n        if (src_ip, dst_ip, port) not in self.topology_baseline:\n            return {\n                \"type\": \"NEW_COMMUNICATION_PAIR\",\n                \"severity\": \"high\",\n                \"detail\": f\"New connection: {src_ip} -> {dst_ip}:{port} not in baseline\",\n                \"recommendation\": \"Verify if this is an authorized new device or configuration change\",\n            }\n        return None\n\n    def detect_timing_anomaly(self, src_ip, dst_ip, port, interval_ms):\n        \"\"\"Detect polling interval deviations.\"\"\"\n        key = f\"{src_ip}->{dst_ip}:{port}\"\n        profile = self.profiles.get(key)\n\n        if profile and profile.std_interval_ms > 0:\n            z_score = abs(interval_ms - profile.avg_interval_ms) \u002F profile.std_interval_ms\n            if z_score > 4.0:\n                return {\n                    \"type\": \"TIMING_ANOMALY\",\n                    \"severity\": \"medium\",\n                    \"detail\": (\n                        f\"Interval {interval_ms:.1f}ms deviates from baseline \"\n                        f\"{profile.avg_interval_ms:.1f}ms (z-score: {z_score:.1f})\"\n                    ),\n                    \"recommendation\": \"Check for network congestion, device malfunction, or MITM attack\",\n                }\n        return None\n\n    def detect_function_code_anomaly(self, src_ip, dst_ip, port, func_code):\n        \"\"\"Detect unauthorized Modbus\u002FDNP3 function codes.\"\"\"\n        key = f\"{src_ip}->{dst_ip}:{port}\"\n        profile = self.profiles.get(key)\n\n        if profile and func_code not in profile.function_codes:\n            severity = \"critical\" if func_code in {5, 6, 15, 16, 8} else \"high\"\n            return {\n                \"type\": \"UNAUTHORIZED_FUNCTION_CODE\",\n                \"severity\": severity,\n                \"detail\": (\n                    f\"Function code {func_code} from {src_ip} to {dst_ip}:{port} \"\n                    f\"not in baseline. Allowed: {list(profile.function_codes.keys())}\"\n                ),\n                \"recommendation\": \"Investigate source - possible command injection attack\",\n            }\n        return None\n\n    def analyze_flow(self, flow):\n        \"\"\"Analyze a single network flow against all detection models.\"\"\"\n        results = []\n\n        # Topology check\n        topo = self.detect_topology_anomaly(flow[\"src\"], flow[\"dst\"], flow[\"port\"])\n        if topo:\n            results.append(topo)\n\n        # Timing check\n        if \"interval_ms\" in flow:\n            timing = self.detect_timing_anomaly(\n                flow[\"src\"], flow[\"dst\"], flow[\"port\"], flow[\"interval_ms\"])\n            if timing:\n                results.append(timing)\n\n        # Function code check\n        if \"function_code\" in flow:\n            fc = self.detect_function_code_anomaly(\n                flow[\"src\"], flow[\"dst\"], flow[\"port\"], flow[\"function_code\"])\n            if fc:\n                results.append(fc)\n\n        self.anomalies.extend(results)\n        return results\n\n    def generate_report(self):\n        \"\"\"Generate anomaly detection report.\"\"\"\n        print(f\"\\n{'='*60}\")\n        print(f\"ICS ANOMALY DETECTION REPORT\")\n        print(f\"{'='*60}\")\n        print(f\"Baseline Profiles: {len(self.profiles)}\")\n        print(f\"Anomalies Detected: {len(self.anomalies)}\")\n\n        severity_counts = defaultdict(int)\n        for a in self.anomalies:\n            severity_counts[a[\"severity\"]] += 1\n\n        for sev in [\"critical\", \"high\", \"medium\", \"low\"]:\n            if severity_counts[sev]:\n                print(f\"  {sev.upper()}: {severity_counts[sev]}\")\n\n        for a in self.anomalies[:20]:\n            print(f\"\\n  [{a['severity'].upper()}] {a['type']}\")\n            print(f\"    {a['detail']}\")\n\n\nif __name__ == \"__main__\":\n    print(\"ICS Anomaly Detection System\")\n    print(\"Load baseline data and call analyze_flow() for real-time detection\")\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Deterministic Traffic | ICS networks exhibit highly predictable communication patterns where the same master polls the same slaves at fixed intervals with identical function codes |\n| Isolation Forest | Unsupervised machine learning algorithm that isolates anomalies by randomly partitioning feature space, effective for OT traffic with low anomaly rates |\n| Polling Interval | Time between consecutive SCADA master requests to a slave device, typically fixed and configurable (100ms to 10s) |\n| Function Code Allowlist | Set of permitted industrial protocol operations for each communication pair, enforced by anomaly detection rules |\n| Topology Baseline | Complete map of all authorized device-to-device communication paths in the OT network |\n| Physics-Based Detection | Using physical process models (thermodynamics, fluid dynamics) to detect attacks that manipulate the process while spoofing sensor data |\n\n## Tools & Systems\n\n- **Nozomi Networks Guardian**: OT anomaly detection with AI-powered baseline learning and industrial protocol analysis\n- **Dragos Platform**: Threat detection using behavioral analytics and threat intelligence specific to ICS environments\n- **Scikit-learn**: Python ML library with Isolation Forest, One-Class SVM, and Local Outlier Factor for anomaly detection\n- **Zeek with OT plugins**: Network security monitor with Modbus, DNP3, and BACnet protocol analyzers for baseline building\n\n## Output Format\n\n```\nICS Anomaly Detection Report\n==============================\nDetection Period: YYYY-MM-DD to YYYY-MM-DD\nBaseline Size: [N] communication profiles\n\nANOMALIES DETECTED: [N]\n  Critical: [N]  High: [N]  Medium: [N]  Low: [N]\n\n[SEVERITY] ANOMALY_TYPE\n  Source: [IP] -> Target: [IP]:[Port]\n  Detail: [Description of deviation from baseline]\n  Baseline: [Expected behavior]\n  Observed: [Actual behavior]\n```\n",{"name":5,"tags":49,"author":57,"domain":43,"license":15,"version":58,"nist_csf":59,"subdomain":64,"description":65,"nist_ai_rmf":66,"mitre_attack":70,"atlas_techniques":76},[50,51,52,53,54,55,56],"ot-security","ics","scada","industrial-control","iec62443","anomaly-detection","machine-learning","mahipal","1.0.0",[60,61,62,63],"PR.IR-01","DE.CM-01","ID.AM-05","GV.OC-02","ot-ics-security","This skill covers deploying anomaly detection systems for industrial control environments using machine learning models trained on OT network baselines, physics-based process models, and behavioral analysis of industrial protocol communications. It addresses building normal behavior profiles for SCADA polling patterns, detecting deviations in Modbus\u002FDNP3\u002FOPC UA traffic, identifying rogue devices, and correlating network anomalies with physical process data from historians.\n",[67,68,69],"MEASURE-2.7","MEASURE-2.5","MAP-5.1",[71,72,73,74,75],"T0836","T0831","T0832","T0814","T0801",[77,78],"AML.T0043","AML.T0018","main","7925716f065257435fdb12e97f7e52842147d5ad",".claude\u002Fskills\u002Fdetecting-anomalies-in-industrial-control-systems","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":88,"prompt":98,"zipAvailable":99},[89,92,95],{"tool":90,"command":91},"npx","npx skills add henriquescastilho\u002Fmy-claude --skill detecting-anomalies-in-industrial-control-systems",{"tool":93,"command":94},"bunx","bunx skills add henriquescastilho\u002Fmy-claude --skill detecting-anomalies-in-industrial-control-systems",{"tool":96,"command":97},"pnpm","pnpm dlx skills add henriquescastilho\u002Fmy-claude --skill detecting-anomalies-in-industrial-control-systems","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdetecting-anomalies-in-industrial-control-systems\u002FSKILL.md",true,[101,106,112],{"path":102,"resourceType":102,"resourceTypeDesc":103,"sizeBytes":104,"sourceHtmlUrl":105},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdetecting-anomalies-in-industrial-control-systems\u002FLICENSE",{"path":107,"resourceType":108,"resourceTypeDesc":109,"sizeBytes":110,"sourceHtmlUrl":111},"references\u002Fapi-reference.md","REFERENCE","参考文档",1772,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdetecting-anomalies-in-industrial-control-systems\u002Freferences\u002Fapi-reference.md",{"path":113,"resourceType":114,"resourceTypeDesc":115,"sizeBytes":116,"sourceHtmlUrl":117},"scripts\u002Fagent.py","SCRIPT","脚本",6784,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdetecting-anomalies-in-industrial-control-systems\u002Fscripts\u002Fagent.py",[119,160,169,178,200,225],{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":123,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":140,"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",[126,129,132,135],{"categoryNo":127,"categoryName":128,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理",{"categoryNo":130,"categoryName":131,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":133,"categoryName":134,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000004","电子表格",{"categoryNo":136,"categoryName":137,"taxonomyType":138,"taxonomyTypeDesc":139},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[121,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159],"docx","PDF","pptx","xlsx","documents","csv","ocr","Audio","Bash","markdown","convert","read","write","edit","html","images","files","youtube","with",{"skillNo":161,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":123,"licenseFileUrl":6,"sourceHtmlUrl":162,"categories":163,"keywords":168,"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",[164,165,166,167],{"categoryNo":127,"categoryName":128,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":130,"categoryName":131,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":133,"categoryName":134,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":136,"categoryName":137,"taxonomyType":138,"taxonomyTypeDesc":139},[121,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159],{"skillNo":170,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":123,"licenseFileUrl":6,"sourceHtmlUrl":171,"categories":172,"keywords":177,"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",[173,174,175,176],{"categoryNo":127,"categoryName":128,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":130,"categoryName":131,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":133,"categoryName":134,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":136,"categoryName":137,"taxonomyType":138,"taxonomyTypeDesc":139},[121,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159],{"skillNo":179,"name":180,"nameZh":6,"description":181,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":123,"licenseFileUrl":6,"sourceHtmlUrl":182,"categories":183,"keywords":184,"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",[],[185,186,187,188,189,190,191,192,193,194,195,196,197,198,199],"python","zarr python","storage","integration","s3","gcs","cloud","dask","parallel","pipelines","arrays","numpy","scientific computing","scale","scientific",{"skillNo":201,"name":202,"nameZh":6,"description":203,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":123,"licenseFileUrl":6,"sourceHtmlUrl":204,"categories":205,"keywords":207,"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",[206],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[208,209,210,211,212,213,38,214,215,216,217,152,153,218,219,220,221,222,223,224],"oracle","what if oracle","go","run","ux","futures","explore","decision","branch","question","idea","exploration","options","stress-test","strategies","scenario","stress",{"skillNo":226,"name":227,"nameZh":6,"description":228,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":123,"licenseFileUrl":6,"sourceHtmlUrl":229,"categories":230,"keywords":241,"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",[231,234,237,238],{"categoryNo":232,"categoryName":233,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":235,"categoryName":236,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000021","资料检索与研究",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":239,"categoryName":240,"taxonomyType":138,"taxonomyTypeDesc":139},"01JBSEEDCAT000000000000036","内容创作者",[242,243,244,245,246,247,248,249,149,250,152,153,154,251,252,253,254,255,199,256],"templates","venue templates","research","guidelines","NeurIPS","ICML","LaTeX","science","access","proposals","Academic","requirements","formatting","journal","chi"]