【发布时间】:2021-09-02 17:08:10
【问题描述】:
我是 lua 编程新手。我正在寻找一个 lua 脚本,它可以读取通过 Suricata 从 Internet 下载的文件并检测文件是否已更改。任何帮助,将不胜感激。提前致谢。
类似这样的:
function init(args)
return {http.response_body = tostring(true)}
end
local function read_file(path)
local file = open(path, "rb") -- r read mode and b binary mode
if not file then return nil end
local content = file:read "*a" -- *a or *all reads the whole file
file:close()
return content
end
local fileContent = read_file(path-to-where-previous-file-is-stored);
local fileContent2 = read_file(init());
if fileContent != fileContent2:
print("File changed")
如果内容相同则阻塞
drop http any any -> any any (msg:"NVISO PDF file lua"; flow:established,to_client; luajit:pdfcheckname.lua; classtype:policy-violation; sid:1000000; rev:1;)
【问题讨论】:
-
您创建此帖子时单击的按钮标有“”。我在这里没有看到任何问题。
-
你能指定你是否使用linux发行版吗?