Commit 29e2bcb
Changed files (2)
cmd
cmd/task_view.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"mysh/pkg/mythic"
+ "mysh/pkg/mythic/api"
"strconv"
"strings"
"time"
@@ -13,6 +14,7 @@ import (
var (
taskViewRawOutput bool
+ taskViewDetails bool
)
var taskViewCmd = &cobra.Command{
@@ -26,7 +28,8 @@ var taskViewCmd = &cobra.Command{
func init() {
rootCmd.AddCommand(taskViewCmd)
- taskViewCmd.Flags().BoolVar(&taskViewRawOutput, "raw", false, "Output only raw response bytes")
+ taskViewCmd.Flags().BoolVarP(&taskViewRawOutput, "raw", "r", false, "Output only raw response bytes")
+ taskViewCmd.Flags().BoolVarP(&taskViewDetails, "details", "d", false, "Show only task details (no response)")
}
func runTaskView(cmd *cobra.Command, args []string) error {
@@ -56,24 +59,57 @@ func runTaskView(cmd *cobra.Command, args []string) error {
return nil
}
- // Otherwise, show full task details
+ // Get callback information for enhanced details
+ var callback *mythic.Callback
+ if task.CallbackID > 0 {
+ callback, _ = api.FindActiveCallback(ctx, client, task.CallbackID)
+ }
+
+ // Show enhanced task details header
fmt.Printf("Task Details (ID: %d)\n", task.DisplayID)
- fmt.Println(strings.Repeat("=", 50))
- fmt.Printf("Command: %s\n", task.Command)
- fmt.Printf("Parameters: %s\n", task.Params)
- fmt.Printf("Status: %s\n", task.Status)
- fmt.Printf("Callback ID: %d\n", task.CallbackID)
+ fmt.Println(strings.Repeat("=", 60))
+
+ // Basic task info
+ fmt.Printf("Command: %s\n", task.Command)
+ fmt.Printf("Parameters: %s\n", task.Params)
+ fmt.Printf("Status: %s\n", task.Status)
+ fmt.Printf("Completed: %t\n", task.Completed)
+
+ // Callback information
+ if callback != nil {
+ fmt.Printf("Callback: %d (%s@%s)\n", task.CallbackID, callback.User, callback.Host)
+ fmt.Printf("Process: %s (PID: %d)\n", callback.ProcessName, callback.PID)
+ if callback.Description != "" {
+ fmt.Printf("Description: %s\n", callback.Description)
+ }
+ agentType := callback.Payload.PayloadType.Name
+ if agentType != "" {
+ fmt.Printf("Agent Type: %s\n", agentType)
+ }
+ } else {
+ fmt.Printf("Callback: %d\n", task.CallbackID)
+ }
+
+ // Timing information
if task.Timestamp != "" {
if t, err := time.Parse(time.RFC3339, task.Timestamp); err == nil {
- fmt.Printf("Timestamp: %s\n", t.Format("2006-01-02 15:04:05"))
+ fmt.Printf("Created: %s\n", t.Format("2006-01-02 15:04:05 MST"))
} else {
- fmt.Printf("Timestamp: %s\n", task.Timestamp)
+ fmt.Printf("Created: %s\n", task.Timestamp)
}
}
- fmt.Printf("Completed: %t\n", task.Completed)
+ // Additional technical details
+ fmt.Printf("Internal ID: %d\n", task.ID)
+
+ // If --details flag is set, only show the header
+ if taskViewDetails {
+ return nil
+ }
+
+ // Show response section
fmt.Println("\nResponse:")
- fmt.Println(strings.Repeat("-", 30))
+ fmt.Println(strings.Repeat("-", 40))
if task.Response != "" {
fmt.Println(task.Response)
} else {
TODO.md
@@ -5,11 +5,11 @@
- ✅ task with --no-wait, doesn't wait for output
- ✅ task [callback] arg make it accept lists, comma seperated, or ranges e.g. 1,2,3-5,10
- ✅ make cb and callback aliases for callbacks
-- update callbacks to show last-checkin as 0s or 0m00s ago
+- ✅ update callbacks to show last-checkin as 0s or 0m00s ago
- make tv --raw have short -r
-- make callbacks sortable with (--rev reverse) --id, --type, --host, --user, --process, --last, --description all exclusive - default should be --id
+- make callbacks sortable with (--rev reverse) --id, --type, --host, --user, --process, --last, --description all exclusive - default should be --id with newest (highest) last
+- create a .cache/mysh/ to store task result cached values for completed tasks - use whatever the right XDG env default dir should be
- invert cobra-cli nto functions (no global vars)
- update output table formats to respect terminal width
-- create a .cache/mysh/ to store task result cached values for completed tasks - use whatever the right XDG env default dir should be
- MYTHIC_API_INSECURE= boolean --insecure flag - and invert default = false
- forge payloads - equivalency with execute_assembly and inline_assembly