diff options
-rw-r--r-- | ipsectools-model.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ipsectools-model.lua b/ipsectools-model.lua index de05ba1..6f5b359 100644 --- a/ipsectools-model.lua +++ b/ipsectools-model.lua @@ -37,12 +37,12 @@ local function phase2details(dst) local output = {} dst = string.match(dst,"^(.*)%.") -- Removes the portnumber local value = modelfunctions.run_executable({"ip", "xfrm", "state", "list", "src", dst}) - -- REMOVE THE LINES THAT DON'T START WITH "src" io.popen - table.insert(output, {label="Outgoing", value=value}) + -- Get rid of all lines that don't start with "src" + table.insert(output, {label="Outgoing", value=string.gsub(value, "\n[^s][^\n]*", "")}) value = modelfunctions.run_executable({"ip", "xfrm", "state", "list", "dst", dst}) - -- REMOVE THE LINES THAT DON'T START WITH "src" io.popen - table.insert(output, {label="Incoming", value=value}) + -- Get rid of all lines that don't start with "src" + table.insert(output, {label="Incoming", value=string.gsub(value, "\n[^s][^\n]*", "")}) return output end |