ruby-nmap 0.9.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. checksums.yaml +5 -5
  2. data/.document +1 -0
  3. data/.editorconfig +11 -0
  4. data/.github/workflows/ruby.yml +31 -0
  5. data/ChangeLog.md +122 -67
  6. data/Gemfile +11 -5
  7. data/LICENSE.txt +1 -1
  8. data/README.md +88 -50
  9. data/Rakefile +8 -3
  10. data/UPGRADING.md +47 -0
  11. data/gemspec.yml +6 -6
  12. data/lib/nmap/command.rb +765 -0
  13. data/lib/nmap/version.rb +1 -1
  14. data/lib/nmap/xml/address.rb +38 -0
  15. data/lib/nmap/xml/cpe/url.rb +80 -0
  16. data/lib/nmap/xml/cpe.rb +47 -0
  17. data/lib/nmap/xml/hop.rb +22 -0
  18. data/lib/nmap/xml/host.rb +546 -0
  19. data/lib/nmap/xml/host_script.rb +26 -0
  20. data/lib/nmap/xml/hostname.rb +44 -0
  21. data/lib/nmap/xml/ip_id_sequence.rb +26 -0
  22. data/lib/nmap/xml/os.rb +131 -0
  23. data/lib/nmap/xml/os_class.rb +86 -0
  24. data/lib/nmap/xml/os_match.rb +22 -0
  25. data/lib/nmap/xml/port.rb +114 -0
  26. data/lib/nmap/xml/postscript.rb +26 -0
  27. data/lib/nmap/xml/prescript.rb +26 -0
  28. data/lib/nmap/xml/run_stat.rb +22 -0
  29. data/lib/nmap/xml/scan.rb +38 -0
  30. data/lib/nmap/xml/scan_task.rb +55 -0
  31. data/lib/nmap/xml/scanner.rb +22 -0
  32. data/lib/nmap/xml/script.rb +110 -0
  33. data/lib/nmap/xml/scripts.rb +33 -0
  34. data/lib/nmap/xml/sequence.rb +52 -0
  35. data/lib/nmap/xml/service.rb +172 -0
  36. data/lib/nmap/xml/status.rb +22 -0
  37. data/lib/nmap/xml/tcp_sequence.rb +48 -0
  38. data/lib/nmap/xml/tcp_ts_sequence.rb +26 -0
  39. data/lib/nmap/xml/traceroute.rb +73 -0
  40. data/lib/nmap/xml/uptime.rb +22 -0
  41. data/lib/nmap/xml.rb +46 -44
  42. data/ruby-nmap.gemspec +38 -83
  43. data/spec/command_spec.rb +726 -0
  44. data/spec/fixtures/down_host_scan.xml +16 -0
  45. data/spec/{local_scan.xml → fixtures/local_scan.xml} +1 -1
  46. data/spec/{scan.xml → fixtures/scan.xml} +1 -1
  47. data/spec/spec_helper.rb +2 -2
  48. data/spec/{address_spec.rb → xml/address_spec.rb} +2 -2
  49. data/spec/{cpe → xml/cpe}/url_spec.rb +1 -1
  50. data/spec/{cpe_examples.rb → xml/cpe_examples.rb} +1 -1
  51. data/spec/{hop_spec.rb → xml/hop_spec.rb} +2 -2
  52. data/spec/{host_script_spec.rb → xml/host_script_spec.rb} +2 -2
  53. data/spec/{host_spec.rb → xml/host_spec.rb} +12 -8
  54. data/spec/{hostname_spec.rb → xml/hostname_spec.rb} +2 -2
  55. data/spec/{ip_id_sequence_spec.rb → xml/ip_id_sequence_spec.rb} +3 -3
  56. data/spec/{os_class_spec.rb → xml/os_class_spec.rb} +3 -3
  57. data/spec/{os_match_spec.rb → xml/os_match_spec.rb} +2 -2
  58. data/spec/{os_spec.rb → xml/os_spec.rb} +3 -3
  59. data/spec/{port_spec.rb → xml/port_spec.rb} +10 -5
  60. data/spec/{postscript_spec.rb → xml/postscript_spec.rb} +2 -2
  61. data/spec/{prescript_spec.rb → xml/prescript_spec.rb} +2 -2
  62. data/spec/{run_stat_spec.rb → xml/run_stat_spec.rb} +2 -2
  63. data/spec/{scan_spec.rb → xml/scan_spec.rb} +2 -2
  64. data/spec/{scan_task_spec.rb → xml/scan_task_spec.rb} +6 -6
  65. data/spec/{scanner_spec.rb → xml/scanner_spec.rb} +3 -3
  66. data/spec/xml/script_spec.rb +137 -0
  67. data/spec/xml/scripts_examples.rb +19 -0
  68. data/spec/{sequence_examples.rb → xml/sequence_examples.rb} +1 -0
  69. data/spec/{service_spec.rb → xml/service_spec.rb} +31 -5
  70. data/spec/{status_spec.rb → xml/status_spec.rb} +4 -3
  71. data/spec/{tcp_sequence_spec.rb → xml/tcp_sequence_spec.rb} +3 -3
  72. data/spec/{tcp_ts_sequence_spec.rb → xml/tcp_ts_sequence_spec.rb} +3 -3
  73. data/spec/{traceroute_spec.rb → xml/traceroute_spec.rb} +3 -3
  74. data/spec/{uptime_spec.rb → xml/uptime_spec.rb} +2 -2
  75. data/spec/xml_spec.rb +93 -45
  76. metadata +78 -99
  77. data/.travis.yml +0 -14
  78. data/lib/nmap/address.rb +0 -34
  79. data/lib/nmap/cpe/url.rb +0 -78
  80. data/lib/nmap/cpe.rb +0 -45
  81. data/lib/nmap/hop.rb +0 -20
  82. data/lib/nmap/host.rb +0 -586
  83. data/lib/nmap/host_script.rb +0 -18
  84. data/lib/nmap/hostname.rb +0 -42
  85. data/lib/nmap/ip_id_sequence.rb +0 -24
  86. data/lib/nmap/os.rb +0 -127
  87. data/lib/nmap/os_class.rb +0 -82
  88. data/lib/nmap/os_match.rb +0 -18
  89. data/lib/nmap/port.rb +0 -99
  90. data/lib/nmap/postscript.rb +0 -16
  91. data/lib/nmap/prescript.rb +0 -16
  92. data/lib/nmap/program.rb +0 -102
  93. data/lib/nmap/run_stat.rb +0 -20
  94. data/lib/nmap/scan.rb +0 -34
  95. data/lib/nmap/scan_task.rb +0 -50
  96. data/lib/nmap/scanner.rb +0 -18
  97. data/lib/nmap/scripts.rb +0 -71
  98. data/lib/nmap/sequence.rb +0 -50
  99. data/lib/nmap/service.rb +0 -170
  100. data/lib/nmap/status.rb +0 -18
  101. data/lib/nmap/task.rb +0 -381
  102. data/lib/nmap/tcp_sequence.rb +0 -46
  103. data/lib/nmap/tcp_ts_sequence.rb +0 -22
  104. data/lib/nmap/traceroute.rb +0 -71
  105. data/lib/nmap/uptime.rb +0 -20
  106. data/spec/scripts_examples.rb +0 -35
  107. data/spec/task_spec.rb +0 -150
