All Projects → jubnzv → iec-checker

jubnzv / iec-checker

Licence: LGPL-3.0 license
Static analysis of IEC 61131-3 programs

Programming Languages

ocaml
1615 projects
python
139335 projects - #7 most used programming language
smalltalk
420 projects
Makefile
30231 projects

Projects that are alternatives of or similar to iec-checker

vscode-st
Extension for VS Code to support Structured Text language.
Stars: ✭ 94 (+161.11%)
Mutual labels:  plc, structured-text, iec61131-3
Pyre Check
Performant type-checking for python.
Stars: ✭ 5,716 (+15777.78%)
Mutual labels:  static-analysis, program-analysis
Phasar
A LLVM-based static analysis framework.
Stars: ✭ 503 (+1297.22%)
Mutual labels:  static-analysis, program-analysis
Bap
Binary Analysis Platform
Stars: ✭ 1,385 (+3747.22%)
Mutual labels:  static-analysis, program-analysis
Seahorn
SeaHorn Verification Framework
Stars: ✭ 270 (+650%)
Mutual labels:  static-analysis, program-analysis
Linter
Static Analysis Compiler Plugin for Scala
Stars: ✭ 273 (+658.33%)
Mutual labels:  static-analysis, program-analysis
Crab
CoRnucopia of ABstractions: a library for building abstract interpretation-based analyses
Stars: ✭ 102 (+183.33%)
Mutual labels:  static-analysis, program-analysis
Isf
ISF(Industrial Control System Exploitation Framework),a exploitation framework based on Python
Stars: ✭ 690 (+1816.67%)
Mutual labels:  plc, ics
Crab Llvm
Static Analyzer for LLVM bitcode based on Abstract Interpretation
Stars: ✭ 143 (+297.22%)
Mutual labels:  static-analysis, program-analysis
Pyt
A Static Analysis Tool for Detecting Security Vulnerabilities in Python Web Applications
Stars: ✭ 2,061 (+5625%)
Mutual labels:  static-analysis, program-analysis
Detect It Easy
Program for determining types of files for Windows, Linux and MacOS.
Stars: ✭ 2,982 (+8183.33%)
Mutual labels:  static-analysis, program-analysis
progge.rs
Program analysis playground for a simple, imperative language
Stars: ✭ 29 (-19.44%)
Mutual labels:  static-analysis, program-analysis
clam
Static Analyzer for LLVM bitcode based on Abstract Interpretation
Stars: ✭ 180 (+400%)
Mutual labels:  static-analysis, program-analysis
Wala
T.J. Watson Libraries for Analysis
Stars: ✭ 395 (+997.22%)
Mutual labels:  static-analysis, program-analysis
tiro
TIRO - A hybrid iterative deobfuscation framework for Android applications
Stars: ✭ 20 (-44.44%)
Mutual labels:  static-analysis, program-analysis
Ikos
Static analyzer for C/C++ based on the theory of Abstract Interpretation.
Stars: ✭ 1,368 (+3700%)
Mutual labels:  static-analysis, program-analysis
CyberICS.github.io
News and publication on cybersecurity in industry
Stars: ✭ 29 (-19.44%)
Mutual labels:  plc, ics
Icsmaster
ICS/SCADA Security Resource(整合工控安全相关资源)
Stars: ✭ 582 (+1516.67%)
Mutual labels:  plc, ics
Semgrep Rules
Semgrep rules registry
Stars: ✭ 140 (+288.89%)
Mutual labels:  static-analysis, program-analysis
Codeql Go
The CodeQL extractor and libraries for Go.
Stars: ✭ 224 (+522.22%)
Mutual labels:  static-analysis, program-analysis

IEC Checker

License: LGPL v3

This project aims to implement an open source tool for static code analysis of IEC 61131-3 programs.

Supported languages

This tool currently supports Structured Text programming language, PLCOpen XML and SEL XML formats. It works with extended Structured Text dialect that is completely compatible with matiec transpiler.

If you find, that iec-checker doesn't work with Structured Text extensions provided by your PLC vendor, please let me know. This can probably be easily implemented with some tweaks in the parser.

Features

The following features are currently implemented:

  • PLCOpen Guidelines checks:
    • CP1: Access to a member shall be by name
    • CP2: All code shall be used in the application
    • CP3: All variables shall be initialized before being used
    • CP4: Direct addressing should not overlap
    • CP6: Avoid external variables in functions, function blocks and classes
    • CP8: Floating point comparison shall not be equality or inequality
    • CP9: Limit the complexity of POU code
    • CP13: POUs shall not call themselves directly or indirectly
    • CP25: Data type conversion should be explicit
    • CP28: Time and physical measures comparisons shall not be equality or inequality
    • L10: Usage of CONTINUE and EXIT instruction should be avoided
    • L17: Each IF instruction should have an ELSE clause
    • N3: Define the names to avoid
  • Declaration analysis for derived types
  • Intraprocedural control flow analysis: detection of unreachable code blocks inside the POUs
  • Detection of unused variables
  • 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).
  • Can be extended with plugins written in Python. See demo plugin that plots the control flow graph: cfg_plotter.py.

Installation

You can download the latest binary release for Linux and Windows x86_64 from GitHub releases.

Build from sources

Linux

Install the latest OCaml compiler and opam. Consider installation instructions at ocaml.org and opam.ocaml.org.

Then install the required dependencies:

opam install --deps-only .    # first time only

Build and install the bin/iec_checker binary:

make build

Windows

Install OCaml for Windows according to the installation guide. The graphic installer works well "out of the box".

Then open installed Cygwin shell, clone the repository and use the installation instructions from the "Linux" section.

Optional: Python scripts and test suite

There is also a convenient 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.

Get Python 3 and install dependencies in the virtual environment:

virtualenv venv --python=/usr/bin/python3
source venv/bin/activate
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt

Then run unit tests:

make test

Usage examples

Check some demo programs written in Structured Text:

bin/iec_checker test/st/*.st

You can also use --help argument to display help.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].