MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / cmdSessions

Function cmdSessions

cmd/inject-cli/main.go:383–407  ·  view source on GitHub ↗

----- session commands -----

(c *apiClient)

Source from the content-addressed store, hash-verified

381// ----- session commands -----
382
383func cmdSessions(c *apiClient) {
384 sessions, err := c.getSessions()
385 if err != nil {
386 fmt.Printf(" error: %v\n", err)
387 return
388 }
389 if len(sessions) == 0 {
390 fmt.Println(" No active sessions. Wait for an agent to send requests through the proxy.")
391 return
392 }
393
394 fmt.Println()
395 fmt.Printf(" \033[90m%-4s\033[0m %-12s %-22s %-18s %6s %s\n", "#", "ID", "Agent", "Format", "Tools", "Active")
396 printSep(76)
397 for i, s := range sessions {
398 name, ver := formatAgent(s.UserAgent)
399 agent := name
400 if ver != "" {
401 agent = fmt.Sprintf("%s \033[90m%s\033[0m", name, ver)
402 }
403 fmt.Printf(" \033[90m%-4d\033[0m \033[36m%-12s\033[0m %-22s %-18s %6d \033[90m%s\033[0m\n",
404 i+1, s.ID, agent, s.Format, s.ToolCount, timeAgo(s.LastActivity))
405 }
406 fmt.Println()
407}
408
409func printSessionInfo(sess *SessionDetail) {
410 name, ver := formatAgent(sess.UserAgent)

Callers 1

mainFunction · 0.85

Calls 4

printSepFunction · 0.85
formatAgentFunction · 0.85
timeAgoFunction · 0.85
getSessionsMethod · 0.80

Tested by

no test coverage detected