You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
492 B
23 lines
492 B
#!/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)
|
|
|