-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
57 lines (48 loc) · 1.03 KB
/
Copy pathmain.go
File metadata and controls
57 lines (48 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package main
import (
"fmt"
"os"
"gohex/utils"
tea "github.com/charmbracelet/bubbletea"
"github.com/urfave/cli/v2"
)
func main() {
logger := utils.NewLogger()
app := &cli.App{
Name: "GoHex",
Usage: "Hex editor and disassembler",
Commands: []*cli.Command{
{
Name: "hex",
Usage: "View the hexdump of a binary file",
Action: func(c *cli.Context) error {
hexInfoArr, err := HexExtractor(c.Args().Get(0))
if err != nil {
return fmt.Errorf("error extracting hex info: %v", err)
}
m := model{Render(hexInfoArr)}
if _, err = tea.NewProgram(m).Run(); err != nil {
return fmt.Errorf("error running program: %v", err)
}
return nil
},
},
{
Name: "disassemble",
Usage: "Disassemble a binary file",
Action: func(c *cli.Context) error {
err := Disassemble(c.Args().Get(0))
if err != nil {
return err
}
return nil
},
},
},
Action: nil,
Version: "0.1.0",
}
if err := app.Run(os.Args); err != nil {
logger.Fatalln(err)
}
}