mac-ips2crash

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2023 License: Unlicense Imports: 6 Imported by: 0

README

mac-ips2crash

Go IPS2Crash Checks

Go IPS2Crash Release

This is a simple tool to convert a macOS IPS file into a .crash report that can be used with legacy tools and pipelines to symbolicate the crash. It can be used as a standalone tool or as a library.

This is my first open source project I am attempting to make for public use, so if you run into any issues, don't hesitate to open an issue or PR.

Tool Usage

# Tool Release Binaries are available on the releases page
# Usage as a standalone tool
Usage of ./mac-ips2crash:
  -i string
        Path to IPS file
  -o string
        Path to output crash file
        The file will replace any extension with .crash

Library Usage

go get github.com/stitchless/mac-ips2crash
package main

import (
    "fmt"
    "os"

    "github.com/stitchless/mac-ips2crash"
)

func main() {
    ipsFilePath := "/path/to/ips/file"
    file, err := os.ReadFile(ipsFilePath)
    if err != nil {
        fmt.Println(err)
        return
    }
    
    // However you have a []byte of the IPS file
    crashReport, err := ips2crash.ProcessCrashReport(file)
    if err != nil {
        fmt.Println(err)
        return
    }
    
    for _, line := range crashReport.LeadingText {
        fmt.Println(line) // Prints any test that appears before the IPS formatted file
    }
    
    // Prints any text that appears after the IPS formatted file
    for _, line := range crashReport.TrailingText {
        fmt.Println(line)
    }
    
    // Prints the first JSON object in the IPS file (the header)
    fmt.Println(crashReport.Header)
    
    // Prints the second JSON object in the IPS file (the Payload)
    fmt.Println(crashReport.Payload)
    
    // Prints the formatted report minus the leading and trailing text
    fmt.Println(crashReport.FormattedReport) 
    
    // Prints the formatted report with the leading and trailing text
    fmt.Println(crashReport.Output) 
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL