rex-bin_tools 0.1.12 → 0.1.13
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
- data/lib/rex/bin_tools/version.rb +1 -1
- data/lib/rex/elfscan/scanner.rb +35 -4
- data/lib/rex/machscan/scanner.rb +35 -4
- data/lib/rex/pescan/analyze.rb +15 -3
- data/lib/rex/pescan/scanner.rb +35 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8a00458801cfc7194ebfbbd76eea9c275ebf05a024366eccf3501f2de4b6cc80
|
|
4
|
+
data.tar.gz: e15ee4b3499407d8ab9567d2ac0741a13976695173de794527c904238eea1012
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d1c25e07486cbe60112204add101f4c9266cdc505b3d000b82329e61ae5bf2bd048b5012a73a5e7880d6ef60074f4d0386df624c085c1e64561dd668ca5c1a3
|
|
7
|
+
data.tar.gz: f407afa35613d09973d41c1e08ef329a8f7b65640f2ea9d5efbd34b5fb41afe207ffdb0026fcc5cd3d4721faa41597b2eac7f6b885c308db37cd97557123acb3
|
data/lib/rex/elfscan/scanner.rb
CHANGED
|
@@ -75,9 +75,18 @@ class JmpRegScanner < Generic
|
|
|
75
75
|
regexstr += "\xff[#{calls}]|"
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
+
# Adapting to Regexp.new's New Signature in Ruby 3.3+
|
|
78
79
|
regexstr += "\xff[#{jmps}]|([#{pushs1}]|\xff[#{pushs2}])(\xc3|\xc2..))"
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
# Choose initialization method based on Ruby version
|
|
81
|
+
major, minor, _patch = RUBY_VERSION.split('.').map(&:to_i)
|
|
82
|
+
self.regex = if (major > 3) || (major == 3 && minor >= 3)
|
|
83
|
+
# For Ruby 3.3+: explicitly mark as binary pattern and use NOENCODING
|
|
84
|
+
binary_pattern = regexstr.b
|
|
85
|
+
Regexp.new(binary_pattern, Regexp::NOENCODING)
|
|
86
|
+
else
|
|
87
|
+
# For Ruby <= 3.2: use legacy three-argument syntax
|
|
88
|
+
Regexp.new(regexstr, nil, 'n')
|
|
89
|
+
end
|
|
81
90
|
end
|
|
82
91
|
|
|
83
92
|
# build a list for regex of the possible bytes, based on a base
|
|
@@ -156,7 +165,18 @@ class PopPopRetScanner < JmpRegScanner
|
|
|
156
165
|
|
|
157
166
|
def config(param)
|
|
158
167
|
pops = _build_byte_list(0x58, (0 .. 7).to_a - [4]) # we don't want pop esp's...
|
|
159
|
-
|
|
168
|
+
# Adapting to Regexp.new's New Signature in Ruby 3.3+
|
|
169
|
+
pattern = "[#{pops}][#{pops}](\xc3|\xc2..)"
|
|
170
|
+
# Choose initialization method based on Ruby version
|
|
171
|
+
major, minor, _patch = RUBY_VERSION.split('.').map(&:to_i)
|
|
172
|
+
self.regex = if (major > 3) || (major == 3 && minor >= 3)
|
|
173
|
+
# For Ruby 3.3+: explicitly mark as binary pattern and use NOENCODING
|
|
174
|
+
binary_pattern = pattern.b
|
|
175
|
+
Regexp.new(binary_pattern, Regexp::NOENCODING)
|
|
176
|
+
else
|
|
177
|
+
# For Ruby <= 3.2: use legacy three-argument syntax
|
|
178
|
+
Regexp.new(pattern, nil, 'n')
|
|
179
|
+
end
|
|
160
180
|
end
|
|
161
181
|
|
|
162
182
|
def scan_segment(program_header, param={})
|
|
@@ -191,7 +211,18 @@ end
|
|
|
191
211
|
class RegexScanner < JmpRegScanner
|
|
192
212
|
|
|
193
213
|
def config(param)
|
|
194
|
-
|
|
214
|
+
# Adapting to Regexp.new's New Signature in Ruby 3.3+
|
|
215
|
+
pattern = param['args']
|
|
216
|
+
# Choose initialization method based on Ruby version
|
|
217
|
+
major, minor, _patch = RUBY_VERSION.split('.').map(&:to_i)
|
|
218
|
+
self.regex = if (major > 3) || (major == 3 && minor >= 3)
|
|
219
|
+
# For Ruby 3.3+: explicitly mark as binary pattern and use NOENCODING
|
|
220
|
+
binary_pattern = pattern.b
|
|
221
|
+
Regexp.new(binary_pattern, Regexp::NOENCODING)
|
|
222
|
+
else
|
|
223
|
+
# For Ruby <= 3.2: use legacy three-argument syntax
|
|
224
|
+
Regexp.new(pattern, nil, 'n')
|
|
225
|
+
end
|
|
195
226
|
end
|
|
196
227
|
|
|
197
228
|
def scan_segment(program_header, param={})
|
data/lib/rex/machscan/scanner.rb
CHANGED
|
@@ -64,9 +64,18 @@ class JmpRegScanner < Generic
|
|
|
64
64
|
regexstr += "\xff[#{calls}]|"
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
+
# Adapting to Regexp.new's New Signature in Ruby 3.3+
|
|
67
68
|
regexstr += "\xff[#{jmps}]|([#{pushs1}]|\xff[#{pushs2}])(\xc3|\xc2..))"
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
# Choose initialization method based on Ruby version
|
|
70
|
+
major, minor, _patch = RUBY_VERSION.split('.').map(&:to_i)
|
|
71
|
+
self.regex = if (major > 3) || (major == 3 && minor >= 3)
|
|
72
|
+
# For Ruby 3.3+: explicitly mark as binary pattern and use NOENCODING
|
|
73
|
+
binary_pattern = regexstr.b
|
|
74
|
+
Regexp.new(binary_pattern, Regexp::NOENCODING)
|
|
75
|
+
else
|
|
76
|
+
# For Ruby <= 3.2: use legacy three-argument syntax
|
|
77
|
+
Regexp.new(regexstr, nil, 'n')
|
|
78
|
+
end
|
|
70
79
|
end
|
|
71
80
|
|
|
72
81
|
# build a list for regex of the possible bytes, based on a base
|
|
@@ -145,7 +154,18 @@ class PopPopRetScanner < JmpRegScanner
|
|
|
145
154
|
|
|
146
155
|
def config(param)
|
|
147
156
|
pops = _build_byte_list(0x58, (0 .. 7).to_a - [4]) # we don't want pop esp's...
|
|
148
|
-
|
|
157
|
+
# Adapting to Regexp.new's New Signature in Ruby 3.3+
|
|
158
|
+
pattern = "[#{pops}][#{pops}](\xc3|\xc2..)"
|
|
159
|
+
# Choose initialization method based on Ruby version
|
|
160
|
+
major, minor, _patch = RUBY_VERSION.split('.').map(&:to_i)
|
|
161
|
+
self.regex = if (major > 3) || (major == 3 && minor >= 3)
|
|
162
|
+
# For Ruby 3.3+: explicitly mark as binary pattern and use NOENCODING
|
|
163
|
+
binary_pattern = pattern.b
|
|
164
|
+
Regexp.new(binary_pattern, Regexp::NOENCODING)
|
|
165
|
+
else
|
|
166
|
+
# For Ruby <= 3.2: use legacy three-argument syntax
|
|
167
|
+
Regexp.new(pattern, nil, 'n')
|
|
168
|
+
end
|
|
149
169
|
end
|
|
150
170
|
|
|
151
171
|
def scan_segment(segment, param={})
|
|
@@ -181,7 +201,18 @@ end
|
|
|
181
201
|
class RegexScanner < JmpRegScanner
|
|
182
202
|
|
|
183
203
|
def config(param)
|
|
184
|
-
|
|
204
|
+
# Adapting to Regexp.new's New Signature in Ruby 3.3+
|
|
205
|
+
pattern = param['args']
|
|
206
|
+
# Choose initialization method based on Ruby version
|
|
207
|
+
major, minor, _patch = RUBY_VERSION.split('.').map(&:to_i)
|
|
208
|
+
self.regex = if (major > 3) || (major == 3 && minor >= 3)
|
|
209
|
+
# For Ruby 3.3+: explicitly mark as binary pattern and use NOENCODING
|
|
210
|
+
binary_pattern = pattern.b
|
|
211
|
+
Regexp.new(binary_pattern, Regexp::NOENCODING)
|
|
212
|
+
else
|
|
213
|
+
# For Ruby <= 3.2: use legacy three-argument syntax
|
|
214
|
+
Regexp.new(pattern, nil, 'n')
|
|
215
|
+
end
|
|
185
216
|
end
|
|
186
217
|
|
|
187
218
|
def scan_segment(segment, param={})
|
data/lib/rex/pescan/analyze.rb
CHANGED
|
@@ -59,9 +59,21 @@ module Analyze
|
|
|
59
59
|
|
|
60
60
|
@sigs.each_pair do |name, data|
|
|
61
61
|
begin
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
# Adapting to Regexp.new's New Signature in Ruby 3.3+
|
|
63
|
+
pattern = '^' + data[0]
|
|
64
|
+
# Choose initialization method based on Ruby version
|
|
65
|
+
major, minor, _patch = RUBY_VERSION.split('.').map(&:to_i)
|
|
66
|
+
regex = if (major > 3) || (major == 3 && minor >= 3)
|
|
67
|
+
# For Ruby 3.3+: explicitly mark as binary pattern and use NOENCODING
|
|
68
|
+
binary_pattern = pattern.b
|
|
69
|
+
Regexp.new(binary_pattern, Regexp::NOENCODING)
|
|
70
|
+
else
|
|
71
|
+
# For Ruby <= 3.2: use legacy three-argument syntax
|
|
72
|
+
Regexp.new(pattern, nil, 'n')
|
|
73
|
+
end
|
|
74
|
+
if (buf.match(regex))
|
|
75
|
+
$stdout.puts param['file'] + ": " + name
|
|
76
|
+
end
|
|
65
77
|
rescue RegexpError
|
|
66
78
|
$stderr.puts "Invalid signature: #{name} #{data[0]}"
|
|
67
79
|
end
|
data/lib/rex/pescan/scanner.rb
CHANGED
|
@@ -80,9 +80,18 @@ module Scanner
|
|
|
80
80
|
regexstr += "\xff[#{calls}]|"
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
+
# Adapting to Regexp.new's New Signature in Ruby 3.3+
|
|
83
84
|
regexstr += "\xff[#{jmps}]|([#{pushs1}]|\xff[#{pushs2}])(\xc3|\xc2..))"
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
# Choose initialization method based on Ruby version
|
|
86
|
+
major, minor, _patch = RUBY_VERSION.split('.').map(&:to_i)
|
|
87
|
+
self.regex = if (major > 3) || (major == 3 && minor >= 3)
|
|
88
|
+
# For Ruby 3.3+: explicitly mark as binary pattern and use NOENCODING
|
|
89
|
+
binary_pattern = regexstr.b
|
|
90
|
+
Regexp.new(binary_pattern, Regexp::NOENCODING)
|
|
91
|
+
else
|
|
92
|
+
# For Ruby <= 3.2: use legacy three-argument syntax
|
|
93
|
+
Regexp.new(regexstr, nil, 'n')
|
|
94
|
+
end
|
|
86
95
|
end
|
|
87
96
|
|
|
88
97
|
# build a list for regex of the possible bytes, based on a base
|
|
@@ -161,7 +170,18 @@ module Scanner
|
|
|
161
170
|
|
|
162
171
|
def config(param)
|
|
163
172
|
pops = _build_byte_list(0x58, (0 .. 7).to_a - [4]) # we don't want pop esp's...
|
|
164
|
-
|
|
173
|
+
# Adapting to Regexp.new's New Signature in Ruby 3.3+
|
|
174
|
+
pattern = "[#{pops}][#{pops}](\xc3|\xc2..)"
|
|
175
|
+
# Choose initialization method based on Ruby version
|
|
176
|
+
major, minor, _patch = RUBY_VERSION.split('.').map(&:to_i)
|
|
177
|
+
self.regex = if (major > 3) || (major == 3 && minor >= 3)
|
|
178
|
+
# For Ruby 3.3+: explicitly mark as binary pattern and use NOENCODING
|
|
179
|
+
binary_pattern = pattern.b
|
|
180
|
+
Regexp.new(binary_pattern, Regexp::NOENCODING)
|
|
181
|
+
else
|
|
182
|
+
# For Ruby <= 3.2: use legacy three-argument syntax
|
|
183
|
+
Regexp.new(pattern, nil, 'n')
|
|
184
|
+
end
|
|
165
185
|
end
|
|
166
186
|
|
|
167
187
|
def scan_section(section, param={})
|
|
@@ -195,7 +215,18 @@ module Scanner
|
|
|
195
215
|
class RegexScanner < Generic
|
|
196
216
|
|
|
197
217
|
def config(param)
|
|
198
|
-
|
|
218
|
+
# Adapting to Regexp.new's New Signature in Ruby 3.3+
|
|
219
|
+
pattern = param['args']
|
|
220
|
+
# Choose initialization method based on Ruby version
|
|
221
|
+
major, minor, _patch = RUBY_VERSION.split('.').map(&:to_i)
|
|
222
|
+
self.regex = if (major > 3) || (major == 3 && minor >= 3)
|
|
223
|
+
# For Ruby 3.3+: explicitly mark as binary pattern and use NOENCODING
|
|
224
|
+
binary_pattern = pattern.b
|
|
225
|
+
Regexp.new(binary_pattern, Regexp::NOENCODING)
|
|
226
|
+
else
|
|
227
|
+
# For Ruby <= 3.2: use legacy three-argument syntax
|
|
228
|
+
Regexp.new(pattern, nil, 'n')
|
|
229
|
+
end
|
|
199
230
|
end
|
|
200
231
|
|
|
201
232
|
def scan_section(section, param={})
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rex-bin_tools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Metasploit Hackers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-03-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|