Skip to content

Instantly share code, notes, and snippets.

@ggreg
Created August 8, 2015 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ggreg/f10fe64a85ee74c0ba9e to your computer and use it in GitHub Desktop.
Save ggreg/f10fe64a85ee74c0ba9e to your computer and use it in GitHub Desktop.
displays processes that delete a file
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