rex-core 0.1.15 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30d6d74b1603e11dd926c24e867db559a88c9294fc1b4dc88559d66366928044
4
- data.tar.gz: 7484592c2f3429b4481700937395ae6f0457b61fdddaf4abd9b780ebfff1de85
3
+ metadata.gz: 4b2bbdcc1a0301230c6fdd17df19375ba3ee885852b14b7096736294539d566b
4
+ data.tar.gz: f474c211aa36c95dc0dbdf5b05b591d2fd1cc98bd1cec5c877deea37fe2986e2
5
5
  SHA512:
6
- metadata.gz: '0698ecc78c85cb0497065dc82521be98a264784e4e76951d24ac36d82ab7f3a3e7ade7c6993127e1db1513157826edfd137dfe33d4ca71fa139088235f5694c6'
7
- data.tar.gz: 1b819f79ced4a1656120ceeca644d4a634b5e54923bc3c2887edf76b9e28ed1e4de85c917ffeeef4cce5c239913b398492ba4b3f20f058700ad2b5fc9304427c
6
+ metadata.gz: 247e60760168cfaeebce318e982939b6100f7ea2fe278914a11261b9eaf9933db6f5754b1b4afd859ec4aa2d7fb4379065a7505a1d5bae0565b5c10f56d56b4f
7
+ data.tar.gz: 234380d838b2687ea3b80575f406430daebed9cfd3292be43db94b3ebb6c948a909d309cb6a20901d27daef423179f8ee92c548cd78ed078dcd2a5815d6969cf
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Core
3
- VERSION = "0.1.15"
3
+ VERSION = "0.1.19"
4
4
  end
5
5
  end
@@ -145,9 +145,10 @@ end
145
145
  #
146
146
  ###
147
147
  module HostCommunicationError
148
- def initialize(addr = nil, port = nil)
149
- self.host = addr
150
- self.port = port
148
+ def initialize(addr = nil, port = nil, reason: nil)
149
+ @host = addr
150
+ @port = port
151
+ @reason = reason
151
152
  end
152
153
 
153
154
  #
@@ -156,7 +157,7 @@ module HostCommunicationError
156
157
  #
157
158
  def addr_to_s
158
159
  if host and port
159
- "(#{host}:#{port})"
160
+ host.include?(':') ? "([#{host}]:#{port})" : "(#{host}:#{port})"
160
161
  elsif host
161
162
  "(#{host})"
162
163
  else
@@ -164,7 +165,13 @@ module HostCommunicationError
164
165
  end
165
166
  end
166
167
 
167
- attr_accessor :host, :port
168
+ def to_s
169
+ str = super
170
+ str << " #{@reason}" if @reason
171
+ str
172
+ end
173
+
174
+ attr_accessor :host, :port, :reason
168
175
  end
169
176
 
170
177
 
@@ -186,7 +193,9 @@ end
186
193
  ###
187
194
  class ConnectionRefused < ConnectionError
188
195
  def to_s
189
- "The connection was refused by the remote host #{addr_to_s}."
196
+ str = "The connection was refused by the remote host #{addr_to_s}."
197
+ str << " #{@reason}" unless @reason.nil?
198
+ str
190
199
  end
191
200
  end
192
201
 
@@ -198,7 +207,9 @@ end
198
207
  ###
199
208
  class HostUnreachable < ConnectionError
200
209
  def to_s
201
- "The host #{addr_to_s} was unreachable."
210
+ str = "The host #{addr_to_s} was unreachable."
211
+ str << " #{@reason}" unless @reason.nil?
212
+ str
202
213
  end
203
214
  end
204
215
 
@@ -209,7 +220,9 @@ end
209
220
  ###
210
221
  class ConnectionTimeout < ConnectionError
211
222
  def to_s
212
- "The connection timed out #{addr_to_s}."
223
+ str = "The connection with #{addr_to_s} timed out."
224
+ str << " #{@reason}" unless @reason.nil?
225
+ str
213
226
  end
214
227
  end
215
228
 
@@ -220,18 +233,17 @@ end
220
233
  #
221
234
  ###
222
235
  class InvalidDestination < ConnectionError
223
- include SocketError
224
- include HostCommunicationError
225
-
226
236
  def to_s
227
- "The destination is invalid: #{addr_to_s}."
237
+ str = "The destination is invalid: #{addr_to_s}."
238
+ str << " #{@reason}" unless @reason.nil?
239
+ str
228
240
  end
229
241
  end
230
242
 
231
243
  ###
232
244
  #
233
245
  # This exception is raised when an attempt to use an address or port that is
234
- # already in use or onot available occurs. such as binding to a host on a
246
+ # already in use or not available occurs. such as binding to a host on a
235
247
  # given port that is already in use, or when a bind address is specified that
236
248
  # is not available to the host.
237
249
  #
@@ -241,7 +253,9 @@ class BindFailed < ::ArgumentError
241
253
  include HostCommunicationError
242
254
 
243
255
  def to_s
244
- "The address is already in use or unavailable: #{addr_to_s}."
256
+ str = "The address is already in use or unavailable: #{addr_to_s}."
257
+ str << " #{@reason}" unless @reason.nil?
258
+ str
245
259
  end
246
260
  end
247
261
 
@@ -255,11 +269,10 @@ end
255
269
  #
256
270
  ##
257
271
  class AddressInUse < ConnectionError
258
- include SocketError
259
- include HostCommunicationError
260
-
261
272
  def to_s
262
- "The address is already in use or unavailable: #{addr_to_s}."
273
+ str = "The address is already in use or unavailable: #{addr_to_s}."
274
+ str << " #{@reason}" unless @reason.nil?
275
+ str
263
276
  end
264
277
  end
265
278
 
data/lib/rex/file.rb CHANGED
@@ -130,7 +130,7 @@ module Find
130
130
  paths.collect!{|d| d.dup}
131
131
  while file = paths.shift
132
132
  catch(:prune) do
133
- yield file.dup.taint
133
+ yield file.dup
134
134
  next unless File.exist? file
135
135
  begin
136
136
  if File.stat(file).directory? then
@@ -145,7 +145,7 @@ module Find
145
145
  else
146
146
  f = File.join(file, f)
147
147
  end
148
- paths.unshift f.untaint
148
+ paths.unshift f
149
149
  end
150
150
  ensure
151
151
  d.close
data/lib/rex/io/stream.rb CHANGED
@@ -325,21 +325,6 @@ module Stream
325
325
  16384
326
326
  end
327
327
 
328
- protected
329
-
330
- #
331
- # The read-write lock used to synchronize access to the stream. This is only
332
- # set when synchronization has been initialized as performed by
333
- # #initialize_synchronization.
334
- #
335
- attr_accessor :stream_lock
336
-
337
- #
338
- # A boolean flag indicating that the resource is to be closed. Blocking
339
- # operations that are synchronized (such as #read and #write) should evaluate
340
- # this flag and exit appropriately when there is no data to be processed.
341
- attr_accessor :close_resource
342
-
343
328
  #
344
329
  # Synchronize non-state changing access to the stream such as read and write
345
330
  # operations. If synchronization has not been initialized, this doesn't do
@@ -366,6 +351,21 @@ protected
366
351
  self.stream_lock.unlock_write unless self.stream_lock.nil?
367
352
  end
368
353
  end
354
+
355
+ protected
356
+
357
+ #
358
+ # The read-write lock used to synchronize access to the stream. This is only
359
+ # set when synchronization has been initialized as performed by
360
+ # #initialize_synchronization.
361
+ #
362
+ attr_accessor :stream_lock
363
+
364
+ #
365
+ # A boolean flag indicating that the resource is to be closed. Blocking
366
+ # operations that are synchronized (such as #read and #write) should evaluate
367
+ # this flag and exit appropriately when there is no data to be processed.
368
+ attr_accessor :close_resource
369
369
  end
370
370
 
371
371
  end end
@@ -0,0 +1,18 @@
1
+ module Rex
2
+
3
+ # This provides a correct way to time an operation provided within a block.
4
+ #
5
+ # @see https://blog.dnsimple.com/2018/03/elapsed-time-with-ruby-the-right-way/
6
+ #
7
+ # @yield [] The block whose operation should be timed.
8
+ #
9
+ # @return Returns the result of the block and the elapsed time in seconds.
10
+ def self.stopwatch
11
+ start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
12
+ ret = yield
13
+ elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
14
+
15
+ [ret, elapsed]
16
+ end
17
+
18
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rex-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
@@ -93,7 +93,7 @@ cert_chain:
93
93
  EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
94
94
  9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
95
95
  -----END CERTIFICATE-----
96
- date: 2021-02-04 00:00:00.000000000 Z
96
+ date: 2021-11-15 00:00:00.000000000 Z
97
97
  dependencies:
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rake
@@ -151,6 +151,7 @@ files:
151
151
  - lib/rex/io/stream.rb
152
152
  - lib/rex/io/stream_abstraction.rb
153
153
  - lib/rex/io/stream_server.rb
154
+ - lib/rex/stopwatch.rb
154
155
  - lib/rex/sync.rb
155
156
  - lib/rex/sync/event.rb
156
157
  - lib/rex/sync/read_write_lock.rb
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- �]��q���Oc���|����`_����� ���un�΃w�&?���;󢜒��q
1
+ G��G�ϐan�p0ः�W�)�� Rp
2
+ ��LK��-�~�sR�ԅ<��-,��Qkk �1e+&U�?�����=p��M�5�)@,�&��|������C��OIVsb��,�&�{�%�?bb��4��