{"id":30623491,"url":"https://github.com/snhobbs/modbussniffer","last_synced_at":"2025-08-30T16:21:49.942Z","repository":{"id":161856773,"uuid":"335759663","full_name":"snhobbs/ModbusSniffer","owner":"snhobbs","description":"Modbus RTU packet sniffer","archived":false,"fork":false,"pushed_at":"2025-05-21T14:42:43.000Z","size":26,"stargazers_count":29,"open_issues_count":3,"forks_count":14,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-21T15:48:10.100Z","etag":null,"topics":["analyzer","embedded","industrial-automation","libmodbus","modbus","modbus-client","modbus-master","modbus-rtu","modbus-serial","network","packet","packet-sniffer","plc","pymodbus","python","sensor","sniffer"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snhobbs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2021-02-03T21:26:45.000Z","updated_at":"2025-05-21T14:42:47.000Z","dependencies_parsed_at":"2024-05-14T14:27:18.137Z","dependency_job_id":"4664d199-1053-494a-ad40-433e54827b99","html_url":"https://github.com/snhobbs/ModbusSniffer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/snhobbs/ModbusSniffer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snhobbs%2FModbusSniffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snhobbs%2FModbusSniffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snhobbs%2FModbusSniffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snhobbs%2FModbusSniffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snhobbs","download_url":"https://codeload.github.com/snhobbs/ModbusSniffer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snhobbs%2FModbusSniffer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272875034,"owners_count":25007865,"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","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["analyzer","embedded","industrial-automation","libmodbus","modbus","modbus-client","modbus-master","modbus-rtu","modbus-serial","network","packet","packet-sniffer","plc","pymodbus","python","sensor","sniffer"],"created_at":"2025-08-30T16:21:41.029Z","updated_at":"2025-08-30T16:21:49.937Z","avatar_url":"https://github.com/snhobbs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ModbusSniffer\nModbus RTU packet sniffer\n\n**ModbusSniffer** is a simple Modbus RTU packet sniffer for serial buses.\n\nIt wraps `pymodbus` to decode and print all packets observed on the wire,\nfrom either the master or slave perspective. This is especially useful\nfor debugging communication between Modbus devices, verifying protocol behavior,\nor reverse-engineering device interactions.\n\n## Features\n- Pure Python, built on [pymodbus](https://github.com/pymodbus-dev/pymodbus)\n- Captures and decodes Modbus RTU packets from both master and slave devices\n- Great for protocol debugging, development, and test benches\n-️ Simple command-line interface with readable log output\n- Easily extensible for custom logging or automation\n\n## Installation\n```bash\ngit clone https://github.com/snhobbs/ModbusSniffer\ncd ModbusSniffer\npip install .\n```\n\n## Usage\n**Terminal output only**\n```bash\nmodbus_sniffer --port /dev/ttyUSB0 --baud 9600\npython3 modbus_sniffer.py --port /dev/ttyUSB0 --baud 9600\n```\n\n**With logfile output**\n```bash\nmodbus_sniffer --port /dev/ttyUSB0 --baud 19200 --logfile modbus.log\npython3 modbus_sniffer.py --port /dev/ttyUSB0 --baud 19200 --logfile modbus.log\n```\n\n| Option       | Description                                   |\n| ------------ | --------------------------------------------- |\n| `--port, -p` | Serial port to open (default: `/dev/ttyUSB0`) |\n| `--baud, -b` | Baud rate (default: `9600`)                   |\n| `--timeout`  | Set Modbus read timeout manually              |\n| `--debug`    | Enable verbose debug logging                  |\n\n\n## Testing with socat\n1. Setup a simulated serial link\n\n```bash\nsocat -d -d pty,raw,echo=0,link=/tmp/ttyS0 pty,raw,echo=0,link=/tmp/ttyS1\n```\n\n2. Start modbus_sniffer\n```bash\npython modbus_sniffer.py --port /tmp/ttyS0 --baud 9600\n```\n\n3. Run test script\n```bash\npython tests/send_client_requests.py /tmp/ttyS1 --baud 9600\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnhobbs%2Fmodbussniffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnhobbs%2Fmodbussniffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnhobbs%2Fmodbussniffer/lists"}