data/lib/nmap/sequence.rb DELETED
@@ -1,50 +0,0 @@
1
- module Nmap
2
- #
3
- # Base class for all Sequence classes.
4
- #
5
- # @since 0.5.0
6
- #
7
- class Sequence
8
-
9
- #
10
- # Creates a new sequence object.
11
- #
12
- # @param [Nokogiri::XML::Node] node
13
- # The node that contains the sequence information.
14
- #
15
- # @since 0.5.0
16
- #
17
- def initialize(node)
18
- @node = node
19
- end
20
-
21
- #
22
- # The description of the sequence.
23
- #
24
- # @return [String]
25
- # The sequence class from nmap.
26
- #
27
- # @since 0.5.0
28
- #
29
- def description
30
- @description ||= @node['class']
31
- end
32
-
33
- #
34
- # The values within the sequence.
35
- #
36
- # @return [Array<Numeric>]
37
- # A sample of sequence numbers taken by nmap.
38
- #
39
- # @since 0.5.0
40
- #
41
- def values
42
- @values ||= if @node['values']
43
- @node['values'].split(',').map { |value| value.to_i(16) }
44
- else
45
- []
46
- end
47
- end
48
-
49
- end
50
- end
data/lib/nmap/service.rb DELETED
@@ -1,170 +0,0 @@
1
- require 'nmap/cpe'
2
-
3
- module Nmap
4
- #
5
- # Wraps a `service` XML element.
6
- #
7
- # @since 0.6.0
8
- #
9
- class Service
10
-
11
- include CPE
12
-
13
- #
14
- # Creates a new OS object.
15
- #
16
- # @param [Nokogiri::XML::Node] node
17
- # The node that contains the OS guessing information.
18
- #
19
- def initialize(node)
20
- @node = node
21
- end
22
-
23
- #
24
- # The name of the service.
25
- #
26
- # @return [String]
27
- # The service name.
28
- #
29
- def name
30
- @name ||= @node.get_attribute('name')
31
- end
32
-
33
- #
34
- # Determines if the service requires SSL.
35
- #
36
- # @return [Boolean]
37
- # Checks whether the `tunnel` XML attribute is `ssl`.
38
- #
39
- # @since 0.7.0
40
- #
41
- def ssl?
42
- (@ssl ||= @node['tunnel']) == 'ssl'
43
- end
44
-
45
- #
46
- # The application protocol used by the service.
47
- #
48
- # @return [String]
49
- # The `proto` XML attribute.
50
- #
51
- # @since 0.7.0
52
- #
53
- def protocol
54
- @protocol ||= @node['proto']
55
- end
56
-
57
- #
58
- # The product of the service.
59
- #
60
- # @return [String]
61
- # The product name.
62
- #
63
- def product
64
- @product ||= @node.get_attribute('product')
65
- end
66
-
67
- #
68
- # The version of the service.
69
- #
70
- # @return [String]
71
- # The service version.
72
- #
73
- def version
74
- @version ||= @node.get_attribute('version')
75
- end
76
-
77
- #
78
- # The extra information from the service scan.
79
- #
80
- # @return [String]
81
- # The `extrainfo` XML attribute.
82
- #
83
- # @since 0.7.0
84
- #
85
- def extra_info
86
- @extra_info ||= @node['extrainfo']
87
- end
88
-
89
- #
90
- # The hostname reported by the service.
91
- #
92
- # @return [String]
93
- # The reported hostname.
94
- #
95
- def hostname
96
- @hostname ||= @node.get_attribute('hostname')
97
- end
98
-
99
- #
100
- # The reported OS type.
101
- #
102
- # @return [String]
103
- # The `ostype` XML attribute.
104
- #
105
- # @since 0.7.0
106
- #
107
- def os_type
108
- @os_type ||= @node['ostype']
109
- end
110
-
111
- #
112
- # The reported device type.
113
- #
114
- # @return [String]
115
- # The `devicetype` XML attribute.
116
- #
117
- # @since 0.7.0
118
- #
119
- def device_type
120
- @device_type ||= @node['devicetype']
121
- end
122
-
123
- #
124
- # The fingerprint method used to identify the service.
125
- #
126
- # @return [Symbol]
127
- # The fingerprint method.
128
- #
129
- def fingerprint_method
130
- @fingerprint_method ||= @node.get_attribute('method').to_sym
131
- end
132
-
133
- #
134
- # The actual fingerprint
135
- #
136
- # @return [String]
137
- # The fingerprint
138
- #
139
- # @since 0.7.0
140
- #
141
- def fingerprint
142
- @fingerprint ||= @node.get_attribute('servicefp')
143
- end
144
-
145
- #
146
- # The confidence score of the service fingerprinting.
147
- #
148
- # @return [Integer]
149
- # The confidence score.
150
- #
151
- def confidence
152
- @confidence ||= @node.get_attribute('conf').to_i
153
- end
154
-
155
- #
156
- # Converts the service to a String.
157
- #
158
- # @return [String]
159
- # String containing {#product} and {#version}, or {#name}.
160
- #
161
- def to_s
162
- if (product && version)
163
- "#{product} #{version}"
164
- else
165
- name
166
- end
167
- end
168
-
169
- end
170
- end
data/lib/nmap/status.rb DELETED
@@ -1,18 +0,0 @@
1
- module Nmap
2
- #
3
- # Represents the Status of a {Host}.
4
- #
5
- class Status < Struct.new(:state, :reason)
6
-
7
- #
8
- # Converts the status to a String.
9
- #
10
- # @return [String]
11
- # The state.
12
- #
13
- def to_s
14
- self.state.to_s
15
- end
16
-
17
- end
18
- end
data/lib/nmap/task.rb DELETED
@@ -1,381 +0,0 @@
1
- require 'rprogram/task'
2
-
3
- module Nmap
4
- #
5
- # ## Nmap options:
6
- #
7
- # ### Target Specifications:
8
- #
9
- # * `-iL` - `nmap.target_file`
10
- # * `-iR` - `nmap.random_targets`
11
- # * `--exclude` - `nmap.exclude`
12
- # * `--excludefile` - `nmap.exclude_file`
13
- #
14
- # ### Host Discovery:
15
- #
16
- # * `-sL` - `nmap.list`
17
- # * `-sn` - `nmap.ping`
18
- # * `-Pn` - `nmap.skip_discovery`
19
- # * `-PS` - `nmap.syn_discovery`
20
- # * `-PA` - `nmap.ack_discovery`
21
- # * `-PU` - `nmap.udp_discovery`
22
- # * '-PY' - `nmap.sctp_init_ping`
23
- # * `-PE` - `nmap.icmp_echo_discovery`
24
- # * `-PP` - `nmap.icmp_timestamp_discovery`
25
- # * `-PM` - `nmap.icmp_netmask_discovery`
26
- # * `-PO` - `nmap.ip_ping`
27
- # * `-PR` - `nmap.arp_ping`
28
- # * `--traceroute` - `nmap.traceroute`
29
- # * `-n` - `nmap.disable_dns`
30
- # * `-R` - `nmap.enable_dns`
31
- # * `--systems-dns` - `nmap.systems_dns`
32
- # * `--dns-servers` - `nmap.dns_servers`
33
- #
34
- # ### Port Scanning Techniques:
35
- #
36
- # * `-sS` - `nmap.syn_scan`
37
- # * `-sT` - `nmap.connect_scan`
38
- # * `-sU` - `nmap.udp_scan`
39
- # * `-sY` - `nmap.sctp_init_scan`
40
- # * `-sN` - `nmap.null_scan`
41
- # * `-sF` - `nmap.fin_scan`
42
- # * `-sX` - `nmap.xmas_scan`
43
- # * `-sA` - `nmap.ack_scan`
44
- # * `-sW` - `nmap.window_scan`
45
- # * `-sM` - `nmap.maimon_scan`
46
- # * `--scanflags` - `nmap.tcp_scan_flags`
47
- # * `-sZ` - `nmap.sctp_cookie_echo_scan`
48
- # * `-sI` - `nmap.idle_scan`
49
- # * `-sO` - `nmap.ip_scan`
50
- # * `-b` - `nmap.ftp_bounce_scan`
51
- #
52
- # ### Port Specification and Scan Order:
53
- #
54
- # * `-p` - `nmap.ports`
55
- # * `-F` - `nmap.fast`
56
- # * `-r` - `nmap.consecutively`
57
- # * `--top-ports` - `nmap.top_ports`
58
- # * `--port-ratio` - `nmap.port_ratio`
59
- #
60
- # ### Service/Version Detection:
61
- #
62
- # * `-sV` - `nmap.service_scan`
63
- # * `--allports` - `nmap.all_ports`
64
- # * `--version-intensity` - `nmap.version_intensity`
65
- # * `--version-light` - `nmap.version_light`
66
- # * `--version-all` - `nmap.version_all`
67
- # * `--version-trace` - `nmap.version_trace`
68
- # * `-sR` - `nmap.rpc_scan`
69
- #
70
- # ### Script Scan:
71
- #
72
- # * `-sC` - `nmap.default_script`
73
- # * `--script` - `nmap.script`
74
- # * `--script-args` - `nmap.script_params`
75
- # * `--script-trace` - `nmap.script_trace`
76
- # * `--script-updatedb` - `nmap.update_scriptdb`
77
- #
78
- # ### OS Detection:
79
- #
80
- # * `-O` - `nmap.os_fingerprint`
81
- # * `--osscan-limit` - `nmap.limit_os_scan`
82
- # * `--osscan-guess` - `nmap.max_os_scan`
83
- #
84
- # ### Timing and Performance:
85
- #
86
- # * `--min-hostgroup` - `nmap.min_host_group`
87
- # * `--max-hostgroup` - `nmap.max_host_group`
88
- # * `--min-parallelism` - `nmap.min_parallelism`
89
- # * `--max-parallelism` - `nmap.max_parallelism`
90
- # * `--min-rtt-timeout` - `nmap.min_rtt_timeout`
91
- # * `--max-rtt-timeout` - `nmap.max_rtt_timeout`
92
- # * `--max-retries` - `nmap.max_retries`
93
- # * `--host-timeout` - `nmap.host_timeout`
94
- # * `--scan-delay` - `nmap.scan_delay`
95
- # * `--max-scan-delay` - `nmap.max_scan_delay`
96
- # * `--min-rate` - `nmap.min_rate`
97
- # * `--max-rate` - `nmap.max_rate`
98
- # * `--defeat-rst-ratelimit` - `nmap.defeat_rst_ratelimit`
99
- # * `--defeat-icmp-ratelimit` - `nmap.defeat_icmp_ratelimit`
100
- # * `--nsock-engine` - `nmap.nsock_engine`
101
- # * `-T` - `nmap.timing_template`
102
- # * `-T0` - `nmap.paranoid_timing`
103
- # * `-T1` - `nmap.sneaky_timing`
104
- # * `-T2` - `nmap.polite_timing`
105
- # * `-T3` - `nmap.normal_timing`
106
- # * `-T4` - `nmap.aggressive_timing`
107
- # * `-T5` - `nmap.insane_timing`
108
- #
109
- # ### Firewall/IDS Evasion and Spoofing:
110
- #
111
- # * `-f` - `nmap.packet_fragments`
112
- # * `--mtu` - `nmap.mtu`
113
- # * `-D` - `nmap.decoys`
114
- # * `-S` - `nmap.spoof`
115
- # * `-e` - `nmap.interface`
116
- # * `-g` - `nmap.source_port`
117
- # * `--data-length` - `nmap.data_length`
118
- # * `--ip-options` - `nmap.ip_options`
119
- # * `--ttl` - `nmap.ttl`
120
- # * `--randomize-hosts` - `nmap.randomize_hosts`
121
- # * `--spoof-mac` - `nmap.spoof_mac`
122
- # * `--badsum` - `nmap.bad_checksum`
123
- # * `--adler32` - `nmap.sctp_adler32`
124
- #
125
- # ### Output:
126
- #
127
- # * `-oN` - `nmap.save`
128
- # * `-oX` - `nmap.xml`
129
- # * `-oS` - `nmap.skiddie`
130
- # * `-oG` - `nmap.grepable`
131
- # * `-oA` - `nmap.output_all`
132
- #
133
- # ### Verbosity and Debugging:
134
- #
135
- # * `-v` - `nmap.verbose`
136
- # * `-v0` - `nmap.quiet`
137
- # * `-d` - `nmap.debug`
138
- # * `--reason` - `nmap.show_reason`
139
- # * `--stats-every` - `nmap.stats_every`
140
- # * `--packet-trace` - `nmap.show_packets`
141
- # * `--open` - `nmap.show_open_ports`
142
- # * `--iflist` - `nmap.show_interfaces`
143
- # * `--log-errors` - `nmap.show_log_errors`
144
- #
145
- # ### Miscellaneous Output:
146
- #
147
- # * `--append-output` - `nmap.append`
148
- # * `--resume` - `nmap.resume`
149
- # * `--stylesheet` - `nmap.stylesheet`
150
- # * `--webxml` - `nmap.nmap_stylesheet`
151
- # * `--no-stylesheet` - `nmap.disable_stylesheet`
152
- #
153
- # ### Misc:
154
- #
155
- # * `-6` - `nmap.ipv6`
156
- # * `-A` - `nmap.all`
157
- # * `--datadir` - `nmap.nmap_datadir`
158
- # * `--servicedb` - `nmap.servicedb`
159
- # * `--versiondb` - `nmap.versiondb`
160
- # * `--send-eth` - `nmap.raw_ethernet`
161
- # * `--send-ip` - `nmap.raw_ip`
162
- # * `--privileged` - `nmap.privileged`
163
- # * `--unprivileged` - `nmap.unprivileged`
164
- # * `--release-memory` - `nmap.release_memory`
165
- # * `--interactive` - `nmap.interactive`
166
- # * `-V` - `nmap.version`
167
- # * `-h` - `nmap.help`
168
- #
169
- # * `target specification` - `nmap.targets`
170
- #
171
- # @see http://nmap.org/book/man.html
172
- #
173
- class Task < RProgram::Task
174
-
175
- # TARGET SPECIFICATIONS:
176
- short_option :flag => '-iL', :name => :target_file
177
- short_option :flag => '-iR', :name => :random_targets
178
- long_option :flag => '--exclude', :name => :exclude, :separator => ','
179
- long_option :flag => '--excludefile', :name => :exclude_file
180
-
181
- # HOST DISCOVERY:
182
- short_option :flag => '-sL', :name => :list
183
- short_option :flag => '-sn', :name => :ping
184
- short_option :flag => '-Pn', :name => :skip_discovery
185
- short_option :flag => '-PS', :name => :syn_discovery do |opt,value|
186
- ["#{opt.flag}#{format_port_list(value)}"]
187
- end
188
- short_option :flag => '-PA', :name => :ack_discovery do |opt,value|
189
- ["#{opt.flag}#{format_port_list(value)}"]
190
- end
191
- short_option :flag => '-PU', :name => :udp_discovery do |opt,value|
192
- ["#{opt.flag}#{format_port_list(value)}"]
193
- end
194
- short_option :flag => '-PY', :name => :sctp_init_ping do |opt,value|
195
- ["#{opt.flag}#{format_port_list(value)}"]
196
- end
197
- short_option :flag => '-PE', :name => :icmp_echo_discovery
198
- short_option :flag => '-PP', :name => :icmp_timestamp_discovery
199
- short_option :flag => '-PM', :name => :icmp_netmask_discovery
200
- short_option :flag => '-PO', :name => :ip_ping do |opt,value|
201
- ["#{opt.flag}#{format_protocol_list(value)}"]
202
- end
203
- short_option :flag => '-PR', :name => :arp_ping
204
- long_option :flag => '--traceroute', :name => :traceroute
205
- short_option :flag => '-n', :name => :disable_dns
206
- short_option :flag => '-R', :name => :enable_dns
207
- long_option :flag => '--dns-servers', :separator => ','
208
- long_option :flag => '--system-dns'
209
-
210
- # PORT SCANNING TECHNIQUES:
211
- short_option :flag => '-sS', :name => :syn_scan
212
- short_option :flag => '-sT', :name => :connect_scan
213
- short_option :flag => '-sU', :name => :udp_scan
214
- short_option :flag => '-sY', :name => :sctp_init_scan
215
- short_option :flag => '-sN', :name => :null_scan
216
- short_option :flag => '-sF', :name => :fin_scan
217
- short_option :flag => '-sX', :name => :xmas_scan
218
- short_option :flag => '-sA', :name => :ack_scan
219
- short_option :flag => '-sW', :name => :window_scan
220
- short_option :flag => '-sM', :name => :maimon_scan
221
- long_option :flag => '--scanflags', :name => :tcp_scan_flags
222
- short_option :flag => '-sZ', :name => :sctp_cookie_echo_scan
223
- short_option :flag => '-sI', :name => :idle_scan
224
- short_option :flag => '-sO', :name => :ip_scan
225
- short_option :flag => '-b', :name => :ftp_bounce_scan
226
-
227
- # PORT SPECIFICATION AND SCAN ORDER:
228
- short_option :flag => '-p', :name => :ports do |opt,value|
229
- unless value.empty?
230
- [opt.flag, format_port_list(value)]
231
- end
232
- end
233
- short_option :flag => '-F', :name => :fast
234
- short_option :flag => '-r', :name => :consecutively
235
- long_option :flag => '--top-ports'
236
- long_option :flag => '--port-ratio'
237
-
238
- # SERVICE/VERSION DETECTION:
239
- short_option :flag => '-sV', :name => :service_scan
240
- long_option :flag => '--allports', :name => :all_ports
241
- long_option :flag => '--version-intensity'
242
- long_option :flag => '--version-light'
243
- long_option :flag => '--version-all'
244
- long_option :flag => '--version-trace'
245
- short_option :flag => '-sR', :name => :rpc_scan
246
-
247
- # SCRIPT SCAN:
248
- short_option :flag => '-sC', :name => :default_script
249
- long_option :flag => '--script', :separator => ','
250
- long_option :flag => '--script-args', :separator => ','
251
- alias script_params script_args
252
- alias script_params= script_args=
253
- long_option :flag => '--script-trace'
254
- long_option :flag => '--script-updatedb', :name => :update_scriptdb
255
-
256
- # OS DETECTION:
257
- short_option :flag => '-O', :name => :os_fingerprint
258
- long_option :flag => '--osscan-limit', :name => :limit_os_scan
259
- long_option :flag => '--osscan-guess', :name => :max_os_scan
260
- long_option :flag => '--max-os-tries', :name => :max_os_tries
261
-
262
- # TIMING AND PERFORMANCE:
263
- long_option :flag => '--min-hostgroup', :name => :min_host_group
264
- long_option :flag => '--max-hostgroup', :name => :max_host_group
265
- long_option :flag => '--min-parallelism'
266
- long_option :flag => '--max-parallelism'
267
- long_option :flag => '--min-rtt-timeout'
268
- long_option :flag => '--max-rtt-timeout'
269
- long_option :flag => '--max-retries'
270
- long_option :flag => '--host-timeout'
271
- long_option :flag => '--scan-delay'
272
- long_option :flag => '--max-scan-delay'
273
- long_option :flag => '--min-rate'
274
- long_option :flag => '--max-rate'
275
- long_option :flag => '--defeat-rst-ratelimit'
276
- long_option :flag => '--defeat-icmp-ratelimit'
277
- long_option :flag => '--nsock-engine'
278
- short_option :flag => '-T', :name => :timing_template
279
- short_option :flag => '-T0', :name => :paranoid_timing
280
- short_option :flag => '-T1', :name => :sneaky_timing
281
- short_option :flag => '-T2', :name => :polite_timing
282
- short_option :flag => '-T3', :name => :normal_timing
283
- short_option :flag => '-T4', :name => :aggressive_timing
284
- short_option :flag => '-T5', :name => :insane_timing
285
-
286
- # FIREWALL/IDS EVASION AND SPOOFING:
287
- short_option :flag => '-f', :name => :packet_fragments
288
- long_option :flag => '--mtu'
289
- short_option :flag => '-D', :name => :decoys, :separator => ','
290
- short_option :flag => '-S', :name => :spoof
291
- short_option :flag => '-e', :name => :interface
292
- short_option :flag => '-g', :name => :source_port
293
- long_option :flag => '--data-length'
294
- long_option :flag => '--ip-options'
295
- long_option :flag => '--ttl'
296
- long_option :flag => '--randomize-hosts'
297
- long_option :flag => '--spoof-mac'
298
- long_option :flag => '--badsum', :name => :bad_checksum
299
- long_option :flag => '--adler32', :name => :sctp_adler32
300
-
301
- # OUTPUT:
302
- short_option :flag => '-oN', :name => :save
303
- short_option :flag => '-oX', :name => :xml
304
- short_option :flag => '-oS', :name => :skiddie
305
- short_option :flag => '-oG', :name => :grepable
306
- short_option :flag => '-oA', :name => :output_all
307
-
308
- # Verbosity and Debugging:
309
- short_option :flag => '-v', :name => :verbose
310
- short_option :flag => '-v0', :name => :quiet
311
- short_option :flag => '-d', :name => :debug
312
- long_option :flag => '--reason', :name => :show_reason
313
- long_option :flag => '--stats-every'
314
- long_option :flag => '--packet-trace', :name => :show_packets
315
- long_option :flag => '--open', :name => :show_open_ports
316
- long_option :flag => '--iflist', :name => :show_interfaces
317
- long_option :flag => '--log-errors', :name => :show_log_errors
318
-
319
- # Miscellaneous output:
320
- long_option :flag => '--append-output', :name => :append
321
- long_option :flag => '--resume'
322
- long_option :flag => '--stylesheet'
323
- long_option :flag => '--webxml', :name => :nmap_stylesheet
324
- long_option :flag => '--no-stylesheet', :name => :disable_stylesheet
325
-
326
- # MISC:
327
- short_option :flag => '-6', :name => :ipv6
328
- short_option :flag => '-A', :name => :all
329
- long_option :flag => '--datadir', :name => :nmap_datadir
330
- long_option :flag => '--servicedb'
331
- long_option :flag => '--versiondb'
332
- long_option :flag => '--send-eth', :name => :raw_ethernet
333
- long_option :flag => '--send-ip', :name => :raw_ip
334
- long_option :flag => '--privileged'
335
- long_option :flag => '--unprivleged'
336
- long_option :flag => '--release-memory'
337
- long_option :flag => '--interactive'
338
- short_option :flag => '-V', :name => :version
339
- short_option :flag => '-h', :name => :help
340
-
341
- non_option :tailing => true, :name => :targets
342
-
343
- private
344
-
345
- #
346
- # Fomats a port list.
347
- #
348
- # @param [Array<Integer,Range>] ports
349
- # The port ranges.
350
- #
351
- # @return [String]
352
- # Comma separated string.
353
- #
354
- def self.format_port_list(ports)
355
- ports.map { |port|
356
- case port
357
- when Range
358
- "#{port.first}-#{port.last}"
359
- else
360
- port.to_s
361
- end
362
- }.join(',')
363
- end
364
-
365
- #
366
- # Formats a protocol list.
367
- #
368
- # @param [Array<Integer,Range>] protocols
369
- # The IP protocol numbers.
370
- #
371
- # @return [String]
372
- # Comma separated string.
373
- #
374
- def self.format_protocol_list(protocols)
375
- # NOTE: the man page says the protocol list is similar to the format of
376
- # a port range.
377
- format_port_list(protocols)
378
- end
379
-
380
- end
381
- end
@@ -1,46 +0,0 @@
1
- require 'nmap/sequence'
2
-
3
- module Nmap
4
- #
5
- # Represents a TCP sequence number.
6
- #
7
- # @since 0.5.0
8
- #
9
- class TcpSequence < Sequence
10
-
11
- #
12
- # @return [Numeric]
13
- # The difficulty index from nmap
14
- #
15
- # @since 0.5.0
16
- #
17
- def index
18
- @index ||= if (index_string = @node['index'])
19
- index_string.to_i
20
- end
21
- end
22
-
23
- #
24
- # @return [String]
25
- # The difficulty description from nmap
26
- #
27
- # @since 0.5.0
28
- #
29
- def difficulty
30
- @difficulty ||= @node['difficulty']
31
- end
32
-
33
- #
34
- # Converts the TcpSequence class to a String.
35
- #
36
- # @return [String]
37
- # The String form of the object.
38
- #
39
- # @since 0.5.0
40
- #
41
- def to_s
42
- "index=#{index} difficulty=#{difficulty.inspect} values=#{values.inspect}"
43
- end
44
-
45
- end
46
- end
@@ -1,22 +0,0 @@
1
- require 'nmap/sequence'
2
-
3
- module Nmap
4
- #
5
- # Represents a TCP timestamp.
6
- #
7
- class TcpTsSequence < Sequence
8
-
9
- #
10
- # Converts the TcpTsSequence class to a String.
11
- #
12
- # @return [String]
13
- # The String form of the object.
14
- #
15
- # @since 0.5.0
16
- #
17
- def to_s
18
- "description=#{description.inspect} values=#{values.inspect}"
19
- end
20
-
21
- end
22
- end