Skip to content
Snippets Groups Projects
Commit 54e2bc03 authored by gpotter2's avatar gpotter2
Browse files

Add analyse data test to pnio_rtc

parent ea91ebad
No related branches found
No related tags found
No related merge requests found
......@@ -104,3 +104,22 @@ p == Ether(dst='00:01:02:03:04:05', src='06:07:08:09:0a:0b') / ProfinetIO(frameI
]
)
= PNIORealTime - Analyse data
# Possible thanks to https://github.com/ITI/ICS-Security-Tools/blob/master/pcaps/profinet/profinet.pcap
bind_layers(UDP, ProfinetIO, dport=0x8894)
bind_layers(UDP, ProfinetIO, sport=0x8894)
packets = [Ether('0090274ee3fc000991442017080045000128000c00004011648f0a0a00810a0a00968894061e011444c604022800100000000000a0de976cd111827100010003015a0100a0de976cd111827100a02442df7ddbabbaec1d005443b2500b01630abafd0100000001000000000000000500ffffffffbc000000000000000000a80000004080000000000000a80000008009003c0100000a0000000000000000000000000000000000000000000000010000f840000000680000000000000000000000000000000000000000000000000030002c0100000100000000000200000000000100020001000000010003ffff010a0001ffff814000010001ffff814000310018010000010000000000010001ffff814000010001ffff814000320018010000010000000000010000000000010001000100000001'.decode("hex")),
Ether('0009914420170090274ee3fc0800450000c0b28800008011727a0a0a00960a0a0081061e889400ac689504000800100000000000a0de976cd111827100010003015a0100a0de976cd111827100a02442df7ddbabbaec1d005443b2500b01630abafd0000000001000000000000000500ffffffff54000000000040800000400000004080000000000000400000000009003c0100000a0000000000000000000000000000000000000000000000010000f84000008000000000000000000000000000000000000000000000000000'.decode("hex"))]
analysed_data = PNIORealTime.analyse_data(packets)
assert len(analysed_data) == 2
x = analysed_data[('00:09:91:44:20:17', '00:90:27:4e:e3:fc')]
assert len(x) == 2
assert x[0][1] == PNIORealTimeRawData
assert x[0][0] == -262
assert x[0][2]["length"] == 87
ProfinetIO._overload_fields[UDP].pop("sport")
ProfinetIO._overload_fields[UDP]["dport"] = 0x8892
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment