Skip to content

silentsignal/PGM-Kaitai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

PGM Kaitai

Kaitair structure definition for serialized IBM i (AS/400) *PGM objects.

Usage

Download and install Kaitai Struct Compiler:

Compile the structure to Python (or whatever language you prefer from Kaitai):

ksc -t python pgm.ksy

Now pgm.py is generated, you can use it like this:

from pgm import Pgm
pgm = Pgm.from_file("MIMAKPTR.pgm")
print(hex(pgm.pgm_header.program_header.trcbck_loc_ptr))

JavaScript Sucks

Kaitai Struct's JS compiler can't handle values over 53 bits, that basically screws up all pointer resolution for us.

In the latest KSY addresses we have a custom addr type, that exposes a 3-byte offset to be used when resolved as pointers to work around this problem.

Since the most mature IDE's rely on JS, we have to fall back to less sophisticated solutions:

  • The Hobbits hexeditor kind of works, but breaks after certain depth. Also, coloring is often inaccurate.
  • ksv works, but doesn't synchronize from the hex editor to the structure tree: docker run -v "$(pwd):/share" -it kaitai/ksv MIMAKPTR.pgm pgm.ksy (files should be in CWD!)
  • A dump script is included that helps identifying what structure a particular address corresponds to (grep, less, ...)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published