diff options
-rw-r--r-- | openssh-model.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/openssh-model.lua b/openssh-model.lua index de1c4b5..1cc5598 100644 --- a/openssh-model.lua +++ b/openssh-model.lua @@ -169,7 +169,8 @@ function list_conn_peers() config = read_config() local f = io.popen( path .. 'netstat -lna | grep ' .. tostring(config.Port) .. ' | grep "ESTABLISHED"' ) for line in f:lines() do - local peer = string.match(line, "^.-:.-:.-:.-:.-:.-:.-:(.-):.-$") + local peer = string.match(line, "^%S*%s*%S*%s*%S*%s*%S*%s*(%S*)") + peer = string.match(peer, "^.*:(%S-):%d*$") if (peer) then if not (netstat[peer]) then netstat[peer] = {cnt=0} end netstat[peer]['cnt'] = (tonumber(netstat[peer]['cnt']) + 1) |