CBrunsch / scambus

Scambus is a python based wireless M-Bus scanner and dissector
MIT License
30 stars 16 forks source link

Exception during decoding telegram #4

Closed wochen closed 5 years ago

wochen commented 6 years ago

Hi,

I'm trying to decode the sample telegram (already decrypted) and I've received this error:

./reader.py -v -t '3E442D4C744400151E027A070030852F2F066D0987C0A1013404032AED100004833C00000000042B1800000004AB3C000000002F2F2F2F2F2F2F2F2F2F2F2F' filename: text: 3E442D4C744400151E027A070030852F2F066D0987C0A1013404032AED100004833C00000000042B1800000004AB3C000000002F2F2F2F2F2F2F2F2F2F2F2F verbosity: 2 hex: 3E 44 2D 4C 74 44 00 15 1E 02 7A 07 00 30 85 2F 2F 06 6D 09 87 C0 A1 01 34 04 03 2A ED 10 00 04 83 3C 00 00 00 00 04 2B 18 00 00 00 04 AB 3C 00 00 00 00 2F 2F 2F 2F 2F 2F 2F 2F 2F 2F 2F 2F Traceback (most recent call last): File "./reader.py", line 49, in <module> main(sys.argv[1:]) File "./reader.py", line 45, in main frame.log(verbosity) File "/Users/tomek/Work/M-BUS/Python/scambus/wmbus.py", line 206, in log line += '\nVIFs:\t' + util.tohex(rec.header.vif) + " (" + rec.header.get_vif_description() + ")" TypeError: cannot concatenate 'str' and 'NoneType' objects

Will you be able to have a look into this?

Thanks.

CBrunsch commented 5 years ago

Well, we have two issues here.

a) Primary VIF 6D was not registered within wmbus.py => pull to update b) Your frames claimes to be encrypted (the header states it) but the payload is actually plain

scammer:~/Dev/scambus$ ./reader.py -v -t '3E442D4C744400151E027A070030852F2F066D0987C0A1013404032AED100004833C00000000042B1800000004AB3C000000002F2F2F2F2F2F2F2F2F2F2F2F'
filename:  
text:  3E442D4C744400151E027A070030852F2F066D0987C0A1013404032AED100004833C00000000042B1800000004AB3C000000002F2F2F2F2F2F2F2F2F2F2F2F
verbosity:  2
hex:  3E 44 2D 4C 74 44 00 15 1E 02 7A 07 00 30 85 2F 2F 06 6D 09 87 C0 A1 01 34 04 03 2A ED 10 00 04 83 3C 00 00 00 00 04 2B 18 00 00 00 04 AB 3C 00 00 00 00 2F 2F 2F 2F 2F 2F 2F 2F 2F 2F 2F 2F
cut:  06 6D 09 87 C0 A1 01 34 04 03 2A ED 10 00 04 83 3C 00 00 00 00 04 2B 18 00 00 00 04 AB 3C 00 00 00 00
Nov 01 21:18:41 SAM 15 00 44 74 SND-NR Records: 5
--
CI Detail:  7A (EN 13757-3 Application Layer with short Transport Layer, SND-NR)
header:     short header
has errors: False
access:     Limited access
config word:    85 30
mode:       5 (AES encryption with CBC; IV is not zero)
iv:     2D 4C 74 44 00 15 1E 02 07 07 07 07 07 07 07 07
key:        WARNING no suitable key configured
--
DIFs:   06 (Instantaneous value, 48 Bit Integer/Binary)
VIFs:   6D (Date/time depending on data field 0100b=type F, 0011b=type J, 0110b=type I)
Value:  34 01 A1 C0 87 09
--
DIFs:   04 (Instantaneous value, 32 Bit Integer/Binary)
VIFs:   03 (Energy Wh)
Value:  00 10 ED 2A
--
DIFs:   04 (Instantaneous value, 32 Bit Integer/Binary)
VIFs:   83 3C (VIF not found)
Value:  00 00 00 00
--
DIFs:   04 (Instantaneous value, 32 Bit Integer/Binary)
VIFs:   2B (Power W)
Value:  00 00 00 18
--
DIFs:   04 (Instantaneous value, 32 Bit Integer/Binary)
VIFs:   AB 3C (VIF not found)
Value:  00 00 00 00
--