diff options
Diffstat (limited to 'openssh-model.lua')
-rw-r--r-- | openssh-model.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/openssh-model.lua b/openssh-model.lua index 4aac198..71bebdd 100644 --- a/openssh-model.lua +++ b/openssh-model.lua @@ -125,11 +125,11 @@ function list_conn_peers() local ps = {} local who = {} config = read_config() - local f = io.popen( path .. 'netstat -lna | grep ":' .. tostring(config.value.Port.value) .. ' " | grep "ESTABLISHED"' ) + local f = io.popen( path .. 'netstat -lna | grep "ESTABLISHED"' ) for line in f:lines() do - local peer = string.match(line, "^%S+%s+%S+%s+%S+%s+%S+%s+(%S+)") - peer = string.match(peer, "(%d+%.%d+%.%d+%.%d+):%d*$") - if peer then + local loc, peer = string.match(line, "^%S+%s+%S+%s+%S+%s+(%S+)%s+(%S+)") + peer = string.match(peer, "%d+%.%d+%.%d+%.%d+") + if string.find(loc, ":"..config.value.Port.value.."$") and peer then if not netstat[peer] then local g = io.popen( path .. "dnsname " .. peer) local name = g:read("*l") |