(sess *sessions.Session, info agentInfo)
| 36 | } |
| 37 | |
| 38 | func (b *Bridge) registerSessionRPC(sess *sessions.Session, info agentInfo) error { |
| 39 | // Use detected agent type as name if available (more accurate than UA parsing). |
| 40 | agentName := info.name |
| 41 | if sess.Agent != "" { |
| 42 | agentName = string(sess.Agent) |
| 43 | } |
| 44 | |
| 45 | registerData := &implantpb.Register{ |
| 46 | Name: agentName, |
| 47 | Module: b.registry.Names(), |
| 48 | Timer: &implantpb.Timer{ |
| 49 | Expression: "0 */5 * * * *", |
| 50 | }, |
| 51 | Sysinfo: &implantpb.SysInfo{ |
| 52 | Os: &implantpb.Os{ |
| 53 | Name: info.osName, |
| 54 | Version: info.osVersion, |
| 55 | Arch: info.arch, |
| 56 | Release: agentName + "/" + info.version, |
| 57 | Hostname: hostName(), |
| 58 | Username: agentName + "/" + info.version, |
| 59 | }, |
| 60 | Process: &implantpb.Process{ |
| 61 | Name: agentName, |
| 62 | Path: sess.Format, |
| 63 | }, |
| 64 | }, |
| 65 | } |
| 66 | |
| 67 | _, err := b.rpc.Register(b.listenerContext(), &clientpb.RegisterSession{ |
| 68 | SessionId: sess.ID, |
| 69 | PipelineId: b.pipelineID, |
| 70 | ListenerId: b.listenerID, |
| 71 | RegisterData: registerData, |
| 72 | Target: "llm-agent://" + agentName, |
| 73 | }) |
| 74 | if err != nil { |
| 75 | return err |
| 76 | } |
| 77 | log.Infof("[bridge] registered session %s (%s, agent=%s, os=%s %s %s)", sess.ID, agentName, sess.Agent, info.osName, info.osVersion, info.arch) |
| 78 | return nil |
| 79 | } |
| 80 | |
| 81 | func (b *Bridge) reregisterSessions() { |
| 82 | for _, summary := range sessions.Global().List() { |
no test coverage detected