Created
August 8, 2015 21:25
-
-
Save ggreg/f10fe64a85ee74c0ba9e to your computer and use it in GitHub Desktop.
displays processes that delete a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description = "displays processes that delete a file" | |
short_description = "spy file deletion" | |
category = "files" | |
args = | |
{ | |
{ | |
name = "path", | |
description = "the path of the file to monitor", | |
argtype = "string" | |
}, | |
} | |
function on_set_arg(name, val) | |
path = val | |
return true | |
end | |
function on_init() | |
local filename = path | |
for i in string.gmatch(path, "[^/]+") do | |
filename = i | |
end | |
chisel.set_event_formatter("%proc.pid\t%proc.name") | |
chisel.set_filter( | |
"(evt.type=unlinkat and (evt.arg.name=" .. path .. " or \ | |
evt.arg.name=" .. filename .. ")) or \ | |
(evt.type=unlink and evt.arg.path=" .. path .. ")") | |
return true | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment