Nov-29-2022, 09:55 PM
(Nov-29-2022, 08:10 PM)deanhystad Wrote: Your idea of stripping off non-printable characters is dangerous. The example below starts with bytes 0x1, 0x80, 0x51, 0x0. The danger is that 0x51 is the value of "Q". This "Q" is surrounded by other non-printable bytes, but what if it was just before "Test"? Unless you know that those leading bytes mean, you have to believe that potentially all the bytes could be printable and there won't be any "\" to look for.
I would do some research to find out what the leading bytes mean. The values probably tell you where the text starts. How did you get these bytes objects?
Output:b'\x01\x80Q\x01\x00\x01\x12\x00\x00\x80Test Message 12345'
I did notice that the "prefix" bytes contain the length of the message.
b'\x01\x80Q\x01\x00\x01\x12
\x00\x00\x80Test Message 12345' Message Length = b'\x12'
b'7
\x00\x00\x00You find many blocks, can you send me some coin please!' Message Length = b'7'
b'\x01T
\x00\x00\x80{"market":"2","rate":"2600","account":"ltc1q3la84qedyf2745y8cel4wklgqalsvh8xjk7g2k"}' Message Length = b'T'
the other bytes are info on what type of transaction this is, etc.. im pulling that off in other parts of the script and using it.. I just am too new and for some reason couldnt figure this out.. but im getting there.. slowly. :D