rex-core 0.1.16 → 0.1.17

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17110a74336ae634771add814eed9e60a711005641b6424a482d057bbb7314bd
4
- data.tar.gz: 788d7cb8332f1cd817fbbf6de0da93ef7dbc92906f4c31706ca38de433812ef8
3
+ metadata.gz: cc3a037b0e2014526adcb218da1f7519b84c59ed81457e63d3d4bfe8632b7d32
4
+ data.tar.gz: ac2a430d2978df81f3671123d1c192430098ab4f2b3833a26489bcbe2f6e7db9
5
5
  SHA512:
6
- metadata.gz: 6873be6d3d89644c9285d06e6966aa05f0604b09564b865ebf9fd70339c99d9b3fb0320e92ebedc3e378983956faed6cb5089c69d1bb0fe6d751252d0bfc45ab
7
- data.tar.gz: 678096caf324f23b4937f4607ed336c66ac7916fd7417197288b6c07ef70d18cc870b8780f5d119d74b2a1eb9d2d0274fe9df38b8033bcfa989b7c0d3be9bb0c
6
+ metadata.gz: 0adeeff27a4a9dee8092466387624a60ff991789b419e15c667c9f0b2a94a3c8f64e836ee967182dd78834e46722c42fbb2e8cf0c1af5a2210b9bacc136da9e2
7
+ data.tar.gz: 308daa85d93b917ce3dbb7fc5445087269899c437baaa96ce0082901ee54de94e6e5b7016cd3cfaf4914716b0fd8bddc331c439d2cf5c9d6999572215bddfa1c
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,5 @@
1
1
  module Rex
2
2
  module Core
3
- VERSION = "0.1.16"
3
+ VERSION = "0.1.17"
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
 
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.16
4
+ version: 0.1.17
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-12 00:00:00.000000000 Z
96
+ date: 2021-07-15 00:00:00.000000000 Z
97
97
  dependencies:
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rake
metadata.gz.sig CHANGED
Binary file