From 443aaefd42cef0e8c45ec872b76121e5cfc16c85 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 8 Jan 2013 16:18:48 +0000 Subject: Removed unwanted lines from 'ip xfrm state' output --- ipsectools-model.lua | 8 ++++---- 1 file 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 -- cgit v1.2.3