alerighi / modbus-sniffer Goto Github PK
View Code? Open in Web Editor NEWA sniffer for the modbus protocol
License: MIT License
A sniffer for the modbus protocol
License: MIT License
Finally recieved my USB RS-485 dongle. Driver is loaded:
[ 16.285543] usbcore: registered new interface driver ch341
[ 16.285606] usbserial: USB Serial support registered for ch341-uart
[ 16.285648] ch341 1-1.1:1.0: ch341-uart converter detected
[ 16.288046] usb 1-1.1: ch341-uart converter now attached to ttyUSB0
When I start the sniffer, I get the following error:
frank@odroid:~/modbus-sniffer$ ./sniffer -p /dev/ttyUSB0
output file: -
serial port: /dev/ttyUSB0
port type: 8N1 9600 baud
time interval: 1500
starting modbus sniffer
ioctl get: Inappropriate ioctl for device
Any idea what causes this error?
I also tried https://github.com/j123b567/SerialPCAP , this one is working (so the USB device is working) but I don't like the bulkiness of te mono framework.
Hi,
I'm trying to log some modbus traffic between my huawei inverter and smart meter.
It works only partly.
The requests from the inverter to the smart meter and the request and responses to/from the battery decode correctly.
But the response from the smartmeter is really long (i think 80 registers so 160 bytes requested, 165 bytes in total).
The output is like this
captured packet 206: length = 8, CRC: 32A7 = 32A7 [OK]
DUMP: 0B 03 08 36 00 50 A7 32
captured packet 207: length = 32, CRC: 5AC9 = 439A [FAIL]
captured packet 208: length = 32, CRC: 151A = C3CD [FAIL]
captured packet 209: length = 32, CRC: 0E0A = 4366 [FAIL]
captured packet 210: length = 32, CRC: C808 = C29A [FAIL]
captured packet 211: length = 32, CRC: E08C = 4233 [FAIL]
captured packet 212: length = 5, CRC: BC28 = 2853 [FAIL]
I tried playing around with the --interval parameter but I can't get it to decode properly.
I also have a hard time finding the correct documentation for all the serial port functions.
Maybe you can guide me what to adjust so that the response paket is read as a whole?
Best regards,
Philipp
I would like to send all sniffed data to MQTT (in a human readable form). Would it be possible to pipe the output to Wireshark or tshark to get an almost realtime human readable output, so I can pick that up and send it to MQTT?
hey dude, thanks for the tool, super helpful for me...
I don't write C, but short opt for --interval -> -t didn't work for me... maybe my syntax was wrong or something on this line here? missing t?
while ((opt = getopt_long(argc, argv, "ho:p:s:P:S:b:l", long_options, NULL)) >= 0) {
thanks again!
unavail in std libs, unable to compile.
Hi i am trying to decipher the communication between a Solar Inverter and a Power Energy meter.
Can i just connect this into the bus with a (RS485 to USB connector) both of these devices and it will sniff all communication between them or is this for sniffing an application on my PC sending on to the RS485 bus ?
Craig
Thank you for this cool piece of code!
I'm currently wondering, how the defined interval is affecting the data.
I built a test-setup with two slaves operating in half-duplex at 9600baud and had to set the interval to 2000ms in order to log the packets correctly.
This works perfectly but I'm about to install it in a bigger setup with approx. 14 slaves on a single bus, where the bus-messages might not be in coordinated intervals of 2000ms or 1500ms.
What is the internal function of the interval? Might it cut a message in half, if the interval is set on a too low value?
Thx!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.