feat(binana): add tokens database
Some checks failed
Push / build (push) Has been cancelled

This commit is contained in:
phaneron 2026-03-20 01:58:16 -04:00
parent ac268a16c8
commit 2c2815ab0b
22 changed files with 2122 additions and 2 deletions

109
go/pdbconv/db.go Normal file
View file

@ -0,0 +1,109 @@
package pdbconv
type ClassMember struct {
Datatype string `json:"datatype,omitempty"`
Kind string `json:"kind,omitempty"`
Length uint64 `json:"length,omitempty"`
Name string `json:"name,omitempty"`
Offset uint64 `json:"offset,omitempty"`
}
type Class struct {
Length string `json:"length,omitempty"`
Name string `json:"name,omitempty"`
Members []ClassMember `json:"member,omitempty"`
}
type DatatypeMember struct {
Datatype string `json:"datatype,omitempty"`
Kind string `json:"kind,omitempty"`
Length uint64 `json:"length,omitempty"`
Name string `json:"name,omitempty"`
Offset uint64 `json:"offset,omitempty"`
}
type Datatype struct {
Kind string `json:"kind,omitempty"`
Length string `json:"length,omitempty"`
Name string `json:"name,omitempty"`
Members []DatatypeMember `json:"member,omitempty"`
}
type EnumMember struct {
Name string `json:"name,omitempty"`
Value int `json:"value,omitempty"`
}
type Enum struct {
Length uint64 `json:"length,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Members []EnumMember `json:"member,omitempty"`
}
type FunctionLineNumber struct {
Address string `json:"addr,omitempty"`
End int `json:"end,omitempty"`
Length int `json:"length,omitempty"`
SourceFile string `json:"source_file,omitempty"`
Start int `json:"start,omitempty"`
}
type FunctionStackVariable struct {
Datatype string `json:"datatype,omitempty"`
Kind string `json:"kind,omitempty"`
Length uint64 `json:"length,omitempty"`
Name string `json:"name,omitempty"`
Offset uint64 `json:"offset,omitempty"`
}
type Function struct {
Address string `json:"address,omitempty"`
Length uint64 `json:"length,omitempty"`
Name string `json:"name,omitempty"`
LineNumbers []FunctionLineNumber `json:"line_numbers,omitempty"`
StackVariables []FunctionStackVariable `json:"stack_variables,omitempty"`
}
type TableSegment struct {
Address string `json:"address,omitempty"`
Number int `json:"number,omitempty"`
}
type TableSourceFile struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
}
type TableSymbol struct {
Address string `json:"address,omitempty"`
Datatype string `json:"datatype,omitempty"`
Index uint64 `json:"index,omitempty"`
Kind string `json:"kind,omitempty"`
Length uint64 `json:"length,omitempty"`
Name string `json:"name,omitempty"`
Tag string `json:"tag,omitempty"`
Undecorated string `json:"undecorated,omitempty"`
Value string `json:"value,omitempty"`
}
type Table struct {
Name string `json:"name,omitempty"`
Segments []TableSegment `json:"segments,omitempty"`
SourceFiles []TableSourceFile `json:"source_files,omitempty"`
Symbols []TableSymbol `json:"symbols,omitempty"`
}
type Typedef struct {
Basetype string `json:"basetype,omitempty"`
Name string `json:"name,omitempty"`
}
type ProgramDatabase struct {
Classes []Class `json:"classes,omitempty"`
Datatypes []Datatype `json:"datatypes,omitempty"`
Enums []Enum `json:"enums,omitempty"`
Functions []Function `json:"functions,omitempty"`
Tables []Table `json:"tables,omitempty"`
Typedefs []Typedef `json:"typedefs,omitempty"`
}

93
go/pdbconv/xml.go Normal file
View file

@ -0,0 +1,93 @@
package pdbconv
type GhidraXml struct {
Classes struct {
Class []struct {
Length string `xml:"length,attr"`
Name string `xml:"name,attr"`
Member []struct {
Datatype string `xml:"datatype,attr"`
Kind string `xml:"kind,attr"`
Length string `xml:"length,attr"`
Name string `xml:"name,attr"`
Offset string `xml:"offset,attr"`
} `xml:"member"`
} `xml:"class"`
} `xml:"classes"`
Datatypes struct {
Datatype []struct {
Kind string `xml:"kind,attr"`
Length string `xml:"length,attr"`
Name string `xml:"name,attr"`
Member []struct {
Datatype string `xml:"datatype,attr"`
Kind string `xml:"kind,attr"`
Length string `xml:"length,attr"`
Name string `xml:"name,attr"`
Offset string `xml:"offset,attr"`
} `xml:"member"`
} `xml:"datatype"`
} `xml:"datatypes"`
Enums struct {
Enum []struct {
Length string `xml:"length,attr"`
Name string `xml:"name,attr"`
Type string `xml:"type,attr"`
Member []struct {
Name string `xml:"name,attr"`
Value int `xml:"value,attr"`
} `xml:"member"`
} `xml:"enum"`
} `xml:"enums"`
Functions struct {
Function []struct {
Address string `xml:"address,attr"`
Length string `xml:"length,attr"`
Name string `xml:"name,attr"`
LineNumber []struct {
Addr string `xml:"addr,attr"`
End int `xml:"end,attr"`
Length int `xml:"length,attr"`
SourceFile string `xml:"source_file,attr"`
Start int `xml:"start,attr"`
} `xml:"line_number"`
StackVariable []struct {
Datatype string `xml:"datatype,attr"`
Kind string `xml:"kind,attr"`
Length string `xml:"length,attr"`
Name string `xml:"name,attr"`
Offset string `xml:"offset,attr"`
} `xml:"stack_variable"`
} `xml:"function"`
} `xml:"functions"`
Tables struct {
Table []struct {
Name string `xml:"name,attr"`
Segment []struct {
Address string `xml:"address,attr"`
Number int `xml:"number,attr"`
} `xml:"segment"`
SourceFile []struct {
ID string `xml:"id,attr"`
Name string `xml:"name,attr"`
} `xml:"source_file"`
Symbol []struct {
Address string `xml:"address,attr"`
Datatype string `xml:"datatype,attr"`
Index string `xml:"index,attr"`
Kind string `xml:"kind,attr"`
Length string `xml:"length,attr"`
Name string `xml:"name,attr"`
Tag string `xml:"tag,attr"`
Undecorated string `xml:"undecorated,attr"`
Value string `xml:"value,attr"`
} `xml:"symbol"`
} `xml:"table"`
} `xml:"tables"`
Typedefs struct {
Typedef []struct {
Basetype string `xml:"basetype,attr"`
Name string `xml:"name,attr"`
} `xml:"typedef"`
} `xml:"typedefs"`
}