19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/glue/tasks/fim.rb', line 19
def run
rootpath = @trigger.path
if File.exists?("/area81/tmp/#{rootpath}/filehash")
Glue.notify "File Hashes found, comparing to file system"
cmd="hashdeep -j99 -r -a -vv -k /area81/tmp/#{rootpath}/filehash #{rootpath}"
r=/(.*): No match/
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
while line = stdout.gets
if line.match r
@result << line
end
end
end
else
Glue.notify "No existing baseline - generating initial hashes"
cmd="mkdir -p /area81/tmp/#{rootpath}; hashdeep -j99 -r #{rootpath} > /area81/tmp/#{rootpath}/filehash"
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
while line = stdout.gets
puts "."
end
end
@result = ''
end
end
|