ronin-support 0.4.1 → 0.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +75 -32
- data/Gemfile +17 -18
- data/README.md +9 -10
- data/Rakefile +10 -2
- data/gemspec.yml +1 -1
- data/lib/ronin/binary.rb +21 -0
- data/lib/ronin/binary/hexdump.rb +20 -0
- data/lib/ronin/binary/hexdump/parser.rb +411 -0
- data/lib/ronin/binary/struct.rb +579 -0
- data/lib/ronin/binary/template.rb +437 -0
- data/lib/ronin/extensions/ip_addr.rb +17 -13
- data/lib/ronin/extensions/regexp.rb +45 -0
- data/lib/ronin/extensions/string.rb +3 -3
- data/lib/ronin/formatting/extensions/binary.rb +1 -0
- data/lib/ronin/formatting/extensions/binary/array.rb +63 -0
- data/lib/ronin/formatting/extensions/binary/base64.rb +106 -0
- data/lib/ronin/formatting/extensions/binary/file.rb +39 -6
- data/lib/ronin/formatting/extensions/binary/float.rb +65 -0
- data/lib/ronin/formatting/extensions/binary/integer.rb +56 -43
- data/lib/ronin/formatting/extensions/binary/string.rb +75 -187
- data/lib/ronin/formatting/extensions/text/string.rb +61 -0
- data/lib/ronin/fuzzing/extensions/string.rb +21 -8
- data/lib/ronin/fuzzing/fuzzing.rb +19 -17
- data/lib/ronin/network.rb +2 -1
- data/lib/ronin/network/dns.rb +57 -15
- data/lib/ronin/network/extensions.rb +0 -1
- data/lib/ronin/network/ftp.rb +145 -0
- data/lib/ronin/network/http/http.rb +13 -14
- data/lib/ronin/network/imap.rb +11 -10
- data/lib/ronin/network/mixins.rb +1 -0
- data/lib/ronin/network/mixins/ftp.rb +155 -0
- data/lib/ronin/network/mixins/ssl.rb +1 -1
- data/lib/ronin/network/mixins/tcp.rb +39 -6
- data/lib/ronin/network/mixins/udp.rb +121 -1
- data/lib/ronin/network/mixins/unix.rb +279 -0
- data/lib/ronin/network/pop3.rb +5 -5
- data/lib/ronin/network/proxy.rb +578 -0
- data/lib/ronin/network/smtp/email.rb +1 -1
- data/lib/ronin/network/smtp/smtp.rb +7 -8
- data/lib/ronin/network/ssl.rb +1 -6
- data/lib/ronin/network/tcp.rb +2 -305
- data/lib/ronin/network/tcp/proxy.rb +377 -0
- data/lib/ronin/network/tcp/tcp.rb +435 -0
- data/lib/ronin/network/telnet.rb +27 -23
- data/lib/ronin/network/udp.rb +2 -266
- data/lib/ronin/network/udp/proxy.rb +169 -0
- data/lib/ronin/network/udp/udp.rb +442 -0
- data/lib/ronin/network/unix.rb +287 -0
- data/lib/ronin/path.rb +2 -2
- data/lib/ronin/spec/ui/output.rb +1 -7
- data/lib/ronin/support.rb +1 -0
- data/lib/ronin/support/inflector.rb +3 -7
- data/lib/ronin/support/support.rb +2 -1
- data/lib/ronin/support/version.rb +1 -1
- data/lib/ronin/ui/output/helpers.rb +13 -15
- data/lib/ronin/ui/output/output.rb +2 -2
- data/lib/ronin/ui/output/terminal/color.rb +10 -4
- data/lib/ronin/wordlist.rb +92 -17
- data/ronin-support.gemspec +38 -109
- data/spec/binary/hexdump/helpers/hexdumps.rb +13 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/ascii.bin +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/hexdump_decimal_shorts.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/hexdump_hex_bytes.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/hexdump_hex_shorts.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/hexdump_octal_bytes.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/hexdump_octal_shorts.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/hexdump_repeated.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/od_decimal_bytes.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/od_decimal_ints.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/od_decimal_quads.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/od_decimal_shorts.txt +0 -0
- data/spec/binary/hexdump/helpers/hexdumps/od_doubles.txt +17 -0
- data/spec/binary/hexdump/helpers/hexdumps/od_floats.txt +17 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/od_hex_bytes.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/od_hex_ints.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/od_hex_quads.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/od_hex_shorts.txt +0 -0
- data/spec/binary/hexdump/helpers/hexdumps/od_named_chars.txt +17 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/od_octal_bytes.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/od_octal_ints.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/od_octal_quads.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/od_octal_shorts.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/od_repeated.txt +0 -0
- data/spec/{formatting/binary → binary/hexdump}/helpers/hexdumps/repeated.bin +0 -0
- data/spec/binary/hexdump/parser_spec.rb +302 -0
- data/spec/binary/struct_spec.rb +496 -0
- data/spec/binary/template_spec.rb +400 -0
- data/spec/extensions/ip_addr_spec.rb +58 -32
- data/spec/extensions/regexp_spec.rb +60 -0
- data/spec/extensions/string_spec.rb +1 -1
- data/spec/formatting/binary/array_spec.rb +22 -0
- data/spec/formatting/binary/base64_spec.rb +50 -0
- data/spec/formatting/binary/float_spec.rb +30 -0
- data/spec/formatting/binary/integer_spec.rb +54 -40
- data/spec/formatting/binary/string_spec.rb +69 -182
- data/spec/formatting/text/string_spec.rb +30 -0
- data/spec/network/dns_spec.rb +64 -0
- data/spec/network/ftp_spec.rb +65 -0
- data/spec/network/proxy_spec.rb +121 -0
- data/spec/network/shared/unix_server.rb +31 -0
- data/spec/network/tcp/proxy_spec.rb +116 -0
- data/spec/network/{tcp_spec.rb → tcp/tcp_spec.rb} +24 -1
- data/spec/network/telnet_spec.rb +67 -0
- data/spec/network/{udp_spec.rb → udp/udp_spec.rb} +24 -1
- data/spec/network/unix_spec.rb +183 -0
- data/spec/wordlist_spec.rb +74 -13
- metadata +129 -85
- data/spec/formatting/binary/helpers/hexdumps.rb +0 -16
@@ -0,0 +1,287 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
#
|
4
|
+
# This file is part of Ronin Support.
|
5
|
+
#
|
6
|
+
# Ronin Support 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 Support 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 Support. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'socket'
|
21
|
+
require 'timeout'
|
22
|
+
|
23
|
+
module Ronin
|
24
|
+
module Network
|
25
|
+
#
|
26
|
+
# Provides helper methods for communicating with UNIX sockets.
|
27
|
+
#
|
28
|
+
# @since 0.5.0
|
29
|
+
#
|
30
|
+
module UNIX
|
31
|
+
#
|
32
|
+
# Tests whether a UNIX socket is open.
|
33
|
+
#
|
34
|
+
# @param [String] path
|
35
|
+
# The path to the socket.
|
36
|
+
#
|
37
|
+
# @param [Integer] timeout (5)
|
38
|
+
# The maximum time to attempt connecting.
|
39
|
+
#
|
40
|
+
# @return [Boolean, nil]
|
41
|
+
# Specifies whether the UNIX socket is open.
|
42
|
+
# If the connection was not accepted, `nil` will be returned.
|
43
|
+
#
|
44
|
+
# @api public
|
45
|
+
#
|
46
|
+
# @since 0.5.0
|
47
|
+
#
|
48
|
+
def unix_open?(path,timeout=nil)
|
49
|
+
timeout ||= 5
|
50
|
+
|
51
|
+
begin
|
52
|
+
Timeout.timeout(timeout) { unix_session(path) }
|
53
|
+
return true
|
54
|
+
rescue Timeout::Error
|
55
|
+
return nil
|
56
|
+
rescue SocketError, SystemCallError
|
57
|
+
return false
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
#
|
62
|
+
# Connects to a UNIX socket.
|
63
|
+
#
|
64
|
+
# @param [String] path
|
65
|
+
# The path to the UNIX socket.
|
66
|
+
#
|
67
|
+
# @yield [socket]
|
68
|
+
# If a block is given, it will be passed an UNIX socket object.
|
69
|
+
#
|
70
|
+
# @yieldparam [UNIXSocket] socket
|
71
|
+
# The UNIX socket.
|
72
|
+
#
|
73
|
+
# @return [UNIXSocket]
|
74
|
+
# The UNIX socket.
|
75
|
+
#
|
76
|
+
# @example
|
77
|
+
# unix_connect('/tmp/haproxy.stats.socket')
|
78
|
+
#
|
79
|
+
# @see http://rubydoc.info/stdlib/socket/UNIXSocket
|
80
|
+
#
|
81
|
+
# @api public
|
82
|
+
#
|
83
|
+
def unix_connect(path)
|
84
|
+
socket = UNIXSocket.new(path)
|
85
|
+
|
86
|
+
yield socket if block_given?
|
87
|
+
return socket
|
88
|
+
end
|
89
|
+
|
90
|
+
#
|
91
|
+
# Creates a new UNIXSocket object, connected to the given path.
|
92
|
+
# The given data will then be written to the newly created UNIXSocket.
|
93
|
+
#
|
94
|
+
# @param [String] data
|
95
|
+
# The data to send to the socket.
|
96
|
+
#
|
97
|
+
# @param [String] path
|
98
|
+
# The path to the socket.
|
99
|
+
#
|
100
|
+
# @yield [socket]
|
101
|
+
# If a block is given, it will be passed the newly created socket.
|
102
|
+
#
|
103
|
+
# @yieldparam [UNIXSocket] socket
|
104
|
+
# The newly created UNIXSocket object.
|
105
|
+
#
|
106
|
+
# @return [UNIXSocket]
|
107
|
+
# The newly created UNIXSocket object.
|
108
|
+
#
|
109
|
+
# @api public
|
110
|
+
#
|
111
|
+
def unix_connect_and_send(data,path)
|
112
|
+
socket = unix_connect(path)
|
113
|
+
socket.write(data)
|
114
|
+
|
115
|
+
yield socket if block_given?
|
116
|
+
return socket
|
117
|
+
end
|
118
|
+
|
119
|
+
#
|
120
|
+
# Connects temporarily to a UNIX socket.
|
121
|
+
#
|
122
|
+
# @param [String] path
|
123
|
+
# The path to the UNIX socket.
|
124
|
+
#
|
125
|
+
# @yield [socket]
|
126
|
+
# If a block is given, it will be passed an UNIX socket object.
|
127
|
+
#
|
128
|
+
# @yieldparam [UNIXSocket] socket
|
129
|
+
# The UNIX socket.
|
130
|
+
#
|
131
|
+
# @example
|
132
|
+
# unix_session('/tmp/haproxy.stats.socket') do |socket|
|
133
|
+
# # ...
|
134
|
+
# end
|
135
|
+
#
|
136
|
+
# @api public
|
137
|
+
#
|
138
|
+
def unix_session(path)
|
139
|
+
socket = unix_connect(path)
|
140
|
+
|
141
|
+
yield socket if block_given?
|
142
|
+
socket.close
|
143
|
+
return nil
|
144
|
+
end
|
145
|
+
|
146
|
+
#
|
147
|
+
# Connects to a UNIX socket, sends the given data and then closes the
|
148
|
+
# socket.
|
149
|
+
#
|
150
|
+
# @param [String] data
|
151
|
+
# The data to send to the UNIX socket.
|
152
|
+
#
|
153
|
+
# @param [String] path
|
154
|
+
# The UNIX socket to connect to.
|
155
|
+
#
|
156
|
+
# @return [true]
|
157
|
+
# The data was successfully sent.
|
158
|
+
#
|
159
|
+
# @example
|
160
|
+
# buffer = "GET /" + ('A' * 4096) + "\n\r"
|
161
|
+
# unix_send(buffer,'/tmp/thin.socket')
|
162
|
+
# # => true
|
163
|
+
#
|
164
|
+
# @api public
|
165
|
+
#
|
166
|
+
def unix_send(data,path)
|
167
|
+
unix_session(path) do |socket|
|
168
|
+
socket.write(data)
|
169
|
+
end
|
170
|
+
|
171
|
+
return true
|
172
|
+
end
|
173
|
+
|
174
|
+
#
|
175
|
+
# Opens a UNIX socket.
|
176
|
+
#
|
177
|
+
# @param [String] path
|
178
|
+
# The path for the new UNIX socket.
|
179
|
+
#
|
180
|
+
# @yield [server]
|
181
|
+
# If a block is given, it will be passed an UNIX socket object.
|
182
|
+
#
|
183
|
+
# @yieldparam [UNIXServer] server
|
184
|
+
# The new UNIX socket.
|
185
|
+
#
|
186
|
+
# @return [UNIXServer]
|
187
|
+
# The new UNIX socket.
|
188
|
+
#
|
189
|
+
# @example
|
190
|
+
# unix_server('/tmp/test.socket')
|
191
|
+
#
|
192
|
+
# @see http://rubydoc.info/stdlib/socket/UNIXServer
|
193
|
+
#
|
194
|
+
# @api public
|
195
|
+
#
|
196
|
+
def unix_server(path)
|
197
|
+
socket = UNIXServer.new(path)
|
198
|
+
|
199
|
+
yield socket if block_given?
|
200
|
+
return socket
|
201
|
+
end
|
202
|
+
|
203
|
+
#
|
204
|
+
# Opens a UNIX socket temporarily.
|
205
|
+
#
|
206
|
+
# @param [String] path
|
207
|
+
# The path for the new UNIX socket.
|
208
|
+
#
|
209
|
+
# @yield [server]
|
210
|
+
# If a block is given, it will be passed an UNIX socket object.
|
211
|
+
#
|
212
|
+
# @yieldparam [UNIXServer] server
|
213
|
+
# The new UNIX socket.
|
214
|
+
#
|
215
|
+
# @example
|
216
|
+
# unix_server_session('/tmp/test.socket') do |server|
|
217
|
+
# # ...
|
218
|
+
# end
|
219
|
+
#
|
220
|
+
# @api public
|
221
|
+
#
|
222
|
+
def unix_server_session(path,&block)
|
223
|
+
socket = unix_server(path,&block)
|
224
|
+
socket.close
|
225
|
+
return nil
|
226
|
+
end
|
227
|
+
|
228
|
+
#
|
229
|
+
# Opens a UNIX socket, accepts connections in a loop.
|
230
|
+
#
|
231
|
+
# @param [String] path
|
232
|
+
# The path for the new UNIX socket.
|
233
|
+
#
|
234
|
+
# @yield [client]
|
235
|
+
# If a block is given, it will be passed each accepted connection.
|
236
|
+
#
|
237
|
+
# @yieldparam [UNIXSocket] client
|
238
|
+
# An accepted connection to UNIX socket.
|
239
|
+
#
|
240
|
+
# @example
|
241
|
+
# unix_server_loop('/tmp/test.socket') do |client|
|
242
|
+
# # ...
|
243
|
+
# end
|
244
|
+
#
|
245
|
+
# @api public
|
246
|
+
#
|
247
|
+
def unix_server_loop(path)
|
248
|
+
unix_server_session(path) do |server|
|
249
|
+
loop do
|
250
|
+
client = server.accept
|
251
|
+
|
252
|
+
yield client if block_given?
|
253
|
+
client.close
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
#
|
259
|
+
# Opens a UNIX socket, accepts a connection, then closes the socket.
|
260
|
+
#
|
261
|
+
# @param [String] path
|
262
|
+
# The path for the new UNIX socket.
|
263
|
+
#
|
264
|
+
# @yield [client]
|
265
|
+
# If a block is given, it will be passed the accepted connection.
|
266
|
+
#
|
267
|
+
# @yieldparam [UNIXSocket] client
|
268
|
+
# The accepted connection to UNIX socket.
|
269
|
+
#
|
270
|
+
# @example
|
271
|
+
# unix_single_server('/tmp/test.socket') do |client|
|
272
|
+
# # ...
|
273
|
+
# end
|
274
|
+
#
|
275
|
+
# @api public
|
276
|
+
#
|
277
|
+
def unix_accept(path)
|
278
|
+
unix_server_session(path) do |server|
|
279
|
+
client = server.accept
|
280
|
+
|
281
|
+
yield client if block_given?
|
282
|
+
client.close
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
data/lib/ronin/path.rb
CHANGED
@@ -62,11 +62,11 @@ module Ronin
|
|
62
62
|
# @raise [ArgumentError]
|
63
63
|
# A negative number was given as the first argument.
|
64
64
|
#
|
65
|
-
# @example Generate a relative path that goes up 7 directories
|
65
|
+
# @example Generate a relative path that goes up 7 directories:
|
66
66
|
# Path.up(7)
|
67
67
|
# # => #<Ronin::Path:../../../../../../..>
|
68
68
|
#
|
69
|
-
# @example Generate multiple relative paths, going up 1 to 3 directories
|
69
|
+
# @example Generate multiple relative paths, going up 1 to 3 directories:
|
70
70
|
# Path.up(1..3)
|
71
71
|
# # => [#<Ronin::Path:..>, #<Ronin::Path:../..>,
|
72
72
|
# #<Ronin::Path:../../..>]
|
data/lib/ronin/spec/ui/output.rb
CHANGED
data/lib/ronin/support.rb
CHANGED
@@ -21,17 +21,13 @@ module Ronin
|
|
21
21
|
module Support
|
22
22
|
# The Inflectors supported by ronin-support
|
23
23
|
INFLECTORS = {
|
24
|
-
:
|
24
|
+
:data_mapper => {
|
25
25
|
:path => 'dm-core',
|
26
26
|
:const => 'DataMapper::Inflector'
|
27
27
|
},
|
28
28
|
:active_support => {
|
29
29
|
:path => 'active_support/inflector',
|
30
30
|
:const => 'ActiveSupport::Inflector'
|
31
|
-
},
|
32
|
-
:extlib => {
|
33
|
-
:path => 'extlib/inflection',
|
34
|
-
:const => 'Extlib::Inflection'
|
35
31
|
}
|
36
32
|
}
|
37
33
|
|
@@ -41,7 +37,7 @@ module Ronin
|
|
41
37
|
#
|
42
38
|
# @param [Symbol, String] name
|
43
39
|
# The name of the Inflector library to load. May be either
|
44
|
-
# `:datamapper
|
40
|
+
# `:datamapper` or `:active_support`.
|
45
41
|
#
|
46
42
|
# @return [true]
|
47
43
|
# Specifies that the Inflector library was successfully loaded.
|
@@ -81,7 +77,7 @@ module Ronin
|
|
81
77
|
return true
|
82
78
|
end
|
83
79
|
|
84
|
-
[:
|
80
|
+
[:data_mapper, :active_support].each do |name|
|
85
81
|
begin
|
86
82
|
Support.load_inflector!(name)
|
87
83
|
break
|
@@ -29,12 +29,13 @@ module Ronin
|
|
29
29
|
include Network::DNS
|
30
30
|
include Network::TCP
|
31
31
|
include Network::UDP
|
32
|
-
include Network::
|
32
|
+
include Network::UNIX
|
33
33
|
include Network::SMTP
|
34
34
|
include Network::ESMTP
|
35
35
|
include Network::POP3
|
36
36
|
include Network::IMAP
|
37
37
|
include Network::Telnet
|
38
|
+
include Network::FTP
|
38
39
|
include Network::HTTP
|
39
40
|
end
|
40
41
|
end
|
@@ -123,7 +123,7 @@ module Ronin
|
|
123
123
|
# @example
|
124
124
|
# print_info "Connecting ..."
|
125
125
|
#
|
126
|
-
# @example Print a formatted message
|
126
|
+
# @example Print a formatted message:
|
127
127
|
# print_info "Connected to %s", host
|
128
128
|
#
|
129
129
|
# @since 0.3.0
|
@@ -132,7 +132,7 @@ module Ronin
|
|
132
132
|
#
|
133
133
|
def print_info(*message)
|
134
134
|
unless Output.silent?
|
135
|
-
Output.handler.print_info(
|
135
|
+
Output.handler.print_info(Helpers.format(message))
|
136
136
|
return true
|
137
137
|
end
|
138
138
|
|
@@ -148,7 +148,7 @@ module Ronin
|
|
148
148
|
# @return [Boolean]
|
149
149
|
# Specifies whether the messages were successfully printed.
|
150
150
|
#
|
151
|
-
# @example Print a formatted message
|
151
|
+
# @example Print a formatted message:
|
152
152
|
# print_debug "vars: %p %p", vars[0], vars[1]
|
153
153
|
#
|
154
154
|
# @since 0.3.0
|
@@ -157,7 +157,7 @@ module Ronin
|
|
157
157
|
#
|
158
158
|
def print_debug(*message)
|
159
159
|
if (Output.verbose? && !(Output.silent?))
|
160
|
-
Output.handler.print_debug(
|
160
|
+
Output.handler.print_debug(Helpers.format(message))
|
161
161
|
return true
|
162
162
|
end
|
163
163
|
|
@@ -176,7 +176,7 @@ module Ronin
|
|
176
176
|
# @example
|
177
177
|
# print_warning "Detecting a restricted character in the buffer"
|
178
178
|
#
|
179
|
-
# @example Print a formatted message
|
179
|
+
# @example Print a formatted message:
|
180
180
|
# print_warning "Malformed input detected: %p", user_input
|
181
181
|
#
|
182
182
|
# @since 0.3.0
|
@@ -185,7 +185,7 @@ module Ronin
|
|
185
185
|
#
|
186
186
|
def print_warning(*message)
|
187
187
|
unless Output.silent?
|
188
|
-
Output.handler.print_warning(
|
188
|
+
Output.handler.print_warning(Helpers.format(message))
|
189
189
|
return true
|
190
190
|
end
|
191
191
|
|
@@ -204,7 +204,7 @@ module Ronin
|
|
204
204
|
# @example
|
205
205
|
# print_error "Could not connect!"
|
206
206
|
#
|
207
|
-
# @example Print a formatted message
|
207
|
+
# @example Print a formatted message:
|
208
208
|
# print_error "%p: %s", error.class, error.message
|
209
209
|
#
|
210
210
|
# @since 0.3.0
|
@@ -213,7 +213,7 @@ module Ronin
|
|
213
213
|
#
|
214
214
|
def print_error(*message)
|
215
215
|
unless Output.silent?
|
216
|
-
Output.handler.print_error(
|
216
|
+
Output.handler.print_error(Helpers.format(message))
|
217
217
|
return true
|
218
218
|
end
|
219
219
|
|
@@ -259,21 +259,19 @@ module Ronin
|
|
259
259
|
#
|
260
260
|
# Formats a message to be printed.
|
261
261
|
#
|
262
|
-
# @param [Array]
|
262
|
+
# @param [Array] arguments
|
263
263
|
# The message and additional Objects to format.
|
264
264
|
#
|
265
265
|
# @return [String]
|
266
266
|
# The formatted message.
|
267
267
|
#
|
268
|
-
# @since 1.0.0
|
269
|
-
#
|
270
268
|
# @api private
|
271
269
|
#
|
272
|
-
def
|
273
|
-
|
274
|
-
|
270
|
+
def Helpers.format(arguments)
|
271
|
+
unless arguments.length == 1
|
272
|
+
arguments.first % arguments[1..-1]
|
275
273
|
else
|
276
|
-
|
274
|
+
arguments.first
|
277
275
|
end
|
278
276
|
end
|
279
277
|
end
|