Skip to content

Instantly share code, notes, and snippets.

@scusi
Created October 29, 2014 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scusi/ce9b67b4a559cd7eb3f9 to your computer and use it in GitHub Desktop.
Save scusi/ce9b67b4a559cd7eb3f9 to your computer and use it in GitHub Desktop.
Paresing FritzBox BPjM Files useing bpjm module in golang
// tool that uses my bpjm library to load and parse a BPJM File from a FritzBox
package main
import(
"github.com/scusi/bpjm"
"fmt"
"os"
)
func main(){
filename := os.Args[1]
data := Bpjm.LoadFritzBoxFile(filename)
obj := Bpjm.ParseFritzBoxFile(data)
fmt.Printf("File Magick: %x\n", obj.Magick)
fmt.Printf("Filen Name: %s\n", obj.EmbedFileName)
fmt.Printf("File Size: %d bytes\n", obj.Size)
fmt.Printf("File Records: %d\n", obj.Records)
n := 0
for i, _ := range obj.Entries {
fmt.Printf("%x ", obj.Entries[i].DomainMd5)
fmt.Printf("%x ", obj.Entries[i].PathMd5)
fmt.Printf("%x\n", obj.Entries[i].Depth)
n++
}
}
// TODO: integrate json marshaller
@scusi
Copy link
Author

scusi commented Oct 29, 2014

the module 'github.com/scusi/bpjm' is available at https://gist.github.com/scusi/bec0d15f1eda1a778d37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment