{"id":15398456,"url":"https://github.com/jubnzv/iec-checker","last_synced_at":"2025-04-07T17:08:29.631Z","repository":{"id":46010850,"uuid":"236327939","full_name":"jubnzv/iec-checker","owner":"jubnzv","description":"Static analysis of IEC 61131-3 programs","archived":false,"fork":false,"pushed_at":"2025-02-20T04:13:22.000Z","size":484,"stargazers_count":70,"open_issues_count":6,"forks_count":14,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-06T11:05:51.755Z","etag":null,"topics":["ics","iec61131-3","industrial-automation","ocaml","plc","program-analysis","static-analysis","structured-text"],"latest_commit_sha":null,"homepage":"","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jubnzv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-26T15:01:47.000Z","updated_at":"2025-03-21T21:53:59.000Z","dependencies_parsed_at":"2025-02-28T23:06:51.799Z","dependency_job_id":"7eb2013f-c501-4e1c-ab8b-d9f06a4248b0","html_url":"https://github.com/jubnzv/iec-checker","commit_stats":{"total_commits":275,"total_committers":4,"mean_commits":68.75,"dds":"0.010909090909090868","last_synced_commit":"a5de624d259bb80449995ad683e0962b24597a4c"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jubnzv%2Fiec-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jubnzv%2Fiec-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jubnzv%2Fiec-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jubnzv%2Fiec-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jubnzv","download_url":"https://codeload.github.com/jubnzv/iec-checker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247694876,"owners_count":20980733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ics","iec61131-3","industrial-automation","ocaml","plc","program-analysis","static-analysis","structured-text"],"created_at":"2024-10-01T15:44:03.386Z","updated_at":"2025-04-07T17:08:29.608Z","avatar_url":"https://github.com/jubnzv.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IEC Checker\n\n\u003e ⚠️ **Note:** Development is on hold. More advanced analysis techniques are needed to cover real-world issues. Some companies are using the analyzer as it is, which is fine if they comply with the LGPL. But for serious results, consider collaborating with a skilled team dedicated to security tooling for safety-critical systems.\n\u003e\n\u003e📩 **Contact:** [oi@nowarp.io](mailto:oi@nowarp.io)\n\nThis project aims to implement an open source tool for static code analysis of [IEC 61131-3](https://en.wikipedia.org/wiki/IEC_61131-3) programs.\n\n## Supported languages\n\nThis tool currently supports [Structured Text](https://en.wikipedia.org/wiki/Structured_text) programming language, [PLCOpen XML](https://plcopen.org/technical-activities/xml-exchange) and [SEL XML](https://selinc.com/products/3530/) formats.\nIt works with extended Structured Text dialect that is completely compatible with [matiec](https://github.com/sm1820/matiec) transpiler.\n\nIf you find, that `iec-checker` doesn't work with Structured Text extensions provided by your PLC vendor, please [let me know](https://github.com/jubnzv/iec-checker/issues). This can probably be easily implemented with some tweaks in the parser.\n\n## Features\n\nThe following features are currently implemented:\n+ [PLCOpen Guidelines](https://plcopen.org/software-construction-guidelines) checks:\n  - CP1: Access to a member shall be by name\n  - CP2: All code shall be used in the application\n  - CP3: All variables shall be initialized before being used\n  - CP4: Direct addressing should not overlap\n  - CP6: Avoid external variables in functions, function blocks and classes\n  - CP8: Floating point comparison shall not be equality or inequality\n  - CP9: Limit the complexity of POU code\n  - CP13: POUs shall not call themselves directly or indirectly\n  - CP25: Data type conversion should be explicit\n  - CP28: Time and physical measures comparisons shall not be equality or inequality\n  - L10: Usage of CONTINUE and EXIT instruction should be avoided\n  - L17: Each IF instruction should have an ELSE clause\n  - N3: Define the names to avoid\n+ Declaration analysis for derived types\n+ Intraprocedural control flow analysis: detection of unreachable code blocks inside the [POUs](https://en.wikipedia.org/wiki/IEC_61131-3#Program_organization_unit_(POU))\n+ Detection of unused variables\n+ Ability to integrate with other tools. Checker can dump its IR into a JSON file (`--dump` argument) and produce warnings in JSON format (`--output-format-format json`).\n+ Can be extended with plugins written in Python. See demo plugin that plots the control flow graph: [cfg_plotter.py](./src/python/plugins/cfg_plotter.py).\n\n## Installation\n\nYou can download the latest binary release for Linux and Windows x86_64 from [GitHub releases](https://github.com/jubnzv/iec-checker/releases).\n\n### Build from sources\n\n#### Linux\n\nInstall the latest OCaml compiler and opam. Consider installation instructions at [ocaml.org](https://ocaml.org/docs/install.html) and [opam.ocaml.org](https://opam.ocaml.org/doc/Install.html).\n\nThen install the required dependencies:\n\n```bash\nopam install --deps-only .    # first time only\n```\n\nBuild and install the `bin/iec_checker` binary:\n\n```bash\nmake build\n```\n\n#### Windows\n\nInstall [OCaml for Windows](https://fdopen.github.io/opam-repository-mingw/) according to the [installation guide](https://fdopen.github.io/opam-repository-mingw/installation/). The graphic installer works well \"out of the box\".\n\nThen open installed Cygwin shell, clone the repository and use the installation instructions from the \"Linux\" section.\n\n### Optional: Python scripts and test suite\nThere is also a convenient [checker.py](./checker.py) script that wraps OCaml binary and provide additional options like extended formatting support and running the Python plugins. The test suite is also written in Python and requires a Python interpreter with some additional packages.\n\nGet [Python 3](https://www.python.org/downloads/) and install dependencies in the [virtual environment](https://docs.python.org/3/library/venv.html):\n```bash\nvirtualenv venv --python=/usr/bin/python3\nsource venv/bin/activate\npip3 install -r requirements.txt\npip3 install -r requirements-dev.txt\n```\n\nThen run unit tests:\n```bash\nmake test\n```\n\n## Usage examples\n\nCheck some demo programs written in Structured Text:\n\n```\nbin/iec_checker test/st/*.st\n```\n\nYou can also use `--help` argument to display help.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjubnzv%2Fiec-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjubnzv%2Fiec-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjubnzv%2Fiec-checker/lists"}