diff options
author | Ted Trask <ttrask01@yahoo.com> | 2013-01-08 16:18:48 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2013-01-08 16:18:48 +0000 |
commit | 443aaefd42cef0e8c45ec872b76121e5cfc16c85 (patch) | |
tree | c23493997de4b8f58ddea3c83afefe9d3d4920dc | |
parent | 0d2e99cc6c62be1dae0d2f9037570cdd911937d7 (diff) | |
download | acf-ipsec-tools-443aaefd42cef0e8c45ec872b76121e5cfc16c85.tar.bz2 acf-ipsec-tools-443aaefd42cef0e8c45ec872b76121e5cfc16c85.tar.xz |
Removed unwanted lines from 'ip xfrm state' output
-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 |