From bbefd30ac613731c64fcf92878ed75201ed0d014 Mon Sep 17 00:00:00 2001 From: "paul.squizzato" Date: Mon, 20 Feb 2023 15:18:29 +0000 Subject: [PATCH] =?UTF-8?q?Test=20du=20decoder=20pour=20essayer=20de=20par?= =?UTF-8?q?ser=20les=20donnees=20envoy=C3=A9es=20par=20le=20client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Pymodbus/decoder2.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Pymodbus/decoder2.py diff --git a/Pymodbus/decoder2.py b/Pymodbus/decoder2.py new file mode 100644 index 0000000..1a0ba84 --- /dev/null +++ b/Pymodbus/decoder2.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import scapy.all as scapy +import scapy.contrib.modbus as mb + +def decode(pkt): + prt=0 + f=open("truc.txt","w") + if "ModbusADU" in pkt: + grPkt=pkt["ModbusADU"].show(dump=True) + lPkt=grPkt.splitlines() + for i in lPkt: + if "###" in i: + prt=0 + if "Write" in i or "Read" in i: + prt=1 + if prt==1: + print(i) + +scapy.sniff(iface="lo", prn=decode) +