get process name if monitor is enabled

This commit is contained in:
Jason
2019-09-01 15:25:37 +08:00
parent a8fce929c3
commit ecaf1d632a
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -94,9 +94,10 @@ func (h *tcpHandler) Handle(conn net.Conn, target *net.TCPAddr) error {
return err
}
// Get name of the process
var process = lsof.GetProcessName(localConn.LocalAddr())
var process = "N/A"
if monitor != nil {
// Get name of the process
process = lsof.GetProcessName(localConn.LocalAddr())
session := &S.Session{
Process: process,
Network: localConn.LocalAddr().Network(),
+3 -2
View File
@@ -78,9 +78,10 @@ func (h *udpHandler) Connect(conn core.UDPConn, target *net.UDPAddr) error {
return err
}
// Get name of the process
var process = lsof.GetProcessName(conn.LocalAddr())
var process = "N/A"
if monitor != nil {
// Get name of the process
process = lsof.GetProcessName(conn.LocalAddr())
session := &S.Session{
Process: process,
Network: conn.LocalAddr().Network(),