How decode asn1 hex value using asn1tools - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How decode asn1 hex value using asn1tools (/thread-31523.html) |
How decode asn1 hex value using asn1tools - C3PO - Dec-16-2020 I'm trying to decode the following ASN1 message using Python b'\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x02\x89G\x11\x00\x1a\x01\x00\x10\x00\x80\x00\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x02\x98c\xc7h\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' This is my code: import asn1tools import socket import sys sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server_address = ('239.118.122.97', 8947) #server_address = ('localhost', 8947) #server_address = ('192.168.1.63', 8948) #server_address = ('0.0.0.0', 8947) print('starting up on {} port {}'.format(*server_address)) sock.bind(server_address) while True: print('\nwaiting to receive message') data, address = sock.recvfrom(8947) print('\nreceived {} bytes from {}'.format( len(data), address)) print(data) foo = asn1tools.compile_files(data,'uper')I get the following error: I've tried also f = asn1tools convert -i uper -o jer data unsuccessfully.I expect a JSON format message. RE: How decode asn1 hex value using asn1tools - deanhystad - Dec-16-2020 asn1tools.compile_files() is expecting a file descriptor. Why are you passing data? |