Skip to content

Commit 2d08e56

Browse files
authored
Merge pull request #359 from dmur1/better-status-#338
show task data with status
2 parents fb7693f + f9c175f commit 2d08e56

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

commands/status.go

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"encoding/json"
55
"fmt"
66
"os"
7-
"os/exec"
87
"ret/config"
98
"ret/data"
109
"ret/theme"
@@ -18,49 +17,45 @@ func init() {
1817
Func: Status,
1918
Help: StatusHelp,
2019
Arguments: nil,
21-
SeeAlso: []string{"add", "capture"}})
20+
SeeAlso: []string{"add", "init", "name", "category", "event", "capture"}})
2221
}
2322

2423
func StatusHelp() string {
2524
return "displays the status for the current task with ret\n"
2625
}
2726

2827
func Status(args []string) {
28+
name := util.GetCurrentTaskName()
29+
if len(name) > 0 {
30+
fmt.Printf("🏷️ "+theme.ColorCyan+"%s"+theme.ColorReset+"\n", name)
31+
}
32+
33+
category := util.GetCurrentTaskCategory()
34+
if len(category) > 0 {
35+
fmt.Printf("😼 "+theme.ColorYellow+"%s"+theme.ColorReset+"\n", category)
36+
}
37+
38+
event := util.GetCurrentTaskEvent()
39+
if len(event) > 0 {
40+
fmt.Printf("🗓️ "+theme.ColorGreen+"%s"+theme.ColorReset+"\n", event)
41+
}
42+
43+
flag := util.GetCurrentTaskFlag()
44+
if len(flag) > 0 {
45+
fmt.Printf("🏁 "+theme.ColorPurple+"%s"+theme.ColorPurple+"\n", flag)
46+
}
47+
2948
jsonData, err := os.ReadFile(config.RetFilesNames)
3049
if err == nil {
3150
var files data.Files
3251

3352
err = json.Unmarshal(jsonData, &files)
3453
if err == nil {
3554
for idx, file := range files.Files {
36-
3755
fmt.Printf(theme.ColorGray+"["+theme.ColorBlue+"%v"+theme.ColorGray+"]"+theme.ColorReset, idx)
3856
fmt.Printf(theme.ColorGreen+" %s ", file.Filename)
3957
fmt.Printf(theme.ColorReset+"%s\n", file.SHA256)
40-
41-
if file.FileType == data.FILE_TYPE_ELF {
42-
checksec := exec.Command("pwn", "checksec", file.Filepath)
43-
44-
checksec.Stdout = os.Stdout
45-
checksec.Stderr = os.Stderr
46-
checksec.Stdin = os.Stdin
47-
48-
err := checksec.Run()
49-
if err != nil {
50-
fileOutput := util.RunFileCommandOnFile(file.Filepath)
51-
fmt.Printf(theme.ColorGray+" "+theme.ColorReset+"%s\n", fileOutput)
52-
continue
53-
}
54-
} else {
55-
fileOutput := util.RunFileCommandOnFile(file.Filepath)
56-
fmt.Printf(theme.ColorGray+" "+theme.ColorReset+"%s\n", fileOutput)
57-
}
5858
}
5959
}
6060
}
61-
62-
flag := util.GetCurrentTaskFlag()
63-
if len(flag) > 0 {
64-
fmt.Printf("🏁 "+theme.ColorPurple+"%s"+theme.ColorPurple+"\n", flag)
65-
}
6661
}

0 commit comments

Comments
 (0)