[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78M7EB9ZKPAR2DGPKK760K2":3,"skill-same:01M78M7EB9ZKPAR2DGPKK760K2":77},{"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":38,"commitSha":39,"skillDirectory":40,"forksCount":41,"repositoryHtmlUrl":42,"repositoryHomepageUrl":6,"ownerHtmlUrl":43,"ownerBlogUrl":44,"ownerDescription":45,"updatedAt":46,"install":47,"resources":60},"01M78M7EB9ZKPAR2DGPKK760K2","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.","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\u002Fdetecting-anomalies-in-industrial-control-systems\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdetecting-anomalies-in-industrial-control-systems\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: detecting-anomalies-in-industrial-control-systems\ndescription: >\n  This skill covers deploying anomaly detection systems for industrial control\n  environments using machine learning models trained on OT network baselines,\n  physics-based process models, and behavioral analysis of industrial protocol\n  communications. It addresses building normal behavior profiles for SCADA polling\n  patterns, detecting deviations in Modbus\u002FDNP3\u002FOPC UA traffic, identifying rogue\n  devices, and correlating network anomalies with physical process data from historians.\ndomain: cybersecurity\nsubdomain: ot-ics-security\ntags: [ot-security, ics, scada, industrial-control, iec62443, anomaly-detection, machine-learning]\nversion: 1.0.0\nauthor: mahipal\nlicense: Apache-2.0\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":25,"author":33,"domain":34,"license":15,"version":35,"subdomain":36,"description":37},[26,27,28,29,30,31,32],"ot-security","ics","scada","industrial-control","iec62443","anomaly-detection","machine-learning","mahipal","cybersecurity","1.0.0","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","main","99825ad3f3bcc6597ddcc7294a14e6e922f2b67b","skills\u002Fdetecting-anomalies-in-industrial-control-systems",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":48,"prompt":58,"zipAvailable":59},[49,52,55],{"tool":50,"command":51},"npx","npx skills add jukeyman\u002Fjukeyman-skills --skill detecting-anomalies-in-industrial-control-systems",{"tool":53,"command":54},"bunx","bunx skills add jukeyman\u002Fjukeyman-skills --skill detecting-anomalies-in-industrial-control-systems",{"tool":56,"command":57},"pnpm","pnpm dlx skills add jukeyman\u002Fjukeyman-skills --skill detecting-anomalies-in-industrial-control-systems","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdetecting-anomalies-in-industrial-control-systems\u002FSKILL.md",true,[61,65,71],{"path":62,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":66,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":69,"sourceHtmlUrl":70},"references\u002Fapi-reference.md","REFERENCE","参考文档",1772,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdetecting-anomalies-in-industrial-control-systems\u002Freferences\u002Fapi-reference.md",{"path":72,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":75,"sourceHtmlUrl":76},"scripts\u002Fagent.py","SCRIPT","脚本",6784,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fdetecting-anomalies-in-industrial-control-systems\u002Fscripts\u002Fagent.py",[78,86,93,100,107,115],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":82,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"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":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":82,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"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":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":82,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"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":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":82,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"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":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":82,"licenseFileUrl":111,"sourceHtmlUrl":112,"categories":113,"keywords":114,"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":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":82,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"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",[],[]]