15 lines
492 B
Ruby
15 lines
492 B
Ruby
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.each_line do |line|
|
|
if m = line.match(/^\[\d+\]\s+(.*\.py)/)
|
|
botnets << File.basename(File.dirname(m[1]))
|
|
end
|
|
end
|
|
end
|
|
botnets.sort.join(',')
|
|
end
|
|
end
|