mirror of
https://github.com/thunderbrewhq/binana.git
synced 2025-12-12 09:52:28 +00:00
feat(go): x64dbg can't parse types correctly without being in the correct order, but we can use Kahn topological sorting to avoid issues
This commit is contained in:
parent
df04015c59
commit
b6fb39c844
12 changed files with 475 additions and 35 deletions
|
|
@ -40,4 +40,5 @@ func init() {
|
|||
x64dbg_gen.Flags().StringP("base-address", "b", "00400000", "the base address of the module")
|
||||
|
||||
rootCmd.AddCommand(x64dbg_gen)
|
||||
rootCmd.AddCommand(x64dbg_typesort)
|
||||
}
|
||||
|
|
|
|||
32
go/cmd/binana/cmd/x64dbg_typesort.go
Normal file
32
go/cmd/binana/cmd/x64dbg_typesort.go
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/thunderbrewhq/binana/go/x64dbg"
|
||||
)
|
||||
|
||||
var x64dbg_typesort = &cobra.Command{
|
||||
Use: "x64dbg-typesort [types.json file]",
|
||||
Short: "sort a x64dbg types file",
|
||||
Run: x64dbg_typesort_func,
|
||||
}
|
||||
|
||||
func x64dbg_typesort_func(cmd *cobra.Command, args []string) {
|
||||
types, err := x64dbg.LoadTypes(args[0])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err = x64dbg.SortTypes(types); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
encoder := json.NewEncoder(os.Stdout)
|
||||
encoder.SetIndent("", " ")
|
||||
if err = encoder.Encode(types); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue