From feac018149d58020cc91792c37b96682d14980d3 Mon Sep 17 00:00:00 2001 From: Simon Buhrow <40995132+el-coder-sb@users.noreply.github.com> Date: Tue, 30 Nov 2021 16:04:08 +0100 Subject: [PATCH] Add lua function list capacity Fix #4563, close #10867 --- PowerEditor/Test/FunctionList/lua/unitTest | 27 +++++ .../FunctionList/lua/unitTest.expected.result | 1 + PowerEditor/installer/functionList/lua.xml | 107 ++++++++++++++++++ 3 files changed, 135 insertions(+) create mode 100644 PowerEditor/Test/FunctionList/lua/unitTest create mode 100644 PowerEditor/Test/FunctionList/lua/unitTest.expected.result create mode 100644 PowerEditor/installer/functionList/lua.xml diff --git a/PowerEditor/Test/FunctionList/lua/unitTest b/PowerEditor/Test/FunctionList/lua/unitTest new file mode 100644 index 000000000..2c69f3e97 --- /dev/null +++ b/PowerEditor/Test/FunctionList/lua/unitTest @@ -0,0 +1,27 @@ +-- Create a file named by_ip/''ip_addess''.cap with all ip traffic of each ip host. (tshark only?) +-- Dump files are created for both source and destination hosts +function createDir (dirname) + -- this will print out an error if the directory already exists, but that's fine + os.execute("mkdir " .. dirname) +end + +local dir = "by_ip" +createDir(dir) + +-- create a table to hold the dumper objects/file handles +local dumpers = {} + +local tap = Listener.new("ip") + +-- we will be called once for every IP Header. +-- If there's more than one IP header in a given packet we'll dump the packet once per every header +function tap.packet(pinfo,tvb,ip) + local ip_src, ip_dst = tostring(ip.ip_src), tostring(ip.ip_dst) + local src_dmp, dst_dmp +end + +function tap.draw() + for ip_addr,dumper in pairs(dumpers) do + dumper:flush() + end +end diff --git a/PowerEditor/Test/FunctionList/lua/unitTest.expected.result b/PowerEditor/Test/FunctionList/lua/unitTest.expected.result new file mode 100644 index 000000000..02869bcfa --- /dev/null +++ b/PowerEditor/Test/FunctionList/lua/unitTest.expected.result @@ -0,0 +1 @@ +{"leaves":["createDir"],"nodes":[{"leaves":["packet","draw"],"name":"tap"}],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/installer/functionList/lua.xml b/PowerEditor/installer/functionList/lua.xml new file mode 100644 index 000000000..a501ed73c --- /dev/null +++ b/PowerEditor/installer/functionList/lua.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file