Class: Threatinator::Plugins::Output::Csv
- Inherits:
-
FileBasedOutput
- Object
- Output
- FileBasedOutput
- Threatinator::Plugins::Output::Csv
- Defined in:
- lib/threatinator/plugins/output/csv.rb
Defined Under Namespace
Classes: Config
Instance Method Summary collapse
- #handle_event(event) ⇒ Object
-
#initialize(config) ⇒ Csv
constructor
A new instance of Csv.
Methods inherited from FileBasedOutput
Methods inherited from Output
Constructor Details
#initialize(config) ⇒ Csv
Returns a new instance of Csv.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/threatinator/plugins/output/csv.rb', line 10 def initialize(config) super(config) @csv = ::CSV.new(self.output_io, :write_headers => true, :headers => [ :provider, :feed_name, :type, :ipv4_1, :ipv4_2, :ipv4_3, :ipv4_4, :fqdn_1, :fqdn_2, :fqdn_3, :fqdn_4 ]) end |
Instance Method Details
#handle_event(event) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/threatinator/plugins/output/csv.rb', line 29 def handle_event(event) @csv.add_row([ event.feed_provider, event.feed_name, event.type, event.ipv4s[0], event.ipv4s[1], event.ipv4s[2], event.ipv4s[3], event.fqdns[0], event.fqdns[1], event.fqdns[2], event.fqdns[3] ]) end |