rex-core 0.1.24 → 0.1.27
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/lib/rex/compat.rb +2 -0
- data/lib/rex/core/version.rb +1 -1
- data/lib/rex/io/socket_abstraction.rb +34 -10
- data/lib/rex/io/stream_server.rb +1 -1
- data/lib/rex/sync/ref.rb +27 -0
- data.tar.gz.sig +3 -1
- 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: 2aa029e6b51914e6b125525408d3b691ba3b3f3d714a95cc3b5a7759eddda95d
|
4
|
+
data.tar.gz: 7895ffdabf047757db4a42af53cb3d97888bc3756963217a267ad513679a078d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 498bba8dce9ef27f6314affa367949c9a011428e9dabb06ef3a0f56d7a1c00f12321ef31e49b5a9442eed5a39ae3f30fcfecbc1b4c5adf57a3856d4fb3c9dcd4
|
7
|
+
data.tar.gz: bde42deb8d8798570dd5ac6504242194dc0857e88a18c14ccaf50a79ad6f9722f4b3f31dcbd1e75e2bcafcebd17ef159c171121445f4698c9c9a9f2415080574
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rex/compat.rb
CHANGED
@@ -133,6 +133,7 @@ def self.open_browser(url='http://google.com/')
|
|
133
133
|
when /darwin/
|
134
134
|
system("open #{url}")
|
135
135
|
when /android/
|
136
|
+
url = "file://#{url}" if url.to_s.start_with?('/')
|
136
137
|
system("am start --user 0 -a android.intent.action.VIEW -d #{url}")
|
137
138
|
else
|
138
139
|
# Search through the PATH variable (if it exists) and chose a browser
|
@@ -190,6 +191,7 @@ def self.open_webrtc_browser(url='http://google.com/')
|
|
190
191
|
end
|
191
192
|
end
|
192
193
|
when /android/
|
194
|
+
url = "file://#{url}" if url.to_s.start_with?('/')
|
193
195
|
system("am start --user 0 -a android.intent.action.VIEW -d #{url}")
|
194
196
|
else
|
195
197
|
if defined? ENV['PATH']
|
data/lib/rex/core/version.rb
CHANGED
@@ -53,6 +53,9 @@ module Rex
|
|
53
53
|
#
|
54
54
|
def cleanup_abstraction
|
55
55
|
lsock.close if lsock and !lsock.closed?
|
56
|
+
|
57
|
+
monitor_thread.join if monitor_thread&.alive?
|
58
|
+
|
56
59
|
rsock.close if rsock and !rsock.closed?
|
57
60
|
|
58
61
|
self.lsock = nil
|
@@ -111,19 +114,36 @@ module Rex
|
|
111
114
|
#
|
112
115
|
attr_reader :rsock
|
113
116
|
|
117
|
+
module MonitoredRSock
|
118
|
+
def close
|
119
|
+
@close_requested = true
|
120
|
+
@monitor_thread.join
|
121
|
+
nil
|
122
|
+
end
|
123
|
+
|
124
|
+
def sysclose
|
125
|
+
self.class.instance_method(:close).bind(self).call
|
126
|
+
end
|
127
|
+
|
128
|
+
attr_reader :close_requested
|
129
|
+
attr_writer :monitor_thread
|
130
|
+
end
|
131
|
+
|
114
132
|
protected
|
115
133
|
|
116
134
|
def monitor_rsock(threadname = 'SocketMonitorRemote')
|
117
|
-
|
135
|
+
rsock.extend(MonitoredRSock)
|
136
|
+
rsock.monitor_thread = self.monitor_thread = Rex::ThreadFactory.spawn(threadname, false) do
|
118
137
|
loop do
|
119
|
-
closed =
|
120
|
-
buf = nil
|
138
|
+
closed = rsock.nil? || rsock.close_requested
|
121
139
|
|
122
|
-
|
123
|
-
wlog('monitor_rsock: the remote socket
|
140
|
+
if closed
|
141
|
+
wlog('monitor_rsock: the remote socket has been closed, exiting loop')
|
124
142
|
break
|
125
143
|
end
|
126
144
|
|
145
|
+
buf = nil
|
146
|
+
|
127
147
|
begin
|
128
148
|
s = Rex::ThreadSafe.select([rsock], nil, nil, 0.2)
|
129
149
|
next if s.nil? || s[0].nil?
|
@@ -159,10 +179,10 @@ module Rex
|
|
159
179
|
# Using syswrite() breaks SSL streams.
|
160
180
|
sent = write(data)
|
161
181
|
|
162
|
-
# sf: Only remove the data off the queue is write was
|
163
|
-
# This way we naturally perform a resend if a failure
|
182
|
+
# sf: Only remove the data off the queue is write was successful.
|
183
|
+
# This way we naturally perform a resend if a failure occurred.
|
164
184
|
# Catches an edge case with meterpreter TCP channels where remote send
|
165
|
-
#
|
185
|
+
# fails gracefully and a resend is required.
|
166
186
|
if sent.nil?
|
167
187
|
closed = true
|
168
188
|
wlog('monitor_rsock: failed writing, socket must be dead')
|
@@ -182,14 +202,18 @@ module Rex
|
|
182
202
|
|
183
203
|
begin
|
184
204
|
close_write if respond_to?('close_write')
|
185
|
-
rescue
|
205
|
+
rescue StandardError
|
186
206
|
end
|
207
|
+
|
187
208
|
break
|
188
209
|
end
|
210
|
+
|
211
|
+
rsock.sysclose
|
189
212
|
end
|
190
213
|
end
|
191
214
|
|
192
215
|
attr_accessor :monitor_thread
|
193
216
|
attr_writer :lsock, :rsock
|
194
217
|
end
|
195
|
-
end
|
218
|
+
end
|
219
|
+
end
|
data/lib/rex/io/stream_server.rb
CHANGED
@@ -141,7 +141,7 @@ module Rex
|
|
141
141
|
begin
|
142
142
|
cli = accept
|
143
143
|
unless cli
|
144
|
-
elog(
|
144
|
+
elog('The accept() returned nil in stream server listener monitor')
|
145
145
|
::IO.select(nil, nil, nil, 0.10)
|
146
146
|
next
|
147
147
|
end
|
data/lib/rex/sync/ref.rb
CHANGED
@@ -10,11 +10,38 @@ module Rex
|
|
10
10
|
#
|
11
11
|
###
|
12
12
|
module Ref
|
13
|
+
#
|
14
|
+
# Raises a TypeError to prevent cloning.
|
15
|
+
#
|
16
|
+
def clone
|
17
|
+
raise TypeError, "can't clone instance of Ref #{self.class}"
|
18
|
+
end
|
19
|
+
|
20
|
+
#
|
21
|
+
# Raises a TypeError to prevent duping.
|
22
|
+
#
|
23
|
+
def dup
|
24
|
+
raise TypeError, "can't dup instance of Ref #{self.class}"
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# Ensures that the Ref is correctly initialized when extended on an object:
|
29
|
+
# ```
|
30
|
+
# arbitrary_resource = Resource.new
|
31
|
+
# arbitrary_resource.extend(::Rex::Ref)
|
32
|
+
# ```
|
33
|
+
#
|
34
|
+
# @param instance [object] the instance that has just extended the Ref module
|
35
|
+
def self.extended(instance)
|
36
|
+
instance.refinit
|
37
|
+
end
|
13
38
|
|
14
39
|
#
|
15
40
|
# Initializes the reference count to one.
|
16
41
|
#
|
17
42
|
def refinit
|
43
|
+
return if defined?(@_references)
|
44
|
+
|
18
45
|
@_references = 1
|
19
46
|
@_references_mutex = Mutex.new
|
20
47
|
|
data.tar.gz.sig
CHANGED
@@ -1 +1,3 @@
|
|
1
|
-
|
1
|
+
!�@��`���X)� ��
|
2
|
+
��b���cpi������G�=M���E~{1���})���U�'��/��B�Тn\�?j���սwNT�f?/l6A�oon�Ad6���}W`5�����w��(6�]�T+�G��ܞ8s=ɼ߾�[VX�%��`�������,���Y�;�R{�|x
|
3
|
+
}$Y��i-Uj_��&ĚN�x�=G�����컔�r8��m��ޣk�o��0|hM��ݥD�T��n�uL
|
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.
|
4
|
+
version: 0.1.27
|
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: 2022-
|
96
|
+
date: 2022-03-24 00:00:00.000000000 Z
|
97
97
|
dependencies:
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: rake
|
metadata.gz.sig
CHANGED
Binary file
|