简体   繁体   中英

Modbus sniffing using python

I have 2 devices communicating with each other using Modbus and I would like to sniff this communication line using Python for logging purposes. I have connected my computer to the communication bus via a Modbus dongle, but I don't know how I can actually read the data.

I have used Pymodbus before, but I don't think that would work in this case since it only allows for master or slave devices (as far as I know)

Are there any other libraries that I can use for my purpose? Would it be possible for me to implement something like a read only socket on the COM port that doesn't interfere with existing communication on the bus?

Thank you!

You can try a MODBUS simulator like this one: It has an option to see the activity on the bus.

If you want to use another python MODBUS I recommend using modbus_tk . It has an example on how to create an MODBUS simulator. But to be able sniff the packets sent to other devices you will need to do some modifications to disable the automatic response.

If the only thing you want to do is to see the activity on the bus I recommend the first option.

I hope this helps you.

[Edit]:To be more specific you will need to download the following software : Modbus Poll - MODBUS slave simulator (which works on Windows) and plug your MODBUS dongle in the port you intend to use. After you do all the settings for the serial communications go to the Display tab and click on Communication . You will be able to see the traffic on the line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM