mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00
Fixed connection->pid lookup.
This commit is contained in:
parent
2cc747b318
commit
5ee4830082
1 changed files with 3 additions and 1 deletions
|
@ -21,7 +21,9 @@ import logging
|
|||
import psutil
|
||||
|
||||
def get_pid_by_connection( procmon, src_addr, src_p, dst_addr, dst_p, proto = 'tcp' ):
|
||||
connections_list = [connection for connection in psutil.net_connections(kind=proto) if connection.laddr==(src_addr, src_p) and connection.raddr==(dst_addr, dst_p)]
|
||||
connections_list = [ connection for connection in psutil.net_connections(kind=proto) \
|
||||
if connection.laddr==( src_addr, int(src_p) ) and \
|
||||
connection.raddr==( dst_addr, int(dst_p) ) ]
|
||||
|
||||
# We always take the first element as we assume it contains only one, because
|
||||
# it should not be possible to keep two connections which are exactly the same.
|
||||
|
|
Loading…
Add table
Reference in a new issue