Python Forum
Parsing ASN1 CDR using Python library asn1
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parsing ASN1 CDR using Python library asn1
#1
Hi I am trying to decode ASN.1 BER file using python library asn1 using the ASN1 Schema in XML or JSON. But i am not able to do so.

ASN1 SCHEMA SAMPLE:-

Output:
-- ASN.1 Formal Description AIROUTPUTCDR {iso(1) member-body(2) bsi(826) disc(0) ericsson(1249) mobileDomain (0) charging (5) aIROUTPUTCDR (1) asn1Module (0)} DEFINITIONS IMPLICIT TAGS ::= BEGIN EXPORTS DetailOutputRecord; DetailOutputRecord ::= CHOICE { -- tags [0] reserved -- tags [1] reserved -- tags [2] reserved -- tags [3] reserved adjustmentRecordV2 [4] AdjustmentRecordV2, offlinepromotionRecordV2 [5] OfflinePromotionRecordV2, refillRecordV2 [6] RefillRecordV2, errorRecordV2 [7] ErrorRecordV2, communicationIDChangeRecord [8] CommunicationIDChangeRecord, -- PC:15605 cdrFileControlBlock [9] CDRFileControlBlock -- end PC:15605 }......
I also have the BER File. I want to write python code for parsing the BER file as the sample ASN1 shared above. Do we have any python library that accepts the schema and BER and gives output in XML or JSON or CSV format. I am not able to find any such library. I am trying with asn1 python library but documentation is limited and i am stuck. Please help.

Code snippet

import asn1 
import future 
decoder = asn1.Decoder()
output=decoder.start("C:/asn/log.ber")
#print(output)
tag, value = decoder.read()
print(tag,value)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Parsing link from html tags with Python Melcu54 0 1,601 Jun-14-2021, 09:25 AM
Last Post: Melcu54
  How decode asn1 hex value using asn1tools C3PO 1 2,311 Dec-16-2020, 11:45 PM
Last Post: deanhystad
  Is there a better way? Python parsing tlewick1 1 1,740 Oct-17-2020, 05:48 PM
Last Post: bowlofred
  XML Parsing in python aarushprathap 2 2,280 Jul-11-2020, 09:29 AM
Last Post: j.crater
  python realtime parsing logs anna 2 2,807 Jul-05-2020, 06:36 AM
Last Post: anna
  Parsing Text file having repeated value key pair using python manussnair 3 3,267 Aug-04-2018, 11:48 PM
Last Post: micseydel
  Python file parsing, can't catch strings in new line Philia 5 3,943 Apr-29-2018, 01:09 PM
Last Post: snippsat
  Parsing csv using python Firstname_Lastname 4 3,926 Sep-03-2017, 06:26 PM
Last Post: Larz60+
  Text file parsing with python and with a list in grammar pitanga 2 3,215 Aug-31-2017, 02:21 PM
Last Post: pitanga
  PyInstaller, how to create library folder instead of library.zip file ? harun2525 2 4,782 May-06-2017, 11:29 AM
Last Post: harun2525

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020