logstash-codec-nmap 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb9b854678cab49c0f5832940e7881a0b7211cae
4
- data.tar.gz: a8fb24f5c1b5e05f0e526e8a90016beebe80483c
3
+ metadata.gz: ebf05a1ad0bf425d2a15b825abf327e0a1a77647
4
+ data.tar.gz: 45f9bd20918f3650de8ba7b6f3cd443bc7bf32ab
5
5
  SHA512:
6
- metadata.gz: 0e7242b4045a0f9a11ef48c23b7da3e840ae87c48545fdb0614c840c7183da3d76670a5dd5e534f7e450db6c30fde240d878801a8208ef334f4df596aa20e854
7
- data.tar.gz: 46eca983628be28e86aee61adde73a7d775018024e402ac4c7c421935f46e243431bfa3b054a24dfa8a74614796ea1c54f163ae3aacbac6d26d973cf1c764bc9
6
+ metadata.gz: c4a1b180f4390fc46f9e8b16d67df42c8ec0bb38297701a03c8ca3ca5fc434eb36f535286f7c4b77e269631d5a64dded66bec6f618ecc5a205ac7a3ce56f7e2d
7
+ data.tar.gz: 7d87b7c877292beffc5aa60f649a96dcaee8302ed0a22c01d7aaeb539b598c0934e2e258361d9d981c48d10f6e2cf85c1caf214914cf1fec797c18bc0a5d5a36
data/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ ## 0.0.11
2
+ - Add start/end times for nmap_scan_metadata documents
1
3
  ## 0.0.10
2
4
  - Add top level metadata object
3
5
  - Improve examples
@@ -3,7 +3,10 @@ require "logstash/codecs/base"
3
3
  require "nmap/xml"
4
4
  require 'securerandom'
5
5
 
6
- # This codec may be used to decode only
6
+ # This codec is used to parse https://nmap.org/[namp] output data which is serialized in XML format. Nmap ("Network Mapper") is a free and open source utility for network discovery and security auditing.
7
+ # For more information on nmap, see https://nmap.org/.
8
+ #
9
+ # This codec can only be used for decoding data.
7
10
  #
8
11
  # Event types are listed below
9
12
  #
@@ -41,11 +44,20 @@ class LogStash::Codecs::Nmap < LogStash::Codecs::Base
41
44
  # This really needs to be put into ruby-nmap
42
45
  scan_host_stats = Hash[xml.instance_variable_get(:@doc).xpath('/nmaprun[@scanner="nmap"]/runstats/hosts').first.attributes.map {|k,v| [k,v.value.to_i]}]
43
46
 
47
+ finished_info = Hash[xml.instance_variable_get(:@doc).xpath('/nmaprun[@scanner="nmap"]/runstats/finished').first.attributes.map {|k,v| [k,v.value] }]
48
+ finished_info["elapsed"] = finished_info["elapsed"].to_f
49
+ finished_info["time"] = timeify(Time.at(finished_info["time"].to_i))
50
+
51
+ run_stats = hashify_struct(xml.run_stats.first)
52
+ run_stats["finished"] = finished_info
53
+
44
54
  if @emit_scan_metadata
45
55
  yield LogStash::Event.new(base.merge({
46
56
  'type' => 'nmap_scan_metadata',
47
57
  'host_stats' => scan_host_stats,
48
- 'run_stats' => xml.run_stats.first
58
+ 'run_stats' => run_stats,
59
+ 'start_time' => timeify(xml.scanner.start_time),
60
+ 'end_time' => run_stats["finished"]["time"]
49
61
  }))
50
62
  end
51
63
 
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-codec-nmap'
4
- s.version = '0.0.10'
4
+ s.version = '0.0.11'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "This codec may be used to decode Nmap XML"
7
7
  s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-codec-nmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic