func decodeHeader(data []byte) var hdr MyHeader err := xdumpgo.UnmarshalBinary(data, &hdr, xdumpgo.BigEndian) if err == nil fmt.Printf("Header: magic=0x%X, version=%d, len=%d\n", hdr.Magic, hdr.Version, hdr.Length)
type IPv4Plugin struct{} func (p IPv4Plugin) Name() string return "ipv4" xdumpgo tutorial
00000000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 |‰PNG........IHDR| You immediately recognize the PNG signature and IHDR chunk. The real power of xdumpgo shines when integrated into your own Go programs. Basic Dumper package main import ( "os" "github.com/example/xdumpgo" ) func decodeHeader(data []byte) var hdr MyHeader err :=
Combine with dump:
xdumpgo --plugin ipv4 -g 4 dump.bin 1. Reverse Engineering a Game Save File saveData, _ := os.ReadFile("game.sav") cfg := xdumpgo.DefaultConfig() cfg.GroupSize = 4 cfg.Endian = xdumpgo.LittleEndian xdumpgo.NewDumper(cfg).Write(os.Stdout, saveData) Spot checksum fields and embedded strings instantly. 2. Network Packet Analysis (PCAP payload) Extract UDP payload and dump it: Reverse Engineering a Game Save File saveData, _ := os