func listRunningProcesses(m *base.Monitor) error {
	list, err := process.Processes()
	if err != nil {
		return err
	}
	for _, p := range list {
		binaryPath, _ := p.Exe()
		ppidRaw, _ := p.Ppid()
		ppid := uint32(ppidRaw)
		pid := uint32(p.Pid)
		execTime, _ := p.CreateTime()
		tty, _ := p.Terminal()
		tty = strings.Replace(tty, "/", "", -1)
		if ppid > 0 {
			forkEvent := &model.ForkEvent{
				EventBase: model.EventBase{
					EventType:        model.ForkEventType,
					EventMonitorName: m.Name,
					Timestamp:        time.Unix(0, execTime*int64(time.Millisecond)),
				},
				ForkRaw: &model.ForkRaw{
					Metadata: model.Metadata{
						Pidns: utils.GetPidnsFromPid(ppid),
						Netns: utils.GetNetnsFromPid(ppid),
						PID:   ppid,
						TID:   ppid,
					},
					ChildPid:   pid,
					CloneFlags: uint64(kernel.SIGCHLD),
				},
			}
			m.Nsp.DispatchEvent(forkEvent)
		}
		execveEvent := &model.ExecEvent{
			EventBase: model.EventBase{
				EventType:        model.ExecEventType,
				EventMonitorName: m.Name,
				Timestamp:        time.Unix(0, execTime*int64(time.Millisecond)),
				TTYName:          tty,
			},
			ExecRaw: &model.ExecRaw{
				Metadata: model.Metadata{
					Pidns: utils.GetPidnsFromPid(pid),
					Netns: utils.GetNetnsFromPid(pid),
					PID:   pid,
					TID:   pid,
				},
				Type: model.Execve,
			},
			Path: binaryPath,
		}
		m.Nsp.DispatchEvent(execveEvent)
	}
	return nil
}
// listRunningProcesses - List all running processes
List all running processes
// listRunningProcesses - List all running processes
func listRunningProcesses(m *base.Monitor) error {
	list, err := process.Processes()
	if err != nil {
		return err
	}
	for _, p := range list {
		binaryPath, _ := p.Exe()
		ppidRaw, _ := p.Ppid()
		ppid := uint32(ppidRaw)
		pid := uint32(p.Pid)
		execTime, _ := p.CreateTime()
		tty, _ := p.Terminal()
		tty = strings.Replace(tty, "/", "", -1)
		if ppid > 0 {
			forkEvent := &model.ForkEvent{
				EventBase: model.EventBase{
					EventType:        model.ForkEventType,
					EventMonitorName: m.Name,
					Timestamp:        time.Unix(0, execTime*int64(time.Millisecond)),
				},
				ForkRaw: &model.ForkRaw{
					Metadata: model.Metadata{
						Pidns: utils.GetPidnsFromPid(ppid),
						Netns: utils.GetNetnsFromPid(ppid),
						PID:   ppid,
						TID:   ppid,
					},
					ChildPid:   pid,
					CloneFlags: uint64(kernel.SIGCHLD),
				},
			}
			m.Nsp.DispatchEvent(forkEvent)
		}
		execveEvent := &model.ExecEvent{
			EventBase: model.EventBase{
				EventType:        model.ExecEventType,
				EventMonitorName: m.Name,
				Timestamp:        time.Unix(0, execTime*int64(time.Millisecond)),
				TTYName:          tty,
			},
			ExecRaw: &model.ExecRaw{
				Metadata: model.Metadata{
					Pidns: utils.GetPidnsFromPid(pid),
					Netns: utils.GetNetnsFromPid(pid),
					PID:   pid,
					TID:   pid,
				},
				Type: model.Execve,
			},
			Path: binaryPath,
		}
		m.Nsp.DispatchEvent(execveEvent)
	}
	return nil
}
func listRunningProcesses ( m * base . Monitor ) error { list , err := process . Processes ( ) if err != nil { return err } for _ , p := range list { binaryPath , _ := p . Exe ( ) ppidRaw , _ := p . Ppid ( ) ppid := uint32 ( ppidRaw ) pid := uint32 ( p . Pid ) execTime , _ := p . CreateTime ( ) tty , _ := p . Terminal ( ) tty = strings . Replace ( tty , " " , " " , - 1 ) if ppid > 0 { forkEvent := & model . ForkEvent { EventBase : model . EventBase { EventType : model . ForkEventType , EventMonitorName : m . Name , Timestamp : time . Unix ( 0 , execTime * int64 ( time . Millisecond ) ) , } , ForkRaw : & model . ForkRaw { Metadata : model . Metadata { Pidns : utils . GetPidnsFromPid ( ppid ) , Netns : utils . GetNetnsFromPid ( ppid ) , PID : ppid , TID : ppid , } , ChildPid : pid , CloneFlags : uint64 ( kernel . SIGCHLD ) , } , } m . Nsp . DispatchEvent ( forkEvent ) } execveEvent := & model . ExecEvent { EventBase : model . EventBase { EventType : model . ExecEventType , EventMonitorName : m . Name , Timestamp : time . Unix ( 0 , execTime * int64 ( time . Millisecond ) ) , TTYName : tty , } , ExecRaw : & model . ExecRaw { Metadata : model . Metadata { Pidns : utils . GetPidnsFromPid ( pid ) , Netns : utils . GetNetnsFromPid ( pid ) , PID : pid , TID : pid , } , Type : model . Execve , } , Path : binaryPath , } m . Nsp . DispatchEvent ( execveEvent ) } return nil }
List all running processes
List all running processes