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

1
2
3
4
5
6
7
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 2,243 Jun-14-2021, 09:25 AM
Last Post: Melcu54
  How decode asn1 hex value using asn1tools C3PO 1 3,135 Dec-16-2020, 11:45 PM
Last Post: deanhystad
  Is there a better way? Python parsing tlewick1 1 2,215 Oct-17-2020, 05:48 PM
Last Post: bowlofred
  XML Parsing in python aarushprathap 2 2,901 Jul-11-2020, 09:29 AM
Last Post: j.crater
  python realtime parsing logs anna 2 4,527 Jul-05-2020, 06:36 AM
Last Post: anna
  Parsing Text file having repeated value key pair using python manussnair 3 4,147 Aug-04-2018, 11:48 PM
Last Post: micseydel
  Python file parsing, can't catch strings in new line Philia 5 5,100 Apr-29-2018, 01:09 PM
Last Post: snippsat
  Parsing csv using python Firstname_Lastname 4 4,688 Sep-03-2017, 06:26 PM
Last Post: Larz60+
  Text file parsing with python and with a list in grammar pitanga 2 3,913 Aug-31-2017, 02:21 PM
Last Post: pitanga
  PyInstaller, how to create library folder instead of library.zip file ? harun2525 2 5,675 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