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