|
4 | 4 | "flag"
|
5 | 5 | "fmt"
|
6 | 6 | "os"
|
| 7 | + "strings" |
7 | 8 |
|
8 | 9 | "ret/commands"
|
9 | 10 | "ret/config"
|
@@ -41,38 +42,95 @@ func main() {
|
41 | 42 |
|
42 | 43 | config.ParseUserConfig()
|
43 | 44 |
|
44 |
| - switch flag.Arg(0) { |
45 |
| - case "flag": |
| 45 | + command := flag.Arg(0) |
| 46 | + |
| 47 | + // flag |
| 48 | + if command[0] == 'f' { |
46 | 49 | commands.Flag(flag.Args()[1:])
|
47 |
| - case "add": |
48 |
| - util.EnsureSkeleton() |
49 |
| - commands.Add(flag.Args()[1:]) |
50 |
| - case "status": |
51 |
| - commands.Status(flag.Args()[1:]) |
52 |
| - case "pwn": |
| 50 | + return |
| 51 | + } |
| 52 | + |
| 53 | + // pwn |
| 54 | + if command[0] == 'p' { |
53 | 55 | commands.Pwn(flag.Args()[1:])
|
54 |
| - case "docker": |
| 56 | + return |
| 57 | + } |
| 58 | + |
| 59 | + // docker |
| 60 | + if command[0] == 'd' { |
55 | 61 | commands.Docker(flag.Args()[1:])
|
56 |
| - case "ghidra": |
| 62 | + return |
| 63 | + } |
| 64 | + |
| 65 | + // ghidra |
| 66 | + if command[0] == 'g' { |
57 | 67 | util.EnsureSkeleton()
|
58 | 68 | commands.Ghidra(flag.Args()[1:])
|
59 |
| - case "ida": |
| 69 | + return |
| 70 | + } |
| 71 | + |
| 72 | + // ida |
| 73 | + if command[0] == 'i' { |
60 | 74 | util.EnsureSkeleton()
|
61 | 75 | commands.Ida(flag.Args()[1:])
|
62 |
| - case "check": |
63 |
| - commands.Check(flag.Args()[1:]) |
64 |
| - case "syscall": |
65 |
| - commands.Syscall(flag.Args()[1:]) |
66 |
| - case "abi": |
67 |
| - commands.Abi(flag.Args()[1:]) |
68 |
| - case "writeup": |
69 |
| - commands.Writeup(flag.Args()[1:]) |
70 |
| - case "cheatsheet": |
71 |
| - commands.Cheatsheet(flag.Args()[1:]) |
72 |
| - case "wizard": |
73 |
| - commands.Wizard(flag.Args()[1:]) |
74 |
| - default: |
75 |
| - flag.Usage() |
76 |
| - os.Exit(1) |
| 76 | + return |
77 | 77 | }
|
| 78 | + |
| 79 | + // add, abi |
| 80 | + if command[0] == 'a' && len(command) > 1 { |
| 81 | + if command[1] == 'd' { |
| 82 | + util.EnsureSkeleton() |
| 83 | + commands.Add(flag.Args()[1:]) |
| 84 | + return |
| 85 | + } |
| 86 | + |
| 87 | + if command[1] == 'b' { |
| 88 | + commands.Abi(flag.Args()[1:]) |
| 89 | + return |
| 90 | + } |
| 91 | + } |
| 92 | + |
| 93 | + // status, syscall |
| 94 | + if command[0] == 's' && len(command) > 1 { |
| 95 | + if command[1] == 't' { |
| 96 | + commands.Status(flag.Args()[1:]) |
| 97 | + return |
| 98 | + } |
| 99 | + |
| 100 | + if command[1] == 'y' { |
| 101 | + commands.Syscall(flag.Args()[1:]) |
| 102 | + return |
| 103 | + } |
| 104 | + } |
| 105 | + |
| 106 | + // check, cheatsheet |
| 107 | + if command[0] == 'c' && len(command) > 3 { |
| 108 | + if strings.Compare("chec", command[:4]) == 0 { |
| 109 | + commands.Check(flag.Args()[1:]) |
| 110 | + return |
| 111 | + } |
| 112 | + |
| 113 | + if strings.Compare("chea", command[:4]) == 0 { |
| 114 | + commands.Cheatsheet(flag.Args()[1:]) |
| 115 | + return |
| 116 | + } |
| 117 | + } |
| 118 | + |
| 119 | + // writeup, wizard |
| 120 | + if command[0] == 'w' && len(command) > 1 { |
| 121 | + fmt.Println(command) |
| 122 | + if command[1] == 'r' { |
| 123 | + commands.Writeup(flag.Args()[1:]) |
| 124 | + return |
| 125 | + } |
| 126 | + |
| 127 | + if command[1] == 'i' { |
| 128 | + commands.Wizard(flag.Args()[1:]) |
| 129 | + return |
| 130 | + } |
| 131 | + } |
| 132 | + |
| 133 | + // help |
| 134 | + flag.Usage() |
| 135 | + os.Exit(1) |
78 | 136 | }
|
0 commit comments