diff --git a/src/modules/ws/model/net_connect.go b/src/modules/ws/model/net_connect.go index 945ede5d..6b67edb6 100644 --- a/src/modules/ws/model/net_connect.go +++ b/src/modules/ws/model/net_connect.go @@ -8,13 +8,13 @@ type NetConnectData struct { Status string `json:"status"` Laddr net.Addr `json:"localaddr"` Raddr net.Addr `json:"remoteaddr"` - PID int32 `json:"PID"` + PID int32 `json:"pid"` Name string `json:"name"` } // NetConnectQuery 网络连接进程查询 type NetConnectQuery struct { - Port int32 `json:"port"` - ProcessName string `json:"processName"` - ProcessID int32 `json:"processID"` + Port int32 `json:"port"` + Name string `json:"name"` + PID int32 `json:"pid"` } diff --git a/src/modules/ws/processor/net_connect.go b/src/modules/ws/processor/net_connect.go index 187de88b..5e242435 100644 --- a/src/modules/ws/processor/net_connect.go +++ b/src/modules/ws/processor/net_connect.go @@ -29,13 +29,16 @@ func GetNetConnections(requestID string, data any) ([]byte, error) { continue } for _, conn := range connections { - if query.ProcessID > 0 && query.ProcessID != conn.Pid { + if query.PID > 0 && query.PID != conn.Pid { continue } proc, err := process.NewProcess(conn.Pid) if err == nil { - name, _ := proc.Name() - if name != "" && query.ProcessName != "" && !strings.Contains(name, query.ProcessName) { + name, err := proc.Name() + if err != nil { + continue + } + if query.Name != "" && !strings.Contains(name, query.Name) { continue } if query.Port > 0 && query.Port != int32(conn.Laddr.Port) && query.Port != int32(conn.Raddr.Port) {