logstash-codec-nmap 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 488618b8922cbf2405ae3fb28897a8023c68501e
4
+ data.tar.gz: 0ca8bc7dda315cc295776eecb69c5584084376a4
5
+ SHA512:
6
+ metadata.gz: f9aa96cdee9266e077421a0d675f3ff974862996a24714fdc839efc50dfe0ba77b60d660192e133d4e17b0a98c51154dcaf73ec96a7bda8d2453ea4439f53897
7
+ data.tar.gz: 9128e6fa5c757d016d5f7f67c2494c1b8db55dc7326d6be2815876f609eac61224bd80ca377659c4a7ee117448f9bca6ccc6a03e0fee9a83d0dea8bda904bcbe
data/CHANGELOG.md ADDED
File without changes
data/CONTRIBUTORS ADDED
@@ -0,0 +1,17 @@
1
+ The following is a list of people who have contributed ideas, code, bug
2
+ reports, or in general have helped logstash along its way.
3
+
4
+ Contributors:
5
+ * Colin Surprenant (colinsurprenant)
6
+ * Jordan Sissel (jordansissel)
7
+ * João Duarte (jsvd)
8
+ * Kurt Hurtado (kurtado)
9
+ * Nick Ethier (nickethier)
10
+ * Pier-Hugues Pellerin (ph)
11
+ * Richard Pijnenburg (electrical)
12
+ * Tal Levy (talevy)
13
+
14
+ Note: If you've sent us patches, bug reports, or otherwise contributed to
15
+ Logstash, and you aren't on the list above and want to be, please let us know
16
+ and we'll make sure you're here. Contributions from folks like you are what make
17
+ open source awesome.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012–2015 Elasticsearch <http://www.elastic.co>
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/NOTICE.TXT ADDED
@@ -0,0 +1,5 @@
1
+ Elasticsearch
2
+ Copyright 2012-2015 Elasticsearch
3
+
4
+ This product includes software developed by The Apache Software
5
+ Foundation (http://www.apache.org/).
data/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # Logstash Plugin
2
+
3
+ This is a plugin for [Logstash](https://github.com/elastic/logstash).
4
+
5
+ It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
6
+
7
+ ## Documentation
8
+
9
+ Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
10
+
11
+ - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
12
+ - For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
13
+
14
+ ## Need Help?
15
+
16
+ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
17
+
18
+ ## Developing
19
+
20
+ ### 1. Plugin Developement and Testing
21
+
22
+ #### Code
23
+ - To get started, you'll need JRuby with the Bundler gem installed.
24
+
25
+ - Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example).
26
+
27
+ - Install dependencies
28
+ ```sh
29
+ bundle install
30
+ ```
31
+
32
+ #### Test
33
+
34
+ - Update your dependencies
35
+
36
+ ```sh
37
+ bundle install
38
+ ```
39
+
40
+ - Run tests
41
+
42
+ ```sh
43
+ bundle exec rspec
44
+ ```
45
+
46
+ ### 2. Running your unpublished Plugin in Logstash
47
+
48
+ #### 2.1 Run in a local Logstash clone
49
+
50
+ - Edit Logstash `Gemfile` and add the local plugin path, for example:
51
+ ```ruby
52
+ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
53
+ ```
54
+ - Install plugin
55
+ ```sh
56
+ bin/plugin install --no-verify
57
+ ```
58
+ - Run Logstash with your plugin
59
+ ```sh
60
+ bin/logstash -e 'filter {awesome {}}'
61
+ ```
62
+ At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
63
+
64
+ #### 2.2 Run in an installed Logstash
65
+
66
+ You can use the same **2.1** method to run your plugin in an installed Logstash by editing its `Gemfile` and pointing the `:path` to your local plugin development directory or you can build the gem and install it using:
67
+
68
+ - Build your plugin gem
69
+ ```sh
70
+ gem build logstash-filter-awesome.gemspec
71
+ ```
72
+ - Install the plugin from the Logstash home
73
+ ```sh
74
+ bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
75
+ ```
76
+ - Start Logstash and proceed to test the plugin
77
+
78
+ ## Contributing
79
+
80
+ All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
81
+
82
+ Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.
83
+
84
+ It is more important to the community that you are able to contribute.
85
+
86
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
@@ -0,0 +1,164 @@
1
+ # encoding: utf-8
2
+ require "logstash/codecs/base"
3
+ require "nmap/xml"
4
+
5
+ # This codec may be used to decode (via inputs) only.
6
+ # It decodes nmap generated XML and outputs each host as its own event
7
+
8
+ class LogStash::Codecs::Nmap < LogStash::Codecs::Base
9
+ config_name "nmap"
10
+
11
+
12
+ public
13
+ def register
14
+ end
15
+
16
+ public
17
+ def decode(data)
18
+ xml = Nmap::XML.parse(data)
19
+ xml.each_host do |host|
20
+ event = host_to_event(host)
21
+
22
+ event['arguments'.freeze] = xml.scanner.arguments
23
+ event['version'.freeze] = xml.scanner.version
24
+
25
+ yield event
26
+ end
27
+ rescue StandardError => e
28
+ raise e #TODO: REMOVEME
29
+ @logger.warn("An unexpected error occurred parsing nmap XML",
30
+ :input => data,
31
+ :message => e.message,
32
+ :class => e.class.name,
33
+ :backtrace => e.backtrace)
34
+ end
35
+
36
+ def host_to_event(host)
37
+ event = LogStash::Event.new()
38
+ event['start_time'.freeze] = host.start_time
39
+ event['end_time'.freeze] = host.end_time
40
+
41
+ # These two are actually different.
42
+ # Address may contain a MAC, addresses will not AFAICT
43
+ event['addresses'.freeze] = hashify_structs(host.addresses)
44
+ event['address'.freeze] = host.address # str
45
+
46
+ event['ip'.freeze] = host.ip # str
47
+ event['ipv4'.freeze] = host.ipv4 # str
48
+ event['ipv6'.freeze] = host.ipv6 # str
49
+ event['ports'.freeze] = host.ports.map {|p| hashify_port(p)}
50
+ event['mac'.freeze] = host.mac # str
51
+ event['status'.freeze] = hashify_status(host.status)
52
+ event['hostname'.freeze] = hashify_hostname(host.hostname)
53
+ event['uptime'.freeze] = hashify_uptime(host.uptime)
54
+ event['os'.freeze] = hashify_os(host.os)
55
+ event['traceroute'.freeze] = hashify_traceroute(host.traceroute)
56
+
57
+ event
58
+ end
59
+
60
+ def hashify_status(status)
61
+ return unless status
62
+
63
+ {
64
+ 'state'.freeze => status.state, # str
65
+ 'reason'.freeze => status.reason # str
66
+ }
67
+ end
68
+
69
+ def hashify_hostname(hostname)
70
+ return unless hostname
71
+
72
+ {
73
+ 'name'.freeze => hostname.name, # str
74
+ 'type'.freeze => hostname.type, # str
75
+ }
76
+ end
77
+
78
+ def hashify_os(os)
79
+ return unless os
80
+
81
+ {
82
+ 'ports_used'.freeze => os.ports_used,
83
+ 'fingerprint'.freeze => os.fingerprint,
84
+ 'classes'.freeze => hashify_os_matches(os.classes),
85
+ 'matches'.freeze => hashify_structs(os_matches)
86
+ }
87
+ end
88
+
89
+ def hashify_os_classes(classes)
90
+ return if !classes || classes.empty?
91
+
92
+ classes.each do |klass|
93
+ {
94
+ 'type'.freeze => klass.type.to_s, # returned as sym originally
95
+ 'vendor'.freeze => klass.vendor.to_s,
96
+ 'family'.freeze => klass.family.to_s,
97
+ 'gen'.freeze => klass.gen.to_s,
98
+ 'accuracy'.freeze => klass.accuracy # int
99
+ }
100
+ end
101
+ end
102
+
103
+ def hashify_uptime(uptime)
104
+ return unless uptime
105
+
106
+ {
107
+ 'seconds'.freeze => uptime.seconds,
108
+ 'last_boot'.freeze => uptime.last_boot
109
+ }
110
+ end
111
+
112
+ def hashify_service(service)
113
+ return unless service
114
+
115
+ {
116
+ 'name'.freeze => service.name,
117
+ 'ssl'.freeze => service.ssl?,
118
+ 'protocol'.freeze => service.protocol,
119
+ 'product'.freeze => service.product,
120
+ 'hostname'.freeze => service.hostname, # This is just a string
121
+ 'device_type'.freeze => service.device_type,
122
+ 'fingerprint_method'.freeze => service.fingerprint_method,
123
+ 'fingerprint'.freeze => service.fingerprint,
124
+ 'confidence'.freeze => service.confidence
125
+ }
126
+ end
127
+
128
+ def hashify_port(port)
129
+ return unless port
130
+
131
+ {
132
+ 'number'.freeze => port.number,
133
+ 'reason'.freeze => port.reason,
134
+ 'protocol'.freeze => port.protocol.to_s,
135
+ 'service'.freeze => hashify_service(port.service),
136
+ 'state'.freeze => port.state
137
+ }
138
+ end
139
+
140
+ def hashify_traceroute(traceroute)
141
+ return unless traceroute
142
+
143
+ {
144
+ 'port'.freeze => traceroute.port, # int
145
+ 'protocol'.freeze => traceroute.protocol.to_s,
146
+ 'hops' => traceroute.map.with_index do |hop, idx|
147
+ {
148
+ 'address'.freeze => hop.addr, # str
149
+ 'hostname'.freeze => hop.host, # str
150
+ 'ttl'.freeze => hop.ttl.to_i, # int
151
+ 'index' => idx # int (for searching by distance)
152
+ }
153
+ end
154
+ }
155
+ end
156
+
157
+ def hashify_structs(structs)
158
+ structs.map {|s| hashify_struct(s)}
159
+ end
160
+
161
+ def hashify_struct(struct)
162
+ Hash[struct.each_pair.to_a]
163
+ end
164
+ end
@@ -0,0 +1,27 @@
1
+ Gem::Specification.new do |s|
2
+
3
+ s.name = 'logstash-codec-nmap'
4
+ s.version = '0.0.1'
5
+ s.licenses = ['Apache License (2.0)']
6
+ s.summary = "This codec may be used to decode Nmap XML"
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"
8
+ s.authors = ["Elastic"]
9
+ s.email = 'info@elastic.co'
10
+ s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
11
+ s.require_paths = ["lib"]
12
+
13
+ # Files
14
+ s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
15
+
16
+ # Tests
17
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
+
19
+ # Special flag to let us know this is actually a logstash plugin
20
+ s.metadata = { "logstash_plugin" => "true", "logstash_group" => "codec" }
21
+
22
+ # Gem dependencies
23
+ s.add_runtime_dependency "logstash-core", ">= 2.0.0", "< 3.0.0"
24
+ s.add_runtime_dependency 'ruby-nmap'
25
+
26
+ s.add_development_dependency 'logstash-devutils'
27
+ end
@@ -0,0 +1,52 @@
1
+ require "logstash/devutils/rspec/spec_helper"
2
+ require "logstash/codecs/nmap"
3
+ require "logstash/event"
4
+ require "insist"
5
+
6
+ describe LogStash::Codecs::Nmap do
7
+ context "#decode" do
8
+ subject do
9
+ events = []
10
+ LogStash::Codecs::Nmap.new.decode(xml_string) do |event|
11
+ events << event
12
+ end
13
+ events
14
+ end
15
+
16
+ shared_examples_for "a valid parse" do
17
+ it "should decode without error" do
18
+ expect(subject).to be_a(Array)
19
+ end
20
+
21
+ it "should encode at least one thing" do
22
+ expect(subject.length > 0).to eql(true)
23
+ end
24
+
25
+ it "should encode the output as LogStash::Event objects" do
26
+ subject.each do |event|
27
+ expect(event).to be_a(LogStash::Event)
28
+ end
29
+ end
30
+ end
31
+
32
+ describe "parsing traceroutes" do
33
+ let(:xml_string) { File.open("spec/fixtures/traceroutes.xml").read }
34
+ it_should_behave_like "a valid parse"
35
+ end
36
+
37
+ # This is broken until https://github.com/sophsec/ruby-nmap/pull/40 is accepted
38
+ # describe "parsing ipv6" do
39
+ # let(:xml_string) { File.open("spec/fixtures/ipv6_all.xml").read }
40
+
41
+ # it_should_behave_like "a valid parse"
42
+ # end
43
+
44
+ describe "parsing pingsweeps" do
45
+ let(:xml_string) { File.open("spec/fixtures/pingsweep.xml").read }
46
+ it_should_behave_like "a valid parse"
47
+ end
48
+
49
+
50
+ end
51
+
52
+ end
@@ -0,0 +1,134 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE nmaprun>
3
+ <?xml-stylesheet href="file:///usr/local/bin/../share/nmap/nmap.xsl" type="text/xsl"?>
4
+ <!-- Nmap 7.01 scan initiated Sat Jan 16 07:33:12 2016 as: nmap -6 -A -oX spec/fixtures/ipv6_all.xml 2601:449:4200:577c:3e15:c2ff:feea:b872 -->
5
+ <nmaprun scanner="nmap" args="nmap -6 -A -oX spec/fixtures/ipv6_all.xml 2601:449:4200:577c:3e15:c2ff:feea:b872" start="1452951192" startstr="Sat Jan 16 07:33:12 2016" version="7.01" xmloutputversion="1.04">
6
+ <scaninfo type="connect" protocol="tcp" numservices="1000" services="1,3-4,6-7,9,13,17,19-26,30,32-33,37,42-43,49,53,70,79-85,88-90,99-100,106,109-111,113,119,125,135,139,143-144,146,161,163,179,199,211-212,222,254-256,259,264,280,301,306,311,340,366,389,406-407,416-417,425,427,443-445,458,464-465,481,497,500,512-515,524,541,543-545,548,554-555,563,587,593,616-617,625,631,636,646,648,666-668,683,687,691,700,705,711,714,720,722,726,749,765,777,783,787,800-801,808,843,873,880,888,898,900-903,911-912,981,987,990,992-993,995,999-1002,1007,1009-1011,1021-1100,1102,1104-1108,1110-1114,1117,1119,1121-1124,1126,1130-1132,1137-1138,1141,1145,1147-1149,1151-1152,1154,1163-1166,1169,1174-1175,1183,1185-1187,1192,1198-1199,1201,1213,1216-1218,1233-1234,1236,1244,1247-1248,1259,1271-1272,1277,1287,1296,1300-1301,1309-1311,1322,1328,1334,1352,1417,1433-1434,1443,1455,1461,1494,1500-1501,1503,1521,1524,1533,1556,1580,1583,1594,1600,1641,1658,1666,1687-1688,1700,1717-1721,1723,1755,1761,1782-1783,1801,1805,1812,1839-1840,1862-1864,1875,1900,1914,1935,1947,1971-1972,1974,1984,1998-2010,2013,2020-2022,2030,2033-2035,2038,2040-2043,2045-2049,2065,2068,2099-2100,2103,2105-2107,2111,2119,2121,2126,2135,2144,2160-2161,2170,2179,2190-2191,2196,2200,2222,2251,2260,2288,2301,2323,2366,2381-2383,2393-2394,2399,2401,2492,2500,2522,2525,2557,2601-2602,2604-2605,2607-2608,2638,2701-2702,2710,2717-2718,2725,2800,2809,2811,2869,2875,2909-2910,2920,2967-2968,2998,3000-3001,3003,3005-3007,3011,3013,3017,3030-3031,3052,3071,3077,3128,3168,3211,3221,3260-3261,3268-3269,3283,3300-3301,3306,3322-3325,3333,3351,3367,3369-3372,3389-3390,3404,3476,3493,3517,3527,3546,3551,3580,3659,3689-3690,3703,3737,3766,3784,3800-3801,3809,3814,3826-3828,3851,3869,3871,3878,3880,3889,3905,3914,3918,3920,3945,3971,3986,3995,3998,4000-4006,4045,4111,4125-4126,4129,4224,4242,4279,4321,4343,4443-4446,4449,4550,4567,4662,4848,4899-4900,4998,5000-5004,5009,5030,5033,5050-5051,5054,5060-5061,5080,5087,5100-5102,5120,5190,5200,5214,5221-5222,5225-5226,5269,5280,5298,5357,5405,5414,5431-5432,5440,5500,5510,5544,5550,5555,5560,5566,5631,5633,5666,5678-5679,5718,5730,5800-5802,5810-5811,5815,5822,5825,5850,5859,5862,5877,5900-5904,5906-5907,5910-5911,5915,5922,5925,5950,5952,5959-5963,5987-5989,5998-6007,6009,6025,6059,6100-6101,6106,6112,6123,6129,6156,6346,6389,6502,6510,6543,6547,6565-6567,6580,6646,6666-6669,6689,6692,6699,6779,6788-6789,6792,6839,6881,6901,6969,7000-7002,7004,7007,7019,7025,7070,7100,7103,7106,7200-7201,7402,7435,7443,7496,7512,7625,7627,7676,7741,7777-7778,7800,7911,7920-7921,7937-7938,7999-8002,8007-8011,8021-8022,8031,8042,8045,8080-8090,8093,8099-8100,8180-8181,8192-8194,8200,8222,8254,8290-8292,8300,8333,8383,8400,8402,8443,8500,8600,8649,8651-8652,8654,8701,8800,8873,8888,8899,8994,9000-9003,9009-9011,9040,9050,9071,9080-9081,9090-9091,9099-9103,9110-9111,9200,9207,9220,9290,9415,9418,9485,9500,9502-9503,9535,9575,9593-9595,9618,9666,9876-9878,9898,9900,9917,9929,9943-9944,9968,9998-10004,10009-10010,10012,10024-10025,10082,10180,10215,10243,10566,10616-10617,10621,10626,10628-10629,10778,11110-11111,11967,12000,12174,12265,12345,13456,13722,13782-13783,14000,14238,14441-14442,15000,15002-15004,15660,15742,16000-16001,16012,16016,16018,16080,16113,16992-16993,17877,17988,18040,18101,18988,19101,19283,19315,19350,19780,19801,19842,20000,20005,20031,20221-20222,20828,21571,22939,23502,24444,24800,25734-25735,26214,27000,27352-27353,27355-27356,27715,28201,30000,30718,30951,31038,31337,32768-32785,33354,33899,34571-34573,35500,38292,40193,40911,41511,42510,44176,44442-44443,44501,45100,48080,49152-49161,49163,49165,49167,49175-49176,49400,49999-50003,50006,50300,50389,50500,50636,50800,51103,51493,52673,52822,52848,52869,54045,54328,55055-55056,55555,55600,56737-56738,57294,57797,58080,60020,60443,61532,61900,62078,63331,64623,64680,65000,65129,65389"/>
7
+ <verbose level="0"/>
8
+ <debugging level="0"/>
9
+ <host starttime="1452951192" endtime="1452951336"><status state="up" reason="conn-refused" reason_ttl="0"/>
10
+ <address addr="2601:449:4200:577c:3e15:c2ff:feea:b872" addrtype="ipv6"/>
11
+ <hostnames>
12
+ </hostnames>
13
+ <ports><extraports state="closed" count="498">
14
+ <extrareasons reason="conn-refused" count="498"/>
15
+ </extraports>
16
+ <extraports state="filtered" count="498">
17
+ <extrareasons reason="no-responses" count="498"/>
18
+ </extraports>
19
+ <port protocol="tcp" portid="111"><state state="open" reason="syn-ack" reason_ttl="0"/><service name="rpcbind" version="2-4" extrainfo="RPC #100000" method="probed" conf="10"/><script id="rpcinfo" output="&#xa; program version port/proto service&#xa; 100000 2,3,4 111/tcp rpcbind&#xa; 100000 2,3,4 111/udp rpcbind&#xa; 100003 2,3 2049/tcp nfs&#xa; 100003 2,3 2049/udp nfs&#xa; 100005 1,3 895/udp mountd&#xa; 100005 1,3 1023/tcp mountd&#xa; 100011 1,2 994/udp rquotad&#xa; 100011 1,2 999/tcp rquotad&#xa; 100021 0,1,3,4 733/udp nlockmgr&#xa; 100021 0,1,3,4 1017/tcp nlockmgr&#xa; 100024 1 896/udp status&#xa; 100024 1 1021/tcp status&#xa;"><table key="100000">
20
+ <table key="udp">
21
+ <table key="version">
22
+ <elem>2</elem>
23
+ <elem>3</elem>
24
+ <elem>4</elem>
25
+ </table>
26
+ <elem key="port">111</elem>
27
+ </table>
28
+ <table key="tcp">
29
+ <table key="version">
30
+ <elem>2</elem>
31
+ <elem>3</elem>
32
+ <elem>4</elem>
33
+ </table>
34
+ <elem key="port">111</elem>
35
+ </table>
36
+ </table>
37
+ <table key="100003">
38
+ <table key="udp">
39
+ <table key="version">
40
+ <elem>2</elem>
41
+ <elem>3</elem>
42
+ </table>
43
+ <elem key="port">2049</elem>
44
+ </table>
45
+ <table key="tcp">
46
+ <table key="version">
47
+ <elem>2</elem>
48
+ <elem>3</elem>
49
+ </table>
50
+ <elem key="port">2049</elem>
51
+ </table>
52
+ </table>
53
+ <table key="100021">
54
+ <table key="udp">
55
+ <table key="version">
56
+ <elem>0</elem>
57
+ <elem>1</elem>
58
+ <elem>3</elem>
59
+ <elem>4</elem>
60
+ </table>
61
+ <elem key="port">733</elem>
62
+ </table>
63
+ <table key="tcp">
64
+ <table key="version">
65
+ <elem>0</elem>
66
+ <elem>1</elem>
67
+ <elem>3</elem>
68
+ <elem>4</elem>
69
+ </table>
70
+ <elem key="port">1017</elem>
71
+ </table>
72
+ </table>
73
+ <table key="100005">
74
+ <table key="udp">
75
+ <table key="version">
76
+ <elem>1</elem>
77
+ <elem>3</elem>
78
+ </table>
79
+ <elem key="port">895</elem>
80
+ </table>
81
+ <table key="tcp">
82
+ <table key="version">
83
+ <elem>1</elem>
84
+ <elem>3</elem>
85
+ </table>
86
+ <elem key="port">1023</elem>
87
+ </table>
88
+ </table>
89
+ <table key="100024">
90
+ <table key="udp">
91
+ <table key="version">
92
+ <elem>1</elem>
93
+ </table>
94
+ <elem key="port">896</elem>
95
+ </table>
96
+ <table key="tcp">
97
+ <table key="version">
98
+ <elem>1</elem>
99
+ </table>
100
+ <elem key="port">1021</elem>
101
+ </table>
102
+ </table>
103
+ <table key="100011">
104
+ <table key="udp">
105
+ <table key="version">
106
+ <elem>1</elem>
107
+ <elem>2</elem>
108
+ </table>
109
+ <elem key="port">994</elem>
110
+ </table>
111
+ <table key="tcp">
112
+ <table key="version">
113
+ <elem>1</elem>
114
+ <elem>2</elem>
115
+ </table>
116
+ <elem key="port">999</elem>
117
+ </table>
118
+ </table>
119
+ </script></port>
120
+ <port protocol="tcp" portid="1022"><state state="open" reason="syn-ack" reason_ttl="0"/><service name="mountd" version="1-3" extrainfo="RPC #100005" method="probed" conf="10"/></port>
121
+ <port protocol="tcp" portid="2049"><state state="open" reason="syn-ack" reason_ttl="0"/><service name="tcpwrapped" method="probed" conf="8"/></port>
122
+ <port protocol="tcp" portid="3689"><state state="open" reason="syn-ack" reason_ttl="0"/><service name="daap" product="Apple iTunes DAAP" version="12.3.2.35" ostype="OS X" method="probed" conf="10"><cpe>cpe:/a:apple:itunes:12.3.2.35</cpe></service></port>
123
+ </ports>
124
+ <hostscript><script id="address-info" output="&#xa; IPv6 EUI-64: &#xa; MAC address: &#xa; address: 3c:15:c2:ea:b8:72&#xa; manuf: Apple"><table key="IPv6 EUI-64">
125
+ <table key="MAC address">
126
+ <elem key="address">3c:15:c2:ea:b8:72</elem>
127
+ <elem key="manuf">Apple</elem>
128
+ </table>
129
+ </table>
130
+ </script></hostscript><times srtt="970" rttvar="474" to="100000"/>
131
+ </host>
132
+ <runstats><finished time="1452951337" timestr="Sat Jan 16 07:35:37 2016" elapsed="144.88" summary="Nmap done at Sat Jan 16 07:35:37 2016; 1 IP address (1 host up) scanned in 144.88 seconds" exit="success"/><hosts up="1" down="0" total="1"/>
133
+ </runstats>
134
+ </nmaprun>
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE nmaprun>
3
+ <?xml-stylesheet href="file:///usr/local/bin/../share/nmap/nmap.xsl" type="text/xsl"?>
4
+ <!-- Nmap 7.01 scan initiated Sat Jan 16 07:23:34 2016 as: nmap -sP -oX spec/fixtures/pingsweep.xml 192.168.1.0/24 -->
5
+ <nmaprun scanner="nmap" args="nmap -sP -oX spec/fixtures/pingsweep.xml 192.168.1.0/24" start="1452950614" startstr="Sat Jan 16 07:23:34 2016" version="7.01" xmloutputversion="1.04">
6
+ <verbose level="0"/>
7
+ <debugging level="0"/>
8
+ <host><status state="up" reason="syn-ack" reason_ttl="0"/>
9
+ <address addr="192.168.1.1" addrtype="ipv4"/>
10
+ <hostnames>
11
+ <hostname name="router.asus.com" type="PTR"/>
12
+ </hostnames>
13
+ <times srtt="1844" rttvar="5000" to="100000"/>
14
+ </host>
15
+ <host><status state="up" reason="conn-refused" reason_ttl="0"/>
16
+ <address addr="192.168.1.100" addrtype="ipv4"/>
17
+ <hostnames>
18
+ <hostname name="andrew-bfg" type="PTR"/>
19
+ </hostnames>
20
+ <times srtt="375" rttvar="5000" to="100000"/>
21
+ </host>
22
+ <host><status state="up" reason="conn-refused" reason_ttl="0"/>
23
+ <address addr="192.168.1.132" addrtype="ipv4"/>
24
+ <hostnames>
25
+ </hostnames>
26
+ <times srtt="916" rttvar="4196" to="100000"/>
27
+ </host>
28
+ <runstats><finished time="1452950617" timestr="Sat Jan 16 07:23:37 2016" elapsed="2.58" summary="Nmap done at Sat Jan 16 07:23:37 2016; 256 IP addresses (3 hosts up) scanned in 2.58 seconds" exit="success"/><hosts up="3" down="253" total="256"/>
29
+ </runstats>
30
+ </nmaprun>
@@ -0,0 +1,37 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE nmaprun>
3
+ <?xml-stylesheet href="file:///usr/local/bin/../share/nmap/nmap.xsl" type="text/xsl"?>
4
+ <!-- Nmap 7.01 scan initiated Sat Jan 16 07:21:54 2016 as: nmap -tr -oX spec/fixtures/traceroutes.xml andrewvc.com blog.andrewvc.com -->
5
+ <nmaprun scanner="nmap" args="nmap -tr -oX spec/fixtures/traceroutes.xml andrewvc.com blog.andrewvc.com" start="1452950514" startstr="Sat Jan 16 07:21:54 2016" version="7.01" xmloutputversion="1.04">
6
+ <scaninfo type="syn" protocol="tcp" numservices="1000" services="1,3-4,6-7,9,13,17,19-26,30,32-33,37,42-43,49,53,70,79-85,88-90,99-100,106,109-111,113,119,125,135,139,143-144,146,161,163,179,199,211-212,222,254-256,259,264,280,301,306,311,340,366,389,406-407,416-417,425,427,443-445,458,464-465,481,497,500,512-515,524,541,543-545,548,554-555,563,587,593,616-617,625,631,636,646,648,666-668,683,687,691,700,705,711,714,720,722,726,749,765,777,783,787,800-801,808,843,873,880,888,898,900-903,911-912,981,987,990,992-993,995,999-1002,1007,1009-1011,1021-1100,1102,1104-1108,1110-1114,1117,1119,1121-1124,1126,1130-1132,1137-1138,1141,1145,1147-1149,1151-1152,1154,1163-1166,1169,1174-1175,1183,1185-1187,1192,1198-1199,1201,1213,1216-1218,1233-1234,1236,1244,1247-1248,1259,1271-1272,1277,1287,1296,1300-1301,1309-1311,1322,1328,1334,1352,1417,1433-1434,1443,1455,1461,1494,1500-1501,1503,1521,1524,1533,1556,1580,1583,1594,1600,1641,1658,1666,1687-1688,1700,1717-1721,1723,1755,1761,1782-1783,1801,1805,1812,1839-1840,1862-1864,1875,1900,1914,1935,1947,1971-1972,1974,1984,1998-2010,2013,2020-2022,2030,2033-2035,2038,2040-2043,2045-2049,2065,2068,2099-2100,2103,2105-2107,2111,2119,2121,2126,2135,2144,2160-2161,2170,2179,2190-2191,2196,2200,2222,2251,2260,2288,2301,2323,2366,2381-2383,2393-2394,2399,2401,2492,2500,2522,2525,2557,2601-2602,2604-2605,2607-2608,2638,2701-2702,2710,2717-2718,2725,2800,2809,2811,2869,2875,2909-2910,2920,2967-2968,2998,3000-3001,3003,3005-3007,3011,3013,3017,3030-3031,3052,3071,3077,3128,3168,3211,3221,3260-3261,3268-3269,3283,3300-3301,3306,3322-3325,3333,3351,3367,3369-3372,3389-3390,3404,3476,3493,3517,3527,3546,3551,3580,3659,3689-3690,3703,3737,3766,3784,3800-3801,3809,3814,3826-3828,3851,3869,3871,3878,3880,3889,3905,3914,3918,3920,3945,3971,3986,3995,3998,4000-4006,4045,4111,4125-4126,4129,4224,4242,4279,4321,4343,4443-4446,4449,4550,4567,4662,4848,4899-4900,4998,5000-5004,5009,5030,5033,5050-5051,5054,5060-5061,5080,5087,5100-5102,5120,5190,5200,5214,5221-5222,5225-5226,5269,5280,5298,5357,5405,5414,5431-5432,5440,5500,5510,5544,5550,5555,5560,5566,5631,5633,5666,5678-5679,5718,5730,5800-5802,5810-5811,5815,5822,5825,5850,5859,5862,5877,5900-5904,5906-5907,5910-5911,5915,5922,5925,5950,5952,5959-5963,5987-5989,5998-6007,6009,6025,6059,6100-6101,6106,6112,6123,6129,6156,6346,6389,6502,6510,6543,6547,6565-6567,6580,6646,6666-6669,6689,6692,6699,6779,6788-6789,6792,6839,6881,6901,6969,7000-7002,7004,7007,7019,7025,7070,7100,7103,7106,7200-7201,7402,7435,7443,7496,7512,7625,7627,7676,7741,7777-7778,7800,7911,7920-7921,7937-7938,7999-8002,8007-8011,8021-8022,8031,8042,8045,8080-8090,8093,8099-8100,8180-8181,8192-8194,8200,8222,8254,8290-8292,8300,8333,8383,8400,8402,8443,8500,8600,8649,8651-8652,8654,8701,8800,8873,8888,8899,8994,9000-9003,9009-9011,9040,9050,9071,9080-9081,9090-9091,9099-9103,9110-9111,9200,9207,9220,9290,9415,9418,9485,9500,9502-9503,9535,9575,9593-9595,9618,9666,9876-9878,9898,9900,9917,9929,9943-9944,9968,9998-10004,10009-10010,10012,10024-10025,10082,10180,10215,10243,10566,10616-10617,10621,10626,10628-10629,10778,11110-11111,11967,12000,12174,12265,12345,13456,13722,13782-13783,14000,14238,14441-14442,15000,15002-15004,15660,15742,16000-16001,16012,16016,16018,16080,16113,16992-16993,17877,17988,18040,18101,18988,19101,19283,19315,19350,19780,19801,19842,20000,20005,20031,20221-20222,20828,21571,22939,23502,24444,24800,25734-25735,26214,27000,27352-27353,27355-27356,27715,28201,30000,30718,30951,31038,31337,32768-32785,33354,33899,34571-34573,35500,38292,40193,40911,41511,42510,44176,44442-44443,44501,45100,48080,49152-49161,49163,49165,49167,49175-49176,49400,49999-50003,50006,50300,50389,50500,50636,50800,51103,51493,52673,52822,52848,52869,54045,54328,55055-55056,55555,55600,56737-56738,57294,57797,58080,60020,60443,61532,61900,62078,63331,64623,64680,65000,65129,65389"/>
7
+ <verbose level="0"/>
8
+ <debugging level="0"/>
9
+ <host starttime="1452950518" endtime="1452950524"><status state="up" reason="echo-reply" reason_ttl="57"/>
10
+ <address addr="23.235.44.133" addrtype="ipv4"/>
11
+ <hostnames>
12
+ <hostname name="blog.andrewvc.com" type="user"/>
13
+ <hostname name="blog.andrewvc.com" type="PTR"/>
14
+ </hostnames>
15
+ <ports><extraports state="filtered" count="998">
16
+ <extrareasons reason="no-responses" count="998"/>
17
+ </extraports>
18
+ <port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="57"/><service name="http" method="table" conf="3"/></port>
19
+ <port protocol="tcp" portid="443"><state state="open" reason="syn-ack" reason_ttl="57"/><service name="https" method="table" conf="3"/></port>
20
+ </ports>
21
+ <trace port="443" proto="tcp">
22
+ <hop ttl="1" ipaddr="192.168.1.1" rtt="2.61" host="router.asus.com"/>
23
+ <hop ttl="2" ipaddr="96.120.48.165" rtt="13.32"/>
24
+ <hop ttl="3" ipaddr="68.85.166.9" rtt="23.94" host="te-0-3-0-21-sur01.swmpls.mn.minn.comcast.net"/>
25
+ <hop ttl="4" ipaddr="68.87.174.154" rtt="23.94" host="te-0-0-0-1-sur02.swmpls.mn.minn.comcast.net"/>
26
+ <hop ttl="5" ipaddr="68.87.174.129" rtt="23.95" host="te-0-8-0-13-ar01.roseville.mn.minn.comcast.net"/>
27
+ <hop ttl="6" ipaddr="68.86.232.170" rtt="23.96" host="hu-0-0-0-0-ar01.crosstown.mn.minn.comcast.net"/>
28
+ <hop ttl="7" ipaddr="68.86.94.5" rtt="33.43" host="be-13367-cr02.denver.co.ibone.comcast.net"/>
29
+ <hop ttl="8" ipaddr="68.86.84.230" rtt="42.92" host="be-11724-cr02.dallas.tx.ibone.comcast.net"/>
30
+ <hop ttl="9" ipaddr="68.86.83.110" rtt="41.42" host="be-14-pe02.1950stemmons.tx.ibone.comcast.net"/>
31
+ <hop ttl="11" ipaddr="23.235.44.133" rtt="50.99" host="blog.andrewvc.com"/>
32
+ </trace>
33
+ <times srtt="43140" rttvar="11005" to="100000"/>
34
+ </host>
35
+ <runstats><finished time="1452950529" timestr="Sat Jan 16 07:22:09 2016" elapsed="14.55" summary="Nmap done at Sat Jan 16 07:22:09 2016; 2 IP addresses (1 host up) scanned in 14.55 seconds" exit="success"/><hosts up="1" down="1" total="2"/>
36
+ </runstats>
37
+ </nmaprun>
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logstash-codec-nmap
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Elastic
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - '>='
17
+ - !ruby/object:Gem::Version
18
+ version: 2.0.0
19
+ - - <
20
+ - !ruby/object:Gem::Version
21
+ version: 3.0.0
22
+ name: logstash-core
23
+ prerelease: false
24
+ type: :runtime
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.0.0
30
+ - - <
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ name: ruby-nmap
40
+ prerelease: false
41
+ type: :runtime
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ name: logstash-devutils
54
+ prerelease: false
55
+ type: :development
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ 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
62
+ email: info@elastic.co
63
+ executables: []
64
+ extensions: []
65
+ extra_rdoc_files: []
66
+ files:
67
+ - CHANGELOG.md
68
+ - CONTRIBUTORS
69
+ - Gemfile
70
+ - LICENSE
71
+ - NOTICE.TXT
72
+ - README.md
73
+ - lib/logstash/codecs/nmap.rb
74
+ - logstash-codec-nmap.gemspec
75
+ - spec/codecs/nmap_spec.rb
76
+ - spec/fixtures/ipv6_all.xml
77
+ - spec/fixtures/pingsweep.xml
78
+ - spec/fixtures/traceroutes.xml
79
+ homepage: http://www.elastic.co/guide/en/logstash/current/index.html
80
+ licenses:
81
+ - Apache License (2.0)
82
+ metadata:
83
+ logstash_plugin: 'true'
84
+ logstash_group: codec
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.4.8
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: This codec may be used to decode Nmap XML
105
+ test_files:
106
+ - spec/codecs/nmap_spec.rb
107
+ - spec/fixtures/ipv6_all.xml
108
+ - spec/fixtures/pingsweep.xml
109
+ - spec/fixtures/traceroutes.xml