rex-socket 0.1.53 → 0.1.54
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/verify.yml +7 -10
- data/lib/rex/socket/version.rb +1 -1
- data/lib/rex/socket.rb +41 -21
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d6178ec17a488e30e67e5f38c47a37ef101779a01819acc9fe5f0e77e21137a
|
4
|
+
data.tar.gz: 850e34b302ac851ef01ed341fdb361e60c6256a3be7ebec6f52398046884b041
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e6be5fbc26e756be673e373c521ddac5b1b98a999ee5c78d9d9d009a68d9de1d5a40f2915ebb226a0349c4dd097d76779c2181396be31756f2a95c77f0fabff
|
7
|
+
data.tar.gz: 9bcd47ba675dd95f6eb4d5164e94ed5c82d1ac0f36513a20b2c77a37089f6a3cbe0705027ad363e153a700e45e9493b449e6659dc73e6256d20e83188e15c089
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -30,7 +30,7 @@ jobs:
|
|
30
30
|
timeout-minutes: 40
|
31
31
|
|
32
32
|
strategy:
|
33
|
-
fail-fast:
|
33
|
+
fail-fast: false
|
34
34
|
matrix:
|
35
35
|
ruby:
|
36
36
|
- '2.7'
|
@@ -39,20 +39,20 @@ jobs:
|
|
39
39
|
- '3.2'
|
40
40
|
os:
|
41
41
|
- ubuntu-20.04
|
42
|
+
- windows-2019
|
43
|
+
- macos-11
|
42
44
|
- ubuntu-latest
|
43
45
|
exclude:
|
44
46
|
- { os: ubuntu-latest, ruby: '2.7' }
|
45
47
|
- { os: ubuntu-latest, ruby: '3.0' }
|
46
|
-
test_cmd:
|
47
|
-
- bundle exec rspec
|
48
48
|
|
49
49
|
env:
|
50
50
|
RAILS_ENV: test
|
51
51
|
|
52
|
-
name: ${{ matrix.os }} - Ruby ${{ matrix.ruby }}
|
52
|
+
name: ${{ matrix.os }} - Ruby ${{ matrix.ruby }}
|
53
53
|
steps:
|
54
54
|
- name: Checkout code
|
55
|
-
uses: actions/checkout@
|
55
|
+
uses: actions/checkout@v4
|
56
56
|
|
57
57
|
- name: Setup Ruby
|
58
58
|
uses: ruby/setup-ruby@v1
|
@@ -60,9 +60,6 @@ jobs:
|
|
60
60
|
ruby-version: ${{ matrix.ruby }}
|
61
61
|
bundler-cache: true
|
62
62
|
|
63
|
-
- name:
|
63
|
+
- name: rspec
|
64
64
|
run: |
|
65
|
-
|
66
|
-
bash -c "${CMD}"
|
67
|
-
env:
|
68
|
-
CMD: ${{ matrix.test_cmd }}
|
65
|
+
bundle exec rspec
|
data/lib/rex/socket/version.rb
CHANGED
data/lib/rex/socket.rb
CHANGED
@@ -672,37 +672,57 @@ module Socket
|
|
672
672
|
# is no concurrent use of the same locals and this is safe.
|
673
673
|
def self.tcp_socket_pair
|
674
674
|
lsock = nil
|
675
|
+
last_child_error = nil
|
676
|
+
accept_timeout = 10
|
675
677
|
rsock = nil
|
676
678
|
laddr = '127.0.0.1'
|
677
679
|
lport = 0
|
678
680
|
threads = []
|
679
681
|
mutex = ::Mutex.new
|
680
682
|
|
681
|
-
threads << Rex::ThreadFactory.spawn('TcpSocketPair', false)
|
683
|
+
threads << Rex::ThreadFactory.spawn('TcpSocketPair', false) do
|
682
684
|
server = nil
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
685
|
+
begin
|
686
|
+
mutex.synchronize do
|
687
|
+
threads << Rex::ThreadFactory.spawn('TcpSocketPairClient', false) do
|
688
|
+
mutex.synchronize do
|
689
|
+
begin
|
690
|
+
rsock = ::TCPSocket.new( laddr, lport )
|
691
|
+
rescue => e
|
692
|
+
last_child_error = "#{e.class} - #{e.message}"
|
693
|
+
raise
|
694
|
+
end
|
695
|
+
end
|
696
|
+
end
|
697
|
+
server = ::TCPServer.new(laddr, 0)
|
698
|
+
if (server.getsockname =~ /127\.0\.0\.1:/)
|
699
|
+
# JRuby ridiculousness
|
700
|
+
caddr, lport = server.getsockname.split(":")
|
701
|
+
caddr = caddr[1,caddr.length]
|
702
|
+
lport = lport.to_i
|
703
|
+
else
|
704
|
+
# Sane implementations where Socket#getsockname returns a
|
705
|
+
# sockaddr
|
706
|
+
lport, caddr = ::Socket.unpack_sockaddr_in( server.getsockname )
|
707
|
+
end
|
708
|
+
end
|
709
|
+
|
710
|
+
readable, _writable, _errors = ::IO.select([server], nil, nil, accept_timeout)
|
711
|
+
if readable && readable.any?
|
712
|
+
lsock, _ = server.accept_nonblock
|
695
713
|
else
|
696
|
-
|
697
|
-
# sockaddr
|
698
|
-
lport, caddr = ::Socket.unpack_sockaddr_in( server.getsockname )
|
714
|
+
raise RuntimeError, "rsock didn't connect in #{accept_timeout} seconds"
|
699
715
|
end
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
716
|
+
ensure
|
717
|
+
server.close if server
|
718
|
+
end
|
719
|
+
end
|
704
720
|
|
705
|
-
threads.each
|
721
|
+
threads.each.with_index do |thread, i|
|
722
|
+
thread.join
|
723
|
+
rescue => e
|
724
|
+
raise "Thread #{i} - error #{e} - last child error: #{last_child_error}"
|
725
|
+
end
|
706
726
|
|
707
727
|
return [lsock, rsock]
|
708
728
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
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.54
|
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: 2023-09-
|
96
|
+
date: 2023-09-13 00:00:00.000000000 Z
|
97
97
|
dependencies:
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: rake
|
metadata.gz.sig
CHANGED
Binary file
|