rex-socket 0.1.25 → 0.1.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.github/workflows/verify.yml +57 -0
- data/Gemfile +4 -0
- data/lib/rex/socket.rb +15 -22
- data/lib/rex/socket/version.rb +1 -1
- metadata +3 -3
- metadata.gz.sig +0 -0
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0bf99960d66db7491db5490f75d4c87a8bfde429dcc76a4e4e1d07306cf61b8
|
4
|
+
data.tar.gz: 7e665ba1dba7574c1fa7adb9523b9e8781daff17185daef8300cc0d1f5cd8d0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a15da2ba7b185bf822db6f467fde6ae641008861f2758c865b9c66b524904dffd02add948e18cb544105747aaf8ce5f90f3083c8eaa18ac84284917ff29fe9cf
|
7
|
+
data.tar.gz: c6585bddb9cc7b52f29f3d9f193200132801fbb141162550f9d6a9553af51a853a3946c3c42fca55dbaed217a88cd68372066db5d76a8bcbc356a780c6bde61a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
@@ -0,0 +1,57 @@
|
|
1
|
+
name: Verify
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- '*'
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- '*'
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
test:
|
13
|
+
runs-on: ubuntu-16.04
|
14
|
+
timeout-minutes: 40
|
15
|
+
|
16
|
+
strategy:
|
17
|
+
fail-fast: true
|
18
|
+
matrix:
|
19
|
+
ruby:
|
20
|
+
- 2.5
|
21
|
+
- 2.6
|
22
|
+
- 2.7
|
23
|
+
- 3.0
|
24
|
+
test_cmd:
|
25
|
+
- bundle exec rspec
|
26
|
+
|
27
|
+
env:
|
28
|
+
RAILS_ENV: test
|
29
|
+
|
30
|
+
name: Ruby ${{ matrix.ruby }} - ${{ matrix.test_cmd }}
|
31
|
+
steps:
|
32
|
+
- name: Checkout code
|
33
|
+
uses: actions/checkout@v2
|
34
|
+
|
35
|
+
- uses: actions/setup-ruby@v1
|
36
|
+
with:
|
37
|
+
ruby-version: ${{ matrix.ruby }}
|
38
|
+
|
39
|
+
- name: Setup bundler
|
40
|
+
run: |
|
41
|
+
gem install bundler
|
42
|
+
- uses: actions/cache@v2
|
43
|
+
with:
|
44
|
+
path: vendor/bundle
|
45
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
46
|
+
restore-keys: |
|
47
|
+
${{ runner.os }}-gems-
|
48
|
+
- name: Bundle install
|
49
|
+
run: |
|
50
|
+
bundle config path vendor/bundle
|
51
|
+
bundle install --jobs 4 --retry 3
|
52
|
+
- name: ${{ matrix.test_cmd }}
|
53
|
+
run: |
|
54
|
+
echo "${CMD}"
|
55
|
+
bash -c "${CMD}"
|
56
|
+
env:
|
57
|
+
CMD: ${{ matrix.test_cmd }}
|
data/Gemfile
CHANGED
data/lib/rex/socket.rb
CHANGED
@@ -174,7 +174,7 @@ module Socket
|
|
174
174
|
end
|
175
175
|
|
176
176
|
#
|
177
|
-
# Wrapper for +::
|
177
|
+
# Wrapper for +::Addrinfo.getaddrinfo+ that takes special care to see if the
|
178
178
|
# supplied address is already an ASCII IP address. This is necessary to
|
179
179
|
# prevent blocking while waiting on a DNS reverse lookup when we already
|
180
180
|
# have what we need.
|
@@ -186,26 +186,14 @@ module Socket
|
|
186
186
|
return [hostname]
|
187
187
|
end
|
188
188
|
|
189
|
-
res = ::
|
190
|
-
return [] if not res
|
189
|
+
res = ::Addrinfo.getaddrinfo(hostname, 0, ::Socket::AF_UNSPEC, ::Socket::SOCK_STREAM)
|
191
190
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
res.shift # alias hostnames
|
196
|
-
res.shift # address_family
|
191
|
+
res.map! do |address_info|
|
192
|
+
address_info.ip_address
|
193
|
+
end
|
197
194
|
|
198
|
-
|
199
|
-
|
200
|
-
if res[0] =~ MATCH_IPV4 || res[0] =~ MATCH_IPV6
|
201
|
-
unless accept_ipv6
|
202
|
-
res.reject!{ |ascii| ascii =~ MATCH_IPV6 }
|
203
|
-
end
|
204
|
-
else
|
205
|
-
unless accept_ipv6
|
206
|
-
res.reject!{ |nbo| nbo.length != 4 }
|
207
|
-
end
|
208
|
-
res.map!{ |nbo| self.addr_ntoa(nbo) }
|
195
|
+
unless accept_ipv6
|
196
|
+
res.reject! { |ascii| ascii =~ MATCH_IPV6 }
|
209
197
|
end
|
210
198
|
|
211
199
|
res
|
@@ -217,7 +205,9 @@ module Socket
|
|
217
205
|
# not occur. This is done in order to prevent delays, such as would occur
|
218
206
|
# on Windows.
|
219
207
|
#
|
208
|
+
# @deprecated Please use {#getaddress}, {#resolv_nbo}, or similar instead.
|
220
209
|
def self.gethostbyname(host)
|
210
|
+
warn "NOTE: #{self}.#{__method__} is deprecated, use getaddress, resolve_nbo, or similar instead. It will be removed in the next Major version"
|
221
211
|
if is_ipv4?(host)
|
222
212
|
return [ host, [], 2, host.split('.').map{ |c| c.to_i }.pack("C4") ]
|
223
213
|
end
|
@@ -259,15 +249,18 @@ module Socket
|
|
259
249
|
#
|
260
250
|
# Resolves a host to raw network-byte order.
|
261
251
|
#
|
262
|
-
def self.resolv_nbo(host)
|
263
|
-
|
252
|
+
def self.resolv_nbo(host, accepts_ipv6 = true)
|
253
|
+
ip_address = Rex::Socket.getaddress(host, accepts_ipv6)
|
254
|
+
IPAddr.new(ip_address).hton
|
264
255
|
end
|
265
256
|
|
266
257
|
#
|
267
258
|
# Resolves a host to raw network-byte order.
|
268
259
|
#
|
269
260
|
def self.resolv_nbo_list(host)
|
270
|
-
Rex::Socket.getaddresses(host).map
|
261
|
+
Rex::Socket.getaddresses(host).map do |addresses|
|
262
|
+
IPAddr.new(addresses).hton
|
263
|
+
end
|
271
264
|
end
|
272
265
|
|
273
266
|
#
|
data/lib/rex/socket/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rex-socket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.26
|
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:
|
96
|
+
date: 2021-03-10 00:00:00.000000000 Z
|
97
97
|
dependencies:
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: rake
|
@@ -147,9 +147,9 @@ executables: []
|
|
147
147
|
extensions: []
|
148
148
|
extra_rdoc_files: []
|
149
149
|
files:
|
150
|
+
- ".github/workflows/verify.yml"
|
150
151
|
- ".gitignore"
|
151
152
|
- ".rspec"
|
152
|
-
- ".travis.yml"
|
153
153
|
- CODE_OF_CONDUCT.md
|
154
154
|
- Gemfile
|
155
155
|
- LICENSE
|
metadata.gz.sig
CHANGED
Binary file
|