ronin-support 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +11 -0
- data/.github/workflows/ruby.yml +28 -0
- data/.ruby-version +1 -0
- data/.yardopts +1 -1
- data/ChangeLog.md +28 -0
- data/Gemfile +6 -7
- data/README.md +53 -32
- data/Rakefile +1 -2
- data/gemspec.yml +16 -7
- data/lib/ronin/binary.rb +5 -5
- data/lib/ronin/binary/hexdump.rb +5 -5
- data/lib/ronin/binary/hexdump/parser.rb +5 -5
- data/lib/ronin/binary/struct.rb +5 -5
- data/lib/ronin/binary/template.rb +7 -7
- data/lib/ronin/extensions.rb +5 -5
- data/lib/ronin/extensions/enumerable.rb +5 -5
- data/lib/ronin/extensions/file.rb +37 -31
- data/lib/ronin/extensions/ip_addr.rb +6 -7
- data/lib/ronin/extensions/kernel.rb +5 -5
- data/lib/ronin/extensions/meta.rb +5 -5
- data/lib/ronin/extensions/regexp.rb +5 -5
- data/lib/ronin/extensions/resolv.rb +5 -5
- data/lib/ronin/extensions/string.rb +5 -5
- data/lib/ronin/formatting.rb +5 -5
- data/lib/ronin/formatting/binary.rb +5 -5
- data/lib/ronin/formatting/digest.rb +5 -5
- data/lib/ronin/formatting/extensions.rb +5 -5
- data/lib/ronin/formatting/extensions/binary.rb +5 -5
- data/lib/ronin/formatting/extensions/binary/array.rb +6 -6
- data/lib/ronin/formatting/extensions/binary/base64.rb +5 -5
- data/lib/ronin/formatting/extensions/binary/file.rb +5 -5
- data/lib/ronin/formatting/extensions/binary/float.rb +6 -6
- data/lib/ronin/formatting/extensions/binary/integer.rb +6 -6
- data/lib/ronin/formatting/extensions/binary/string.rb +6 -6
- data/lib/ronin/formatting/extensions/digest.rb +5 -5
- data/lib/ronin/formatting/extensions/digest/file.rb +5 -5
- data/lib/ronin/formatting/extensions/digest/string.rb +5 -5
- data/lib/ronin/formatting/extensions/html.rb +5 -5
- data/lib/ronin/formatting/extensions/html/integer.rb +5 -5
- data/lib/ronin/formatting/extensions/html/string.rb +7 -7
- data/lib/ronin/formatting/extensions/http.rb +5 -5
- data/lib/ronin/formatting/extensions/http/integer.rb +6 -6
- data/lib/ronin/formatting/extensions/http/string.rb +7 -7
- data/lib/ronin/formatting/extensions/sql.rb +5 -5
- data/lib/ronin/formatting/extensions/sql/string.rb +15 -13
- data/lib/ronin/formatting/extensions/text.rb +5 -5
- data/lib/ronin/formatting/extensions/text/array.rb +5 -5
- data/lib/ronin/formatting/extensions/text/string.rb +5 -5
- data/lib/ronin/formatting/html.rb +5 -5
- data/lib/ronin/formatting/http.rb +5 -5
- data/lib/ronin/formatting/sql.rb +5 -5
- data/lib/ronin/formatting/text.rb +5 -5
- data/lib/ronin/fuzzing.rb +5 -5
- data/lib/ronin/fuzzing/extensions.rb +5 -5
- data/lib/ronin/fuzzing/extensions/string.rb +5 -5
- data/lib/ronin/fuzzing/fuzzer.rb +5 -5
- data/lib/ronin/fuzzing/fuzzing.rb +7 -7
- data/lib/ronin/fuzzing/mutator.rb +5 -5
- data/lib/ronin/fuzzing/repeater.rb +5 -5
- data/lib/ronin/fuzzing/template.rb +5 -5
- data/lib/ronin/mixin.rb +2 -2
- data/lib/ronin/network.rb +5 -5
- data/lib/ronin/network/dns.rb +5 -5
- data/lib/ronin/network/esmtp.rb +5 -5
- data/lib/ronin/network/extensions.rb +5 -5
- data/lib/ronin/network/extensions/dns.rb +5 -5
- data/lib/ronin/network/extensions/dns/net.rb +5 -5
- data/lib/ronin/network/extensions/esmtp.rb +5 -5
- data/lib/ronin/network/extensions/esmtp/net.rb +5 -5
- data/lib/ronin/network/extensions/http.rb +5 -5
- data/lib/ronin/network/extensions/http/net.rb +5 -5
- data/lib/ronin/network/extensions/http/uri/http.rb +5 -5
- data/lib/ronin/network/extensions/imap.rb +5 -5
- data/lib/ronin/network/extensions/imap/net.rb +5 -5
- data/lib/ronin/network/extensions/pop3.rb +5 -5
- data/lib/ronin/network/extensions/pop3/net.rb +5 -5
- data/lib/ronin/network/extensions/smtp.rb +5 -5
- data/lib/ronin/network/extensions/smtp/net.rb +5 -5
- data/lib/ronin/network/extensions/ssl.rb +5 -5
- data/lib/ronin/network/extensions/ssl/net.rb +5 -5
- data/lib/ronin/network/extensions/tcp.rb +5 -5
- data/lib/ronin/network/extensions/tcp/net.rb +5 -5
- data/lib/ronin/network/extensions/telnet.rb +5 -5
- data/lib/ronin/network/extensions/telnet/net.rb +5 -5
- data/lib/ronin/network/extensions/udp.rb +5 -5
- data/lib/ronin/network/extensions/udp/net.rb +5 -5
- data/lib/ronin/network/ftp.rb +5 -5
- data/lib/ronin/network/http.rb +5 -5
- data/lib/ronin/network/http/exceptions.rb +5 -5
- data/lib/ronin/network/http/exceptions/unknown_request.rb +5 -5
- data/lib/ronin/network/http/http.rb +52 -57
- data/lib/ronin/network/http/proxy.rb +5 -5
- data/lib/ronin/network/imap.rb +5 -5
- data/lib/ronin/network/mixins.rb +5 -5
- data/lib/ronin/network/mixins/dns.rb +5 -5
- data/lib/ronin/network/mixins/esmtp.rb +5 -5
- data/lib/ronin/network/mixins/ftp.rb +5 -5
- data/lib/ronin/network/mixins/http.rb +7 -7
- data/lib/ronin/network/mixins/imap.rb +5 -5
- data/lib/ronin/network/mixins/mixin.rb +5 -5
- data/lib/ronin/network/mixins/pop3.rb +5 -5
- data/lib/ronin/network/mixins/smtp.rb +5 -5
- data/lib/ronin/network/mixins/ssl.rb +5 -5
- data/lib/ronin/network/mixins/tcp.rb +5 -5
- data/lib/ronin/network/mixins/telnet.rb +5 -5
- data/lib/ronin/network/mixins/udp.rb +5 -5
- data/lib/ronin/network/mixins/unix.rb +5 -5
- data/lib/ronin/network/network.rb +5 -5
- data/lib/ronin/network/pop3.rb +5 -5
- data/lib/ronin/network/proxy.rb +5 -5
- data/lib/ronin/network/smtp.rb +5 -5
- data/lib/ronin/network/smtp/email.rb +6 -6
- data/lib/ronin/network/smtp/smtp.rb +5 -5
- data/lib/ronin/network/ssl.rb +7 -7
- data/lib/ronin/network/tcp.rb +5 -5
- data/lib/ronin/network/tcp/proxy.rb +5 -5
- data/lib/ronin/network/tcp/tcp.rb +32 -23
- data/lib/ronin/network/telnet.rb +7 -5
- data/lib/ronin/network/udp.rb +5 -5
- data/lib/ronin/network/udp/proxy.rb +5 -5
- data/lib/ronin/network/udp/udp.rb +28 -26
- data/lib/ronin/network/unix.rb +7 -7
- data/lib/ronin/path.rb +32 -36
- data/lib/ronin/spec/ui/output.rb +5 -5
- data/lib/ronin/support.rb +5 -5
- data/lib/ronin/support/inflector.rb +5 -5
- data/lib/ronin/support/support.rb +5 -5
- data/lib/ronin/support/version.rb +6 -6
- data/lib/ronin/templates.rb +5 -5
- data/lib/ronin/templates/erb.rb +5 -5
- data/lib/ronin/templates/template.rb +5 -5
- data/lib/ronin/ui/output.rb +5 -5
- data/lib/ronin/ui/output/helpers.rb +5 -5
- data/lib/ronin/ui/output/output.rb +17 -21
- data/lib/ronin/ui/output/terminal.rb +5 -5
- data/lib/ronin/ui/output/terminal/color.rb +5 -5
- data/lib/ronin/ui/output/terminal/raw.rb +5 -5
- data/lib/ronin/ui/shell.rb +5 -5
- data/lib/ronin/wordlist.rb +7 -7
- data/ronin-support.gemspec +1 -0
- data/spec/binary/hexdump/parser_spec.rb +22 -22
- data/spec/binary/struct_spec.rb +56 -56
- data/spec/binary/template_spec.rb +106 -104
- data/spec/extensions/enumerable_spec.rb +4 -4
- data/spec/extensions/file_spec.rb +12 -14
- data/spec/extensions/ip_addr_spec.rb +30 -30
- data/spec/extensions/kernel_spec.rb +7 -7
- data/spec/extensions/regexp_spec.rb +69 -69
- data/spec/extensions/resolv_spec.rb +2 -2
- data/spec/extensions/string_spec.rb +30 -29
- data/spec/formatting/binary/array_spec.rb +2 -2
- data/spec/formatting/binary/base64_spec.rb +8 -8
- data/spec/formatting/binary/float_spec.rb +6 -4
- data/spec/formatting/binary/integer_spec.rb +25 -25
- data/spec/formatting/binary/string_spec.rb +32 -30
- data/spec/formatting/digest/string_spec.rb +5 -5
- data/spec/formatting/html/integer_spec.rb +6 -6
- data/spec/formatting/html/string_spec.rb +10 -10
- data/spec/formatting/http/integer_spec.rb +3 -3
- data/spec/formatting/http/string_spec.rb +5 -5
- data/spec/formatting/sql/string_spec.rb +21 -19
- data/spec/formatting/text/array_spec.rb +15 -15
- data/spec/formatting/text/string_spec.rb +33 -33
- data/spec/fuzzing/extensions/string_spec.rb +11 -11
- data/spec/fuzzing/fuzzer_spec.rb +15 -15
- data/spec/fuzzing/fuzzing_spec.rb +5 -5
- data/spec/fuzzing/mutator_spec.rb +15 -15
- data/spec/fuzzing/repeater_spec.rb +7 -7
- data/spec/fuzzing/template_spec.rb +11 -11
- data/spec/mixin_spec.rb +10 -12
- data/spec/network/dns_spec.rb +34 -32
- data/spec/network/ftp_spec.rb +9 -9
- data/spec/network/http/http_spec.rb +237 -144
- data/spec/network/http/proxy_spec.rb +37 -37
- data/spec/network/network_spec.rb +1 -1
- data/spec/network/proxy_spec.rb +19 -19
- data/spec/network/smtp/email_spec.rb +14 -14
- data/spec/network/ssl_spec.rb +9 -9
- data/spec/network/tcp/proxy_spec.rb +9 -7
- data/spec/network/tcp/tcp_spec.rb +161 -118
- data/spec/network/telnet_spec.rb +5 -5
- data/spec/network/udp/udp_spec.rb +123 -96
- data/spec/network/unix_spec.rb +24 -25
- data/spec/path_spec.rb +43 -18
- data/spec/spec_helper.rb +0 -1
- data/spec/support/inflector_spec.rb +4 -4
- data/spec/support_spec.rb +1 -1
- data/spec/templates/erb_spec.rb +3 -3
- data/spec/templates/template_spec.rb +10 -10
- data/spec/ui/shell_spec.rb +15 -15
- data/spec/wordlist_spec.rb +19 -19
- metadata +408 -366
- data/.gemtest +0 -0
@@ -1,20 +1,20 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
|
-
# This file is part of
|
4
|
+
# This file is part of ronin-support.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# ronin-support is free software: you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published
|
8
8
|
# by the Free Software Foundation, either version 3 of the License, or
|
9
9
|
# (at your option) any later version.
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# ronin-support is distributed in the hope that it will be useful,
|
12
12
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
13
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
14
|
# GNU Lesser General Public License for more details.
|
15
15
|
#
|
16
16
|
# You should have received a copy of the GNU Lesser General Public License
|
17
|
-
# along with
|
17
|
+
# along with ronin-support. If not, see <https://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
20
|
require 'ronin/network/proxy'
|
@@ -1,20 +1,20 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
|
-
# This file is part of
|
4
|
+
# This file is part of ronin-support.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# ronin-support is free software: you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published
|
8
8
|
# by the Free Software Foundation, either version 3 of the License, or
|
9
9
|
# (at your option) any later version.
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# ronin-support is distributed in the hope that it will be useful,
|
12
12
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
13
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
14
|
# GNU Lesser General Public License for more details.
|
15
15
|
#
|
16
16
|
# You should have received a copy of the GNU Lesser General Public License
|
17
|
-
# along with
|
17
|
+
# along with ronin-support. If not, see <https://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
20
|
require 'socket'
|
@@ -69,11 +69,8 @@ module Ronin
|
|
69
69
|
# send an empty UDP packet, just like nmap
|
70
70
|
socket.syswrite('')
|
71
71
|
|
72
|
-
# send
|
73
|
-
socket.syswrite(
|
74
|
-
|
75
|
-
# test if we've received any data
|
76
|
-
socket.sysread(1)
|
72
|
+
# send an empty UDP packet again, to elicit an Errno::ECONNREFUSED
|
73
|
+
socket.syswrite('')
|
77
74
|
end
|
78
75
|
end
|
79
76
|
|
@@ -118,18 +115,23 @@ module Ronin
|
|
118
115
|
# puts socket.readlines
|
119
116
|
# end
|
120
117
|
#
|
121
|
-
# @see
|
118
|
+
# @see https://rubydoc.info/stdlib/socket/UDPSocket
|
122
119
|
#
|
123
120
|
# @api public
|
124
121
|
#
|
125
122
|
def udp_connect(host,port,local_host=nil,local_port=nil)
|
126
|
-
host
|
127
|
-
port
|
128
|
-
local_host = (local_host || '0.0.0.0').to_s
|
129
|
-
local_port = local_port.to_i
|
123
|
+
host = host.to_s
|
124
|
+
port = port.to_i
|
130
125
|
|
131
126
|
socket = UDPSocket.new
|
132
|
-
|
127
|
+
|
128
|
+
if local_host || local_port
|
129
|
+
local_host = local_host.to_s
|
130
|
+
local_port = local_port.to_i
|
131
|
+
|
132
|
+
socket.bind(local_host,local_port)
|
133
|
+
end
|
134
|
+
|
133
135
|
socket.connect(host,port)
|
134
136
|
|
135
137
|
yield socket if block_given?
|
@@ -288,10 +290,10 @@ module Ronin
|
|
288
290
|
#
|
289
291
|
# Creates a new UDPServer listening on a given host and port.
|
290
292
|
#
|
291
|
-
# @param [Integer] port
|
293
|
+
# @param [Integer] port (nil)
|
292
294
|
# The local port to listen on.
|
293
295
|
#
|
294
|
-
# @param [String] host (
|
296
|
+
# @param [String] host (nil)
|
295
297
|
# The host to bind to.
|
296
298
|
#
|
297
299
|
# @return [UDPServer]
|
@@ -300,13 +302,13 @@ module Ronin
|
|
300
302
|
# @example
|
301
303
|
# udp_server(1337)
|
302
304
|
#
|
303
|
-
# @see
|
305
|
+
# @see https://rubydoc.info/stdlib/socket/UDPSocket
|
304
306
|
#
|
305
307
|
# @api public
|
306
308
|
#
|
307
309
|
def udp_server(port=nil,host=nil)
|
308
310
|
port = port.to_i
|
309
|
-
host =
|
311
|
+
host = host.to_s
|
310
312
|
|
311
313
|
server = UDPSocket.new
|
312
314
|
server.bind(host,port)
|
@@ -318,10 +320,10 @@ module Ronin
|
|
318
320
|
#
|
319
321
|
# Creates a new temporary UDPServer listening on a given host and port.
|
320
322
|
#
|
321
|
-
# @param [Integer] port
|
323
|
+
# @param [Integer] port (nil)
|
322
324
|
# The local port to bind to.
|
323
325
|
#
|
324
|
-
# @param [String] host (
|
326
|
+
# @param [String] host (nil)
|
325
327
|
# The host to bind to.
|
326
328
|
#
|
327
329
|
# @yield [server]
|
@@ -350,10 +352,10 @@ module Ronin
|
|
350
352
|
# Creates a new UDPServer listening on a given host and port,
|
351
353
|
# accepting messages from clients in a loop.
|
352
354
|
#
|
353
|
-
# @param [Integer] port
|
355
|
+
# @param [Integer] port (nil)
|
354
356
|
# The port the UDPServer will listen on.
|
355
357
|
#
|
356
|
-
# @param [String] host
|
358
|
+
# @param [String] host (nil)
|
357
359
|
# The optional host the UDPServer will bind to.
|
358
360
|
#
|
359
361
|
# @yield [server, (client_host, client_port), mesg]
|
@@ -397,10 +399,10 @@ module Ronin
|
|
397
399
|
# Creates a new UDPServer listening on a given host and port,
|
398
400
|
# accepts only one message from a client.
|
399
401
|
#
|
400
|
-
# @param [Integer] port
|
402
|
+
# @param [Integer] port (nil)
|
401
403
|
# The port the UDPServer will listen on.
|
402
404
|
#
|
403
|
-
# @param [String] host
|
405
|
+
# @param [String] host (nil)
|
404
406
|
# The optional host the UDPServer will bind to.
|
405
407
|
#
|
406
408
|
# @yield [server, (client_host, client_port), mesg]
|
data/lib/ronin/network/unix.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
|
-
# This file is part of
|
4
|
+
# This file is part of ronin-support.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# ronin-support is free software: you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published
|
8
8
|
# by the Free Software Foundation, either version 3 of the License, or
|
9
9
|
# (at your option) any later version.
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# ronin-support is distributed in the hope that it will be useful,
|
12
12
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
13
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
14
|
# GNU Lesser General Public License for more details.
|
15
15
|
#
|
16
16
|
# You should have received a copy of the GNU Lesser General Public License
|
17
|
-
# along with
|
17
|
+
# along with ronin-support. If not, see <https://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
20
|
require 'socket'
|
@@ -76,7 +76,7 @@ module Ronin
|
|
76
76
|
# @example
|
77
77
|
# unix_connect('/tmp/haproxy.stats.socket')
|
78
78
|
#
|
79
|
-
# @see
|
79
|
+
# @see https://rubydoc.info/stdlib/socket/UNIXSocket
|
80
80
|
#
|
81
81
|
# @api public
|
82
82
|
#
|
@@ -188,7 +188,7 @@ module Ronin
|
|
188
188
|
# @example
|
189
189
|
# unix_server('/tmp/test.socket')
|
190
190
|
#
|
191
|
-
# @see
|
191
|
+
# @see https://rubydoc.info/stdlib/socket/UNIXServer
|
192
192
|
#
|
193
193
|
# @api public
|
194
194
|
#
|
data/lib/ronin/path.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
|
-
# This file is part of
|
4
|
+
# This file is part of ronin-support.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# ronin-support is free software: you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published
|
8
8
|
# by the Free Software Foundation, either version 3 of the License, or
|
9
9
|
# (at your option) any later version.
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# ronin-support is distributed in the hope that it will be useful,
|
12
12
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
13
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
14
|
# GNU Lesser General Public License for more details.
|
15
15
|
#
|
16
16
|
# You should have received a copy of the GNU Lesser General Public License
|
17
|
-
# along with
|
17
|
+
# along with ronin-support. If not, see <https://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
20
|
require 'pathname'
|
@@ -24,13 +24,24 @@ module Ronin
|
|
24
24
|
# The {Path} class extends `Pathname` to allow representing directory
|
25
25
|
# traversal paths.
|
26
26
|
#
|
27
|
+
# @api public
|
28
|
+
#
|
27
29
|
class Path < Pathname
|
28
30
|
|
29
31
|
# The separator to join paths together with
|
30
32
|
attr_accessor :separator
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
+
#
|
35
|
+
# Initializes a new Path.
|
36
|
+
#
|
37
|
+
# @param [String] path
|
38
|
+
# The path.
|
39
|
+
#
|
40
|
+
# @param [String] separator
|
41
|
+
# The directory separator to use.
|
42
|
+
#
|
43
|
+
def initialize(path,separator=File::SEPARATOR)
|
44
|
+
@separator = separator
|
34
45
|
|
35
46
|
super(path)
|
36
47
|
end
|
@@ -41,8 +52,6 @@ module Ronin
|
|
41
52
|
# @return [Path]
|
42
53
|
# The root path.
|
43
54
|
#
|
44
|
-
# @api public
|
45
|
-
#
|
46
55
|
def Path.root
|
47
56
|
Path.new('/')
|
48
57
|
end
|
@@ -71,23 +80,17 @@ module Ronin
|
|
71
80
|
# # => [#<Ronin::Path:..>, #<Ronin::Path:../..>,
|
72
81
|
# #<Ronin::Path:../../..>]
|
73
82
|
#
|
74
|
-
# @api public
|
75
|
-
#
|
76
83
|
def self.up(n,separator=File::SEPARATOR)
|
77
84
|
case n
|
78
85
|
when Integer
|
79
86
|
if n == 0
|
80
|
-
|
81
|
-
elsif n
|
87
|
+
separator
|
88
|
+
elsif n > 0
|
89
|
+
path = new('..',separator)
|
90
|
+
path.join(*(['..'] * (n-1)))
|
91
|
+
else
|
82
92
|
raise(ArgumentError,"negative argument")
|
83
93
|
end
|
84
|
-
|
85
|
-
path = new('..')
|
86
|
-
path.separator = separator
|
87
|
-
|
88
|
-
dirs = (['..'] * (n-1))
|
89
|
-
|
90
|
-
Path.new(path.join(*dirs))
|
91
94
|
when Enumerable
|
92
95
|
n.map { |i| up(i) }
|
93
96
|
else
|
@@ -109,26 +112,19 @@ module Ronin
|
|
109
112
|
# Path.up(7).join('etc/passwd')
|
110
113
|
# # => #<Ronin::Path:../../../../../../../etc/passwd>
|
111
114
|
#
|
112
|
-
# @api public
|
113
|
-
#
|
114
115
|
def join(*names)
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
names.reject! { |dir| dir == @separator }
|
116
|
+
joined_path = if root? then ''
|
117
|
+
else self.to_s
|
118
|
+
end
|
119
119
|
|
120
|
-
|
121
|
-
|
120
|
+
names.each do |name|
|
121
|
+
name = name.to_s
|
122
122
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
else
|
127
|
-
# join the path with the sub-path
|
128
|
-
[self.to_s, sub_path].join(@separator)
|
129
|
-
end
|
123
|
+
joined_path << @separator unless name.start_with?(@separator)
|
124
|
+
joined_path << name unless name == @separator
|
125
|
+
end
|
130
126
|
|
131
|
-
return self.class.new(
|
127
|
+
return self.class.new(joined_path,@separator)
|
132
128
|
end
|
133
129
|
|
134
130
|
alias / join
|
data/lib/ronin/spec/ui/output.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
|
-
# This file is part of
|
4
|
+
# This file is part of ronin-support.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# ronin-support is free software: you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published
|
8
8
|
# by the Free Software Foundation, either version 3 of the License, or
|
9
9
|
# (at your option) any later version.
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# ronin-support is distributed in the hope that it will be useful,
|
12
12
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
13
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
14
|
# GNU Lesser General Public License for more details.
|
15
15
|
#
|
16
16
|
# You should have received a copy of the GNU Lesser General Public License
|
17
|
-
# along with
|
17
|
+
# along with ronin-support. If not, see <https://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
20
|
require 'ronin/ui/output'
|
data/lib/ronin/support.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
|
-
# This file is part of
|
4
|
+
# This file is part of ronin-support.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# ronin-support is free software: you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published
|
8
8
|
# by the Free Software Foundation, either version 3 of the License, or
|
9
9
|
# (at your option) any later version.
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# ronin-support is distributed in the hope that it will be useful,
|
12
12
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
13
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
14
|
# GNU Lesser General Public License for more details.
|
15
15
|
#
|
16
16
|
# You should have received a copy of the GNU Lesser General Public License
|
17
|
-
# along with
|
17
|
+
# along with ronin-support. If not, see <https://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
20
|
require 'ronin/extensions'
|
@@ -1,20 +1,20 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
|
-
# This file is part of
|
4
|
+
# This file is part of ronin-support.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# ronin-support is free software: you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published
|
8
8
|
# by the Free Software Foundation, either version 3 of the License, or
|
9
9
|
# (at your option) any later version.
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# ronin-support is distributed in the hope that it will be useful,
|
12
12
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
13
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
14
|
# GNU Lesser General Public License for more details.
|
15
15
|
#
|
16
16
|
# You should have received a copy of the GNU Lesser General Public License
|
17
|
-
# along with
|
17
|
+
# along with ronin-support. If not, see <https://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
20
|
module Ronin
|
@@ -1,20 +1,20 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
|
-
# This file is part of
|
4
|
+
# This file is part of ronin-support.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# ronin-support is free software: you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published
|
8
8
|
# by the Free Software Foundation, either version 3 of the License, or
|
9
9
|
# (at your option) any later version.
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# ronin-support is distributed in the hope that it will be useful,
|
12
12
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
13
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
14
|
# GNU Lesser General Public License for more details.
|
15
15
|
#
|
16
16
|
# You should have received a copy of the GNU Lesser General Public License
|
17
|
-
# along with
|
17
|
+
# along with ronin-support. If not, see <https://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
20
|
require 'ronin/ui/output'
|
@@ -1,25 +1,25 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
3
|
#
|
4
|
-
# This file is part of
|
4
|
+
# This file is part of ronin-support.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# ronin-support is free software: you can redistribute it and/or modify
|
7
7
|
# it under the terms of the GNU Lesser General Public License as published
|
8
8
|
# by the Free Software Foundation, either version 3 of the License, or
|
9
9
|
# (at your option) any later version.
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# ronin-support is distributed in the hope that it will be useful,
|
12
12
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
13
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
14
|
# GNU Lesser General Public License for more details.
|
15
15
|
#
|
16
16
|
# You should have received a copy of the GNU Lesser General Public License
|
17
|
-
# along with
|
17
|
+
# along with ronin-support. If not, see <https://www.gnu.org/licenses/>.
|
18
18
|
#
|
19
19
|
|
20
20
|
module Ronin
|
21
21
|
module Support
|
22
22
|
# ronin-support version
|
23
|
-
VERSION = '0.5.
|
23
|
+
VERSION = '0.5.2'
|
24
24
|
end
|
25
25
|
end
|