abusehelper: Added fact for running botnets
This commit is contained in:
parent
a48040c544
commit
d52811b390
1 changed files with 15 additions and 0 deletions
15
abusehelper/lib/facter/botnets.rb
Normal file
15
abusehelper/lib/facter/botnets.rb
Normal 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
|
Loading…
Add table
Reference in a new issue