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

Function findSessionFor

cmd/shellz/run.go:123–136  ·  view source on GitHub ↗
(sh models.Shell)

Source from the content-addressed store, hash-verified

121}
122
123func findSessionFor(sh models.Shell) (err error, sess session.Session) {
124 // first try one of the default handlers
125 if err, sess = session.For(sh, timeouts); sess == nil && err == nil {
126 // try one of the user plugins
127 if plugin := plugins.Get(sh); plugin != nil {
128 err, sess = plugin.NewSession(sh, timeouts)
129 }
130 }
131 // no error but no session found?
132 if err == nil && sess == nil {
133 err = fmt.Errorf("session type %s for shell %s is not supported", sh.Type, sh.Name)
134 }
135 return
136}
137
138func cmdWorker(job async.Job) {
139 shell := job.(models.Shell)

Callers 1

cmdWorkerFunction · 0.85

Calls 3

ForFunction · 0.92
GetFunction · 0.92
NewSessionMethod · 0.80

Tested by

no test coverage detected