MCPcopy Create free account
hub / github.com/evilsocket/shellz / showShellsList

Function showShellsList

cmd/shellz/list.go:75–163  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

73}
74
75func showShellsList() {
76 if err, onShells = doShellSelection(onFilter, true); err != nil {
77 log.Fatal("%s", err)
78 } else if nShells = len(onShells); nShells == 0 {
79 log.Fatal("no shell selected by the filter %s", tui.Dim(onFilter))
80 }
81
82 rows := [][]string{}
83 cols := []string{
84 "Name",
85 "Groups",
86 "Type",
87 "Host",
88 "Port",
89 "Identity",
90 "Enabled",
91 }
92
93 hasTunnel := false
94 for _, sh := range onShells {
95 if !sh.Tunnel.Empty() {
96 hasTunnel = true
97 break
98 }
99 }
100
101 if hasTunnel {
102 cols = []string{
103 "Name",
104 "Groups",
105 "Type",
106 "Host",
107 "Tunnel",
108 "Port",
109 "Identity",
110 "Enabled",
111 }
112 }
113
114 keys := []string{}
115 for k := range onShells {
116 keys = append(keys, k)
117 }
118 sort.Strings(keys)
119
120 for _, name := range keys {
121 var row []string
122
123 sh := onShells[name]
124 en := tui.Green("✔")
125 if !sh.Enabled {
126 en = tui.Red("✖")
127 }
128
129 if hasTunnel {
130 row = []string{
131 tui.Bold(sh.Name),
132 tui.Blue(strings.Join(sh.Groups, ", ")),

Callers 1

showListFunction · 0.85

Calls 3

doShellSelectionFunction · 0.85
EmptyMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected