Code Monkey home page Code Monkey logo

cper_parser.py's Introduction

CPER_parser.py

This python script parses a CPER (Common Platform Error Record) formatted raw data that is contained in an error event log provided by WHEA-Logger. You can read the CPER documentation at https://uefi.org/sites/default/files/resources/UEFI_Spec_2_2_D.pdf

This script can... (for now)

  • Parse the record header
  • Parse multiple section descriptors

This script canNOT... (for now)

  • Parse raw data of each sections

Usage

Simply run the script and copy/paste the raw data you want to read.

Disclaimer

The script has been tested with CPER from my own event logs and CPER that were posted on the internet. At this moment, the script is still incomplete and is only capable of parsing the record header and section descriptors. Although I will try my best to implement a parsing function for raw data of each section, I cannot guarantee the completion.
Also, please be aware that the parse result may contain inaccurate results. It is highly recommended that you check the result by yourself.
Feedbacks are very much welcome.

Output Example

$ python cper_parser.py  
CPER Raw data parser

CPER Raw data: 435045521002FFFFFFFF03000200000002000000680300000B060A00070115140000000000000000000000000000000000000000000000000000000000000000BDC407CF89B7184EB3C41F732CB57131B248949139377F4BA8F1E0062805C2A377C6CF4D86E2D60100000000000000000000000000000000000000000000000058010000C00000000003000001000000ADCC7698B447DB4BB65E16F193C4F3DB0000000000000000000000000000000002000000000000000000000000000000000000000000000018020000400000000003000000000000B0A03EDC44A19747B95B53FA242B6E1D0000000000000000000000000000000002000000000000000000000000000000000000000000000058020000100100000003000000000000011D1E8AF94257459C33565E5CC3F7E8000000000000000000000000000000000200000000000000000000000000000000000000000000005701000000000000000208000000000055060A000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B00000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000B0000000000000055060A000008200BFFFBFA7FFFFBEBBF000000000000000000000000000000000000000000000000000000000000000002000000010000009853A8B9DCE4D6010B0000000000000000000000000000000000000000000000050001004000009000000000000000000000000000000000000000000B0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

####################
CPER Parse result

Raw data length: 872
####################


###################
[Record Header]
###################
- Signature Start   : 43504552 (CPER)
- Revision          : 1002
- Signature End     : FFFFFFFF
- Section Count     : 3
- Error Severity    : Corrected
- Validation Bits   : Valid values in: Timestamp
- Record Length     : 872
- Timestamp         : 2021/1/7 10:6:11 (UTC)
- Platform ID       : 00000000000000000000000000000000
- Partition ID      : 00000000000000000000000000000000
- Creator ID        : BDC407CF89B7184EB3C41F732CB57131
- Notification Type : B248949139377F4BA8F1E0062805C2A3
- Record ID         : 77C6CF4D86E2D601
- Flags             : 00000000
- Persistence Info  : 0000000000000000
- Reserved [ZERO]   : 000000000000000000000000


#########################
[Sections]
#########################
[Section 0]
- Section Offset    : 344
- Section Length    : 192
- Section Revision  : 0003
- Section ValidBit  : 00
- Reserved [ZERO]   : 00
- Flags             : 01000000
- Section Types     : ADCC7698B447DB4BB65E16F193C4F3DB
- FRU Id            : 00000000000000000000000000000000
- Section Severity  : Corrected
- FRU Text (Hex)    : 0000000000000000000000000000000000000000
- FRU Text (Ascii)  : 

- Section Content   : 5701000000000000000208000000000055060A000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B000000000000000000000000000000000000000000000000000000000000000000000000000000



[Section 1]
- Section Offset    : 536
- Section Length    : 64
- Section Revision  : 0003
- Section ValidBit  : 00
- Reserved [ZERO]   : 00
- Flags             : 00000000
- Section Types     : B0A03EDC44A19747B95B53FA242B6E1D
- FRU Id            : 00000000000000000000000000000000
- Section Severity  : Corrected
- FRU Text (Hex)    : 0000000000000000000000000000000000000000
- FRU Text (Ascii)  : 

- Section Content   : 03000000000000000B0000000000000055060A000008200BFFFBFA7FFFFBEBBF0000000000000000000000000000000000000000000000000000000000000000



[Section 2]
- Section Offset    : 600
- Section Length    : 272
- Section Revision  : 0003
- Section ValidBit  : 00
- Reserved [ZERO]   : 00
- Flags             : 00000000
- Section Types     : 011D1E8AF94257459C33565E5CC3F7E8
- FRU Id            : 00000000000000000000000000000000
- Section Severity  : Corrected
- FRU Text (Hex)    : 0000000000000000000000000000000000000000
- FRU Text (Ascii)  : 

- Section Content   : 02000000010000009853A8B9DCE4D6010B0000000000000000000000000000000000000000000000050001004000009000000000000000000000000000000000000000000B0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

cper_parser.py's People

Contributors

4k95m avatar

Stargazers

 avatar  avatar

Watchers

 avatar

cper_parser.py's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.