lua output doc: Use more descriptive variable names in the examples

This also removes the "args" parameter of the hooking functions in the examples,
since this parameter is unused in all functions.
It would not be very helpful anyways since 3 of the 4 functions don't get passed
any parameters. The only exception is init() which gets a table containing:
  script_api_ver = 1
pull/3325/head
Richard Sailer 7 years ago committed by Victor Julien
parent 3307f7a94e
commit dc07c1fe13

@ -57,12 +57,12 @@ Example:
end end
http_ua = string.gsub(http_ua, "%g", ".") http_ua = string.gsub(http_ua, "%g", ".")
ts = SCPacketTimeString() timestring = SCPacketTimeString()
ipver, srcip, dstip, proto, sp, dp = SCFlowTuple() ip_version, src_ip, dst_ip, protocol, src_port, dst_port = SCFlowTuple()
file:write (ts .. " " .. http_host .. " [**] " .. http_uri .. " [**] " .. file:write (timestring .. " " .. http_host .. " [**] " .. http_uri .. " [**] " ..
http_ua .. " [**] " .. srcip .. ":" .. sp .. " -> " .. http_ua .. " [**] " .. src_ip .. ":" .. src_port .. " -> " ..
dstip .. ":" .. dp .. "\n") dst_ip .. ":" .. dst_port .. "\n")
file:flush() file:flush()
http = http + 1 http = http + 1
@ -127,21 +127,22 @@ Add SCPacketTimeString to get the packets time string in the format:
:: ::
function log(args) function log(args)
ts = SCPacketTimeString() timestring = SCPacketTimeString()
end
SCPacketTuple SCPacketTuple
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
:: ::
ipver, srcip, dstip, proto, sp, dp = SCPacketTuple() ip_version, src_ip, dst_ip, protocol, src_port, dst_port = SCPacketTuple()
SCPacketPayload SCPacketPayload
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
:: ::
p = SCPacketPayload() payload = SCPacketPayload()
flow flow
---- ----
@ -177,7 +178,7 @@ SCFlowTuple
:: ::
ipver, srcip, dstip, proto, sp, dp = SCFlowTuple() ip_version, src_ip, dst_ip, protocol, src_port, dst_port = SCFlowTuple()
SCFlowAppLayerProto SCFlowAppLayerProto
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
@ -399,8 +400,8 @@ DnsGetQueries
rrtype = t["type"] rrtype = t["type"]
print ("QUERY: " .. ts .. " " .. rrname .. " [**] " .. rrtype .. " [**] " .. print ("QUERY: " .. ts .. " " .. rrname .. " [**] " .. rrtype .. " [**] " ..
"TODO" .. " [**] " .. srcip .. ":" .. sp .. " -> " .. "TODO" .. " [**] " .. src_ip .. ":" .. src_port .. " -> " ..
dstip .. ":" .. dp) dst_ip .. ":" .. dst_port)
end end
end end
@ -419,8 +420,8 @@ DnsGetAnswers
ttl = t["ttl"] ttl = t["ttl"]
print ("ANSWER: " .. ts .. " " .. rrname .. " [**] " .. rrtype .. " [**] " .. print ("ANSWER: " .. ts .. " " .. rrname .. " [**] " .. rrtype .. " [**] " ..
ttl .. " [**] " .. srcip .. ":" .. sp .. " -> " .. ttl .. " [**] " .. src_ip .. ":" .. src_port .. " -> " ..
dstip .. ":" .. dp) dst_ip .. ":" .. dst_port)
end end
end end
@ -439,8 +440,8 @@ DnsGetAuthorities
ttl = t["ttl"] ttl = t["ttl"]
print ("AUTHORITY: " .. ts .. " " .. rrname .. " [**] " .. rrtype .. " [**] " .. print ("AUTHORITY: " .. ts .. " " .. rrname .. " [**] " .. rrtype .. " [**] " ..
ttl .. " [**] " .. srcip .. ":" .. sp .. " -> " .. ttl .. " [**] " .. src_ip .. ":" .. src_port .. " -> " ..
dstip .. ":" .. dp) dst_ip .. ":" .. dst_port)
end end
end end

Loading…
Cancel
Save