ronin-nmap 0.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.document +4 -0
  3. data/.github/workflows/ruby.yml +47 -0
  4. data/.gitignore +14 -0
  5. data/.rspec +1 -0
  6. data/.rubocop.yml +15 -0
  7. data/.ruby-version +1 -0
  8. data/.yardopts +1 -0
  9. data/COPYING.txt +165 -0
  10. data/ChangeLog.md +10 -0
  11. data/Gemfile +42 -0
  12. data/README.md +238 -0
  13. data/Rakefile +43 -0
  14. data/bin/ronin-nmap +32 -0
  15. data/data/completions/ronin-nmap +79 -0
  16. data/data/templates/script.rb.erb +58 -0
  17. data/gemspec.yml +42 -0
  18. data/lib/ronin/nmap/cli/command.rb +40 -0
  19. data/lib/ronin/nmap/cli/commands/completion.rb +61 -0
  20. data/lib/ronin/nmap/cli/commands/convert.rb +108 -0
  21. data/lib/ronin/nmap/cli/commands/dump.rb +293 -0
  22. data/lib/ronin/nmap/cli/commands/grep.rb +378 -0
  23. data/lib/ronin/nmap/cli/commands/import.rb +79 -0
  24. data/lib/ronin/nmap/cli/commands/new.rb +226 -0
  25. data/lib/ronin/nmap/cli/commands/print.rb +133 -0
  26. data/lib/ronin/nmap/cli/commands/scan.rb +233 -0
  27. data/lib/ronin/nmap/cli/filtering_options.rb +355 -0
  28. data/lib/ronin/nmap/cli/importable.rb +68 -0
  29. data/lib/ronin/nmap/cli/port_list.rb +102 -0
  30. data/lib/ronin/nmap/cli.rb +50 -0
  31. data/lib/ronin/nmap/converter.rb +114 -0
  32. data/lib/ronin/nmap/converters/csv.rb +162 -0
  33. data/lib/ronin/nmap/converters/json.rb +562 -0
  34. data/lib/ronin/nmap/converters.rb +54 -0
  35. data/lib/ronin/nmap/exceptions.rb +47 -0
  36. data/lib/ronin/nmap/importer.rb +369 -0
  37. data/lib/ronin/nmap/root.rb +28 -0
  38. data/lib/ronin/nmap/version.rb +26 -0
  39. data/lib/ronin/nmap.rb +223 -0
  40. data/man/ronin-nmap-completion.1 +76 -0
  41. data/man/ronin-nmap-completion.1.md +78 -0
  42. data/man/ronin-nmap-convert.1 +33 -0
  43. data/man/ronin-nmap-convert.1.md +36 -0
  44. data/man/ronin-nmap-dump.1 +141 -0
  45. data/man/ronin-nmap-dump.1.md +119 -0
  46. data/man/ronin-nmap-grep.1 +33 -0
  47. data/man/ronin-nmap-grep.1.md +36 -0
  48. data/man/ronin-nmap-import.1 +52 -0
  49. data/man/ronin-nmap-import.1.md +57 -0
  50. data/man/ronin-nmap-new.1 +81 -0
  51. data/man/ronin-nmap-new.1.md +73 -0
  52. data/man/ronin-nmap-print.1 +61 -0
  53. data/man/ronin-nmap-print.1.md +63 -0
  54. data/man/ronin-nmap-scan.1 +86 -0
  55. data/man/ronin-nmap-scan.1.md +84 -0
  56. data/man/ronin-nmap.1 +58 -0
  57. data/man/ronin-nmap.1.md +57 -0
  58. data/ronin-nmap.gemspec +62 -0
  59. data/scripts/setup +161 -0
  60. metadata +168 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 555ce2b5491e4a0a1ce2dd0fa9fc72f1e08b9112e278b1f867ea3e27a697ff65
