abusehelper: Added fact for running botnets

This commit is contained in:
Ossi Salmi 2013-07-19 15:18:59 +03:00
parent a48040c544
commit d52811b390

View file

@ -0,0 +1,15 @@
Facter.add(:botnets) do
setcode do
botnets = []
if File.executable?("/usr/bin/botnet")
listcmd = "su -s /bin/sh - nobody -c '/usr/bin/botnet list'"
output = Facter::Util::Resolution.exec(listcmd)
output.lines.each do |line|
if m = line.match(/^\[\d+\]\s+(.*\.py)/)
botnets << File.basename(File.dirname(m[1]))
end
end
end
botnets.sort.join(',')
end
end