4
+ data.tar.gz: 1f80b02966fc0d67052da39abca3bec7da09113b1682371190803b838f4f62b7
5
+ SHA512:
6
+ metadata.gz: 2e014461fb8addf6d3fac68691b6c22c9ef7543b9d9bd6bfadf9a4789a2f9f310ea3598b42ee6c0ecb183a07816c3d4c51acb7a4dc94cd0e58a1051d7e84a11d
7
+ data.tar.gz: 156d5eefea7182531f1c31f0f9222697631e057f8fc18e09c78bb86761a3635224ff3ca720869ecb9c86700b1df91472e1fb6848f7bc354ac96abfe9e0b9eb69
data/.document ADDED
@@ -0,0 +1,4 @@
1
+ lib/**/*.rb
2
+ -
3
+ ChangeLog.md
4
+ COPYING.txt
@@ -0,0 +1,47 @@
1
+ name: CI
2
+
3
+ on: [ push, pull_request ]
4
+
5
+ jobs:
6
+ tests:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby:
12
+ - '3.0'
13
+ - '3.1'
14
+ - '3.2'
15
+ - '3.3'
16
+ - jruby
17
+ - truffleruby
18
+ name: Ruby ${{ matrix.ruby }}
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ bundler-cache: true
26
+ - name: Install libsqlite3
27
+ run: |
28
+ sudo apt update -y && \
29
+ sudo apt install -y --no-install-recommends --no-install-suggests libsqlite3-dev
30
+ - name: Install dependencies
31
+ run: bundle install --jobs 4 --retry 3
32
+ - name: Run tests
33
+ run: bundle exec rake test
34
+
35
+ # rubocop linting
36
+ rubocop:
37
+ runs-on: ubuntu-latest
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+ - name: Set up Ruby
41
+ uses: ruby/setup-ruby@v1
42
+ with:
43
+ ruby-version: 3.0
44
+ - name: Install dependencies
45
+ run: bundle install --jobs 4 --retry 3
46
+ - name: Run rubocop
47
+ run: bundle exec rubocop --parallel
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /coverage
2
+ /data/completion/ronin-nmap
3
+ /doc
4
+ /pkg
5
+ /man/*.[1-9]
6
+ /vendor/bundle
7
+ /Gemfile.lock
8
+ /.bundle
9
+ /.yardoc
10
+ .DS_Store
11
+ *.db
12
+ *.log
13
+ *.swp
14
+ *~
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour --format documentation
data/.rubocop.yml ADDED
@@ -0,0 +1,15 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ SuggestExtensions: false
4
+ TargetRubyVersion: 3.1
5
+
6
+
7
+ inherit_gem:
8
+ rubocop-ronin: rubocop.yml
9
+
10
+ #
11
+ # ronin-nmap specific exceptions
12
+ #
13
+ Style/ExplicitBlockArgument:
14
+ Exclude:
15
+ - 'lib/ronin/nmap/converters/csv.rb'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-3.1
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --markup markdown --title 'Ronin::Nmap Documentation' --protected
data/COPYING.txt ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/ChangeLog.md ADDED
@@ -0,0 +1,10 @@
1
+ ### 0.1.0 / 2024-XX-XX
2
+
3
+ * Initial release:
4
+ * Supports automating `nmap` using [ruby-nmap].
5
+ * Supports parsing and filtering nmap XML.
6
+ * Supports converting nmap XML into JSON or CSV.
7
+ * Supports importing nmap XML data into the [ronin-db] database.
8
+
9
+ [ruby-nmap]: https://github.com/postmodern/ruby-nmap#readme
10
+ [ronin-db]: https://github.com/ronin-rb/ronin-db#readme
data/Gemfile ADDED
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ platform :jruby do
8
+ gem 'jruby-openssl', '~> 0.7'
9
+ gem 'activerecord-jdbcsqlite3-adapter', '~> 70.0'
10
+ gem 'activerecord', '< 7.1.0'
11
+ end
12
+
13
+ # gem 'ruby-nmap', '~> 1.0', github: 'postmodern/ruby-nmap'
14
+
15
+ # Ronin dependencies
16
+ # gem 'ronin-core', '~> 0.2', github: 'ronin-rb/ronin-core',
17
+ # branch: 'main'
18
+ # gem 'ronin-db', '~> 0.2', github: 'ronin-rb/ronin-db',
19
+ # branch: 'main'
20
+
21
+ group :development do
22
+ gem 'rake'
23
+ gem 'rubygems-tasks', '~> 0.2'
24
+
25
+ gem 'rspec', '~> 3.0'
26
+ gem 'simplecov', '~> 0.20'
27
+
28
+ gem 'kramdown', '~> 2.0'
29
+ gem 'kramdown-man', '~> 1.0'
30
+
31
+ gem 'redcarpet', platform: :mri
32
+ gem 'yard', '~> 0.9'
33
+ gem 'yard-spellcheck', require: false
34
+
35
+ gem 'dead_end', require: false
36
+ gem 'sord', require: false, platform: :mri
37
+ gem 'stackprof', require: false, platform: :mri
38
+ gem 'rubocop', require: false, platform: :mri
39
+ gem 'rubocop-ronin', require: false, platform: :mri
40
+
41
+ gem 'command_kit-completion', '~> 0.2', require: false
42
+ end
data/README.md ADDED
@@ -0,0 +1,238 @@
1
+ # ronin-nmap
2
+
3
+ [![CI](https://github.com/ronin-rb/ronin-nmap/actions/workflows/ruby.yml/badge.svg)](https://github.com/ronin-rb/ronin-nmap/actions/workflows/ruby.yml)
4
+ [![Code Climate](https://codeclimate.com/github/ronin-rb/ronin-nmap.svg)](https://codeclimate.com/github/ronin-rb/ronin-nmap)
5
+
6
+ * [Website](https://ronin-rb.dev/)
7
+ * [Source](https://github.com/ronin-rb/ronin-nmap)
8
+ * [Issues](https://github.com/ronin-rb/ronin-nmap/issues)
9
+ * [Documentation](https://ronin-rb.dev/docs/ronin-nmap/frames)
10
+ * [Discord](https://discord.gg/6WAb3PsVX9) |
11
+ [Mastodon](https://infosec.exchange/@ronin_rb)
12
+
13
+ ## Description
14
+
15
+ ronin-nmap is a Ruby library for working with nmap. ronin-nmap can parse nmap
16
+ XML, convert nmap XML into JSON or CSV, or import nmap XML into the [ronin-db]
17
+ database.
18
+
19
+ ## Features
20
+
21
+ * Supports automating `nmap` using [ruby-nmap].
22
+ * Supports parsing and filtering nmap XML.
23
+ * Supports converting nmap XML into JSON or CSV.
24
+ * Supports importing nmap XML data into the [ronin-db] database.
25
+
26
+ ## Synopsis
27
+
28
+ ```
29
+ Usage: ronin-nmap [options]
30
+
31
+ Options:
32
+ -V, --version Prints the version and exits
33
+ -h, --help Print help information
34
+
35
+ Arguments:
36
+ [COMMAND] The command name to run
37
+ [ARGS ...] Additional arguments for the command
38
+
39
+ Commands:
40
+ completion
41
+ convert
42
+ dump
43
+ grep
44
+ help
45
+ import
46
+ new
47
+ print
48
+ scan
49
+ ```
50
+
51
+ Import an nmap XML scan file into [ronin-db]\:
52
+
53
+ ```shell
54
+ $ ronin-nmap import scan.xml
55
+ ```
56
+
57
+ Perform an nmap scan and import it's results into the [ronin-db]\:
58
+
59
+ ```shell
60
+ $ ronin-nmap scan --import -- -sT -sV -p 22,25,80,443
61
+ ```
62
+
63
+ Parse and filter an nmap XML scan file:
64
+
65
+ ```shell
66
+ $ ronin-nmap parse --hosts-with-port 443 scan.xml
67
+ ```
68
+
69
+ Dump a nmap XML scan file to a list of `IP:PORT` pairs:
70
+
71
+ ```shell
72
+ $ ronin-nmap dump --print-ip-ports scan.xml
73
+ ```
74
+
75
+ Dump a nmap XML scan file to a list of `HOST:PORT` pairs:
76
+
77
+ ```shell
78
+ $ ronin-nmap dump --print-host-ports scan.xml
79
+ ```
80
+
81
+ Dump a nmap XML scan file to a list of `http`://` or `https://` URIs:
82
+
83
+ ```shell
84
+ $ ronin-nmap dump --print-uris scan.xml
85
+ ```
86
+
87
+ Convert an nmap XML scan file to CSV:
88
+
89
+ ```shell
90
+ $ ronin-nmap convert scan.xml scan.csv
91
+ ```
92
+
93
+ Convert an nmap XML scan file to JSON:
94
+
95
+ ```shell
96
+ $ ronin-nmap convert scan.xml scan.json
97
+ ```
98
+
99
+ Generate a new nmap scanner Ruby script:
100
+
101
+ ```shell
102
+ $ ronin-nmap new scanner.rb --target example.com --ports 22,80,443,8000-9000
103
+ ```
104
+
105
+ Generate a new nmap XML parser script:
106
+
107
+ ```shell
108
+ $ ronin-nmap new parser.rb --parser --xml-file path/to/nmap.xml --printing
109
+ ```
110
+
111
+ ## Examples
112
+
113
+ Performing an `nmap` scan and returning the parsed nmap XML data:
114
+
115
+ ```ruby
116
+ require 'ronin/nmap'
117
+
118
+ xml = Ronin::Nmap.scan(syn_scan: true, ports: [80, 443], targets: '192.168.1.*')
119
+ # => #<Nmap::XML: ...>
120
+
121
+ xml = Ronin::Nmap.scan do |nmap|
122
+ nmap.syn_scan = true
123
+ nmap.ports = [80, 443]
124
+ nmap.targets = '192.168.1.*'
125
+ end
126
+ # => #<Nmap::XML: ...>
127
+ ```
128
+
129
+ Accessesing the nmap XML scan data:
130
+
131
+ ```ruby
132
+ xml.hosts
133
+ # => [#<Nmap::XML::Host: 192.168.1.1>, ...]
134
+
135
+ host = xml.host
136
+ # => #<Nmap::XML::Host: scanme.nmap.org>
137
+
138
+ xml.host.open_ports
139
+ # => [#<Nmap::XML::Port: 22>,
140
+ # #<Nmap::XML::Port: 80>,
141
+ # #<Nmap::XML::Port: 9929>,
142
+ # #<Nmap::XML::Port: 31337>,
143
+ # #<Nmap::XML::Port: 123>]
144
+
145
+ port = xml.host.open_ports.first
146
+ # => #<Nmap::XML::Port: 22>
147
+
148
+ port.state
149
+ # => :open
150
+
151
+ port.protocol
152
+ # => :tcp
153
+
154
+ port.service
155
+ # => #<Nmap::XML::Service:0x00007f5614e68248 @node=#<Nokogiri::XML::Element:0x7ada0 name="service" attribute_nodes=[#<Nokogiri::XML::Attr:0x7aecc name="name" value="ssh">, #<Nokogiri::XML::Attr:0x7b05c name="extrainfo" value="protocol 2.0">, #<Nokogiri::XML::Attr:0x7b1ec name="servicefp" value="SF-Port22-TCP:V=6.45%I=7%D=4/17%Time=55316FE1%P=x86_64-redhat-linux-gnu%r(NULL,29,\"SSH-2\\.0-OpenSSH_6\\.6\\.1p1\\x20Ubuntu-2ubuntu2\\r\\n\");">, #<Nokogiri::XML::Attr:0x7b37c name="method" value="probed">, #<Nokogiri::XML::Attr:0x7b50c name="conf" value="10">]>>
156
+
157
+ port.scripts
158
+ # => {"ssh-hostkey"=>...,
159
+ # "ssh2-enum-algos"=>...}
160
+ ```
161
+
162
+ Printing the parsed nmap XML data:
163
+
164
+ ```ruby
165
+ xml.each_host do |host|
166
+ puts "[ #{host.ip} ]"
167
+
168
+ host.each_port do |port|
169
+ puts " #{port.number}/#{port.protocol}\t#{port.state}\t#{port.service}"
170
+
171
+ port.scripts.each do |id,script|
172
+ puts " [ #{id} ]"
173
+
174
+ script.output.each_line { |line| puts " #{line}" }
175
+ end
176
+ end
177
+ end
178
+ ```
179
+
180
+ ## Requirements
181
+
182
+ * [Ruby] >= 3.0.0
183
+ * [nmap] >= 5.00
184
+ * [ruby-nmap] ~> 1.0
185
+ * [ronin-core] ~> 0.2
186
+ * [ronin-db] ~> 0.2
187
+
188
+ ## Install
189
+
190
+ ```shell
191
+ $ gem install ronin-nmap
192
+ ```
193
+
194
+ ### Gemfile
195
+
196
+ ```ruby
197
+ gem 'ronin-nmap', '~> 0.1'
198
+ ```
199
+
200
+ ### gemspec
201
+
202
+ ```ruby
203
+ gem.add_dependency 'ronin-nmap', '~> 0.1'
204
+ ```
205
+
206
+ ## Development
207
+
208
+ 1. [Fork It!](https://github.com/ronin-rb/ronin-nmap/fork)
209
+ 2. Clone It!
210
+ 3. `cd ronin-nmap/`
211
+ 4. `./scripts/setup`
212
+ 5. `git checkout -b my_feature`
213
+ 6. Code It!
214
+ 7. `bundle exec rake spec`
215
+ 8. `git push origin my_feature`
216
+
217
+ ## License
218
+
219
+ Copyright (c) 2023-2024 Hal Brodigan (postmodern.mod3@gmail.com)
220
+
221
+ ronin-nmap is free software: you can redistribute it and/or modify
222
+ it under the terms of the GNU Lesser General Public License as published
223
+ by the Free Software Foundation, either version 3 of the License, or
224
+ (at your option) any later version.
225
+
226
+ ronin-nmap is distributed in the hope that it will be useful,
227
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
228
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
229
+ GNU Lesser General Public License for more details.
230
+
231
+ You should have received a copy of the GNU Lesser General Public License
232
+ along with ronin-nmap. If not, see <https://www.gnu.org/licenses/>.
233
+
234
+ [Ruby]: https://www.ruby-lang.org
235
+ [nmap]: http://www.insecure.org/
236
+ [ruby-nmap]: https://github.com/postmodern/ruby-nmap#readme
237
+ [ronin-core]: https://github.com/ronin-rb/ronin-core#readme
238
+ [ronin-db]: https://github.com/ronin-rb/ronin-db#readme
data/Rakefile ADDED
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require 'bundler'
5
+ rescue LoadError => e
6
+ warn e.message
7
+ warn "Run `gem install bundler` to install Bundler"
8
+ exit(-1)
9
+ end
10
+
11
+ begin
12
+ Bundler.setup(:development)
13
+ rescue Bundler::BundlerError => e
14
+ warn e.message
15
+ warn "Run `bundle install` to install missing gems"
16
+ exit e.status_code
17
+ end
18
+
19
+ require 'rake'
20
+
21
+ require 'rubygems/tasks'
22
+ Gem::Tasks.new(sign: {checksum: true, pgp: true})
23
+
24
+ require 'rspec/core/rake_task'
25
+ RSpec::Core::RakeTask.new
26
+ task :test => :spec
27
+ task :default => :spec
28
+
29
+ require 'yard'
30
+ YARD::Rake::YardocTask.new
31
+ task :docs => :yard
32
+
33
+ require 'kramdown/man/task'
34
+ Kramdown::Man::Task.new
35
+
36
+ require 'command_kit/completion/task'
37
+ CommandKit::Completion::Task.new(
38
+ class_file: 'ronin/nmap/cli',
39
+ class_name: 'Ronin::Nmap::CLI',
40
+ output_file: 'data/completions/ronin-nmap'
41
+ )
42
+
43
+ task :setup => %w[man command_kit:completion]
data/bin/ronin-nmap ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ #
6
+ # ronin-nmap is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Lesser General Public License as published
8
+ # by the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # ronin-nmap is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public License
17
+ # along with ronin-nmap. If not, see <https://www.gnu.org/licenses/>.
18
+ #
19
+
20
+ root = File.expand_path(File.join(__dir__,'..'))
21
+ if File.file?(File.join(root,'Gemfile.lock'))
22
+ Dir.chdir(root) do
23
+ require 'bundler/setup'
24
+ rescue LoadError => e
25
+ warn e.message
26
+ warn "Run `gem install bundler` to install Bundler"
27
+ exit(-1)
28
+ end
29
+ end
30
+
31
+ require 'ronin/nmap/cli'
32
+ Ronin::Nmap::CLI.start