pwn 0.5.715 → 0.5.717
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/Gemfile +1 -1
- data/lib/pwn/plugins/detect_os.rb +61 -18
- data/lib/pwn/version.rb +1 -1
- data/spec/lib/pwn/plugins/detect_os_spec.rb +14 -9
- data/third_party/pwn_rdoc.jsonl +4 -2
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c6266cb10d6689157a8e862bb114b93fd248173dc41d54fefc61811eec250b92
|
|
4
|
+
data.tar.gz: 23af34c586cbc654a49253d2b6fc83e88da3a8a1bb6178c856d371b64a414767
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c133002fa87a475a67777dcad319588a3d5d0626313829a5587ae02b4e87998ba5d13448c2f0712bbc73e7eb5d0f28fcee8916b52cdeb19170adca43d5d70a3c
|
|
7
|
+
data.tar.gz: 94790256a870bb3b1b7c4f9e1f8ff26c1ebc0509d0b69738488d9679368ceb8caf62ad9daeb8737f16e9c6a40339850e574a90509855c607030d70132fd58627
|
data/Gemfile
CHANGED
|
@@ -27,6 +27,16 @@ module PWN
|
|
|
27
27
|
'mswin' => :windows
|
|
28
28
|
}.freeze
|
|
29
29
|
|
|
30
|
+
PATH_NOISE = %w[
|
|
31
|
+
sh bash zsh fish csh tcsh dash true false echo test pwd ls cat cp mv rm
|
|
32
|
+
mkdir rmdir chmod chown chgrp ln touch head tail more less grep egrep fgrep
|
|
33
|
+
sed awk sort uniq wc find xargs tar gzip gunzip zcat bzip2 xz make
|
|
34
|
+
python python2 python3 ruby perl php node java git svn hg
|
|
35
|
+
vi vim nvi nano ed ex
|
|
36
|
+
apt apt-get dpkg rpm yum dnf pacman brew port pkg pkg_add
|
|
37
|
+
sudo doas su login id whoami uname hostname env export
|
|
38
|
+
].freeze
|
|
39
|
+
|
|
30
40
|
public_class_method def self.type
|
|
31
41
|
os = :cygwin if OS.cygwin?
|
|
32
42
|
os = :freebsd if OS.freebsd?
|
|
@@ -162,7 +172,8 @@ module PWN
|
|
|
162
172
|
# PWN::Plugins::DetectOS.living_off_the_land(
|
|
163
173
|
# os_release: 'optional - /etc/os-release body (defaults to reading the file)',
|
|
164
174
|
# which: 'optional - Hash of binary name => present Boolean (skips live PATH)',
|
|
165
|
-
# bins: 'optional - extra binary names to
|
|
175
|
+
# bins: 'optional - extra host binary names to include when present',
|
|
176
|
+
# pwn_bins: 'optional - Array of names pwn setup already installs (skipped)'
|
|
166
177
|
# )
|
|
167
178
|
|
|
168
179
|
public_class_method def self.living_off_the_land(opts = {})
|
|
@@ -171,18 +182,18 @@ module PWN
|
|
|
171
182
|
ver = version(opts)
|
|
172
183
|
cpu = opts[:arch] || arch
|
|
173
184
|
endn = opts[:endian] || endian
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
ok = if which.is_a?(Hash)
|
|
180
|
-
which[name] || which[name.to_sym]
|
|
185
|
+
found = host_path_names(opts)
|
|
186
|
+
extra = Array(opts[:bins]).map(&:to_s).reject(&:empty?)
|
|
187
|
+
extra.each do |name|
|
|
188
|
+
ok = if opts[:which].is_a?(Hash)
|
|
189
|
+
opts[:which][name] || opts[:which][name.to_sym]
|
|
181
190
|
else
|
|
182
191
|
bin_present?(name: name)
|
|
183
192
|
end
|
|
184
|
-
|
|
193
|
+
found << name if ok
|
|
185
194
|
end
|
|
195
|
+
owned = pwn_installed_bins(pwn_bins: opts[:pwn_bins])
|
|
196
|
+
native = (found.map(&:to_s) - owned - PATH_NOISE).reject(&:empty?).uniq.sort
|
|
186
197
|
cap = if opts.key?(:cap_net_raw)
|
|
187
198
|
opts[:cap_net_raw]
|
|
188
199
|
else
|
|
@@ -193,15 +204,14 @@ module PWN
|
|
|
193
204
|
else
|
|
194
205
|
docker_live
|
|
195
206
|
end
|
|
196
|
-
summary = "#{flavor} #{ver} #{cpu}
|
|
207
|
+
summary = "#{flavor} #{ver} #{cpu}"
|
|
197
208
|
{
|
|
198
209
|
type: os_type,
|
|
199
210
|
distro: flavor,
|
|
200
211
|
version: ver,
|
|
201
212
|
arch: cpu.to_s,
|
|
202
213
|
endian: endn,
|
|
203
|
-
|
|
204
|
-
missing: missing,
|
|
214
|
+
native: native,
|
|
205
215
|
cap_net_raw: cap,
|
|
206
216
|
docker: docker,
|
|
207
217
|
summary: summary
|
|
@@ -250,14 +260,15 @@ module PWN
|
|
|
250
260
|
version: 'optional - force a version string instead of detecting'
|
|
251
261
|
)
|
|
252
262
|
|
|
253
|
-
#
|
|
263
|
+
# Inventory extra PATH binaries on this host that pwn plugins do not already wrap.
|
|
254
264
|
#{self}.living_off_the_land(
|
|
255
265
|
os_release: 'optional - /etc/os-release body (defaults to reading the file)',
|
|
256
266
|
lsb_release: 'optional - /etc/lsb-release body',
|
|
257
267
|
build_prop: 'optional - Android /system/build.prop body',
|
|
258
268
|
type: 'optional - OS family from #type',
|
|
259
269
|
which: 'optional - Hash of binary name => true/false (skips live PATH when set)',
|
|
260
|
-
bins: 'optional - extra binary names to
|
|
270
|
+
bins: 'optional - extra host binary names to include when present on PATH',
|
|
271
|
+
pwn_bins: 'optional - extra names to treat as already wrapped (skipped from native)',
|
|
261
272
|
arch: 'optional - CPU arch override',
|
|
262
273
|
endian: 'optional - :little or :big override',
|
|
263
274
|
cap_net_raw: 'optional - Boolean CAP_NET_RAW override',
|
|
@@ -270,14 +281,46 @@ module PWN
|
|
|
270
281
|
constants.sort
|
|
271
282
|
end
|
|
272
283
|
|
|
273
|
-
private_class_method def self.
|
|
274
|
-
|
|
284
|
+
private_class_method def self.host_path_names(opts = {})
|
|
285
|
+
return Array(opts[:path_names]).map(&:to_s) if opts.key?(:path_names)
|
|
286
|
+
|
|
287
|
+
if opts.key?(:which)
|
|
288
|
+
which = opts[:which]
|
|
289
|
+
return [] unless which.is_a?(Hash)
|
|
290
|
+
|
|
291
|
+
return which.select { |_n, ok| ok }.keys.map(&:to_s)
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
scan_path_executables
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
private_class_method def self.scan_path_executables(opts = {})
|
|
298
|
+
return [] if opts[:skip]
|
|
299
|
+
|
|
300
|
+
names = []
|
|
301
|
+
ENV.fetch('PATH', '').split(File::PATH_SEPARATOR).each do |dir|
|
|
302
|
+
next unless File.directory?(dir)
|
|
303
|
+
|
|
304
|
+
Dir.children(dir).each do |base|
|
|
305
|
+
path = File.join(dir, base)
|
|
306
|
+
next unless File.file?(path) && File.executable?(path)
|
|
307
|
+
|
|
308
|
+
names << base.sub(/\.(exe|bat|cmd|com)\z/i, '')
|
|
309
|
+
end
|
|
310
|
+
rescue StandardError
|
|
311
|
+
next
|
|
312
|
+
end
|
|
313
|
+
names.uniq
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
private_class_method def self.pwn_installed_bins(opts = {})
|
|
317
|
+
extra = Array(opts[:pwn_bins]).map(&:to_s)
|
|
275
318
|
deps = if defined?(PWN::Plugins::PreflightChecker::PLUGIN_DEPS)
|
|
276
|
-
PWN::Plugins::PreflightChecker::PLUGIN_DEPS.values.flat_map { |row| Array(row[:bins]) }
|
|
319
|
+
PWN::Plugins::PreflightChecker::PLUGIN_DEPS.values.flat_map { |row| Array(row[:bins]).map(&:to_s) }
|
|
277
320
|
else
|
|
278
321
|
[]
|
|
279
322
|
end
|
|
280
|
-
(
|
|
323
|
+
(extra + deps).reject(&:empty?).uniq
|
|
281
324
|
end
|
|
282
325
|
|
|
283
326
|
private_class_method def self.bin_present?(opts = {})
|
data/lib/pwn/version.rb
CHANGED
|
@@ -64,42 +64,47 @@ describe PWN::Plugins::DetectOS do
|
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
describe '.living_off_the_land' do
|
|
67
|
-
it '
|
|
67
|
+
it 'reports extra PATH binaries that pwn setup does not install' do
|
|
68
68
|
body = "ID=kali\nVERSION_ID=\"2026.3\"\n"
|
|
69
69
|
row = described_class.living_off_the_land(
|
|
70
70
|
os_release: body,
|
|
71
71
|
type: :linux,
|
|
72
|
-
|
|
72
|
+
pwn_bins: %w[gdb r2 nuclei],
|
|
73
|
+
which: { 'jq' => true, 'gdb' => true, 'r2' => true, 'yara' => true, 'nuclei' => false }
|
|
73
74
|
)
|
|
74
75
|
expect(row[:distro]).to eq(:kali)
|
|
75
76
|
expect(row[:version]).to eq('2026.3')
|
|
76
77
|
expect(row[:arch]).to be_a(String)
|
|
77
78
|
expect(row[:endian]).to be_a(Symbol)
|
|
78
|
-
expect(row[:
|
|
79
|
-
expect(row[:
|
|
80
|
-
expect(row
|
|
79
|
+
expect(row[:native]).to include('jq', 'yara')
|
|
80
|
+
expect(row[:native]).not_to include('gdb', 'r2', 'nuclei')
|
|
81
|
+
expect(row).not_to have_key(:missing)
|
|
81
82
|
expect(row[:summary]).to include('kali')
|
|
82
|
-
expect(row[:summary]).
|
|
83
|
+
expect(row[:summary]).not_to include('missing=')
|
|
83
84
|
end
|
|
84
85
|
|
|
85
86
|
it 'does not fall through to live os-release when fixtures are passed' do
|
|
86
87
|
row = described_class.living_off_the_land(
|
|
87
88
|
os_release: "ID=alpine\nVERSION_ID=3.20.0\n",
|
|
88
89
|
type: :linux,
|
|
90
|
+
pwn_bins: %w[],
|
|
89
91
|
which: {}
|
|
90
92
|
)
|
|
91
93
|
expect(row[:distro]).to eq(:alpine)
|
|
92
94
|
expect(row[:version]).to eq('3.20.0')
|
|
95
|
+
expect(row[:native]).to eq([])
|
|
93
96
|
end
|
|
94
97
|
|
|
95
|
-
it '
|
|
98
|
+
it 'does not treat plugin required_bins gaps as the inventory' do
|
|
96
99
|
row = described_class.living_off_the_land(
|
|
97
100
|
os_release: "ID=debian\nVERSION_ID=12\n",
|
|
98
101
|
type: :linux,
|
|
102
|
+
pwn_bins: %w[gdb r2],
|
|
99
103
|
bins: %w[jq],
|
|
100
|
-
which: { 'jq' => true }
|
|
104
|
+
which: { 'jq' => true, 'gdb' => false }
|
|
101
105
|
)
|
|
102
|
-
expect(row[:
|
|
106
|
+
expect(row[:native]).to include('jq')
|
|
107
|
+
expect(row[:native]).not_to include('gdb')
|
|
103
108
|
end
|
|
104
109
|
end
|
|
105
110
|
end
|
data/third_party/pwn_rdoc.jsonl
CHANGED
|
@@ -1974,16 +1974,18 @@
|
|
|
1974
1974
|
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.docker_live Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.docker_live`: "}]}
|
|
1975
1975
|
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.endian Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.endian`: "}]}
|
|
1976
1976
|
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.help Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.help`: "}]}
|
|
1977
|
-
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.
|
|
1977
|
+
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.host_path_names Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.host_path_names`: "}]}
|
|
1978
1978
|
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.ios_host? Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.ios_host?`: "}]}
|
|
1979
1979
|
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.live_sw_vers Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.live_sw_vers`: "}]}
|
|
1980
1980
|
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.live_uname_r Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.live_uname_r`: "}]}
|
|
1981
1981
|
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.live_uname_s Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.live_uname_s`: "}]}
|
|
1982
1982
|
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.live_win_ver Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.live_win_ver`: "}]}
|
|
1983
|
-
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.living_off_the_land Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.living_off_the_land`: Supported Method Parameters\n\nPWN::Plugins::DetectOS.living_off_the_land(\n\nos_release: 'optional - /etc/os-release body (defaults to reading the file)',\nwhich: 'optional - Hash of binary name => present Boolean (skips live PATH)',\nbins: 'optional - extra binary names to
|
|
1983
|
+
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.living_off_the_land Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.living_off_the_land`: Supported Method Parameters\n\nPWN::Plugins::DetectOS.living_off_the_land(\n\nos_release: 'optional - /etc/os-release body (defaults to reading the file)',\nwhich: 'optional - Hash of binary name => present Boolean (skips live PATH)',\nbins: 'optional - extra host binary names to include when present',\npwn_bins: 'optional - Array of names pwn setup already installs (skipped)'\n\n)\n"}]}
|
|
1984
1984
|
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.normalize_id Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.normalize_id`: "}]}
|
|
1985
1985
|
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.parse_kv Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.parse_kv`: "}]}
|
|
1986
|
+
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.pwn_installed_bins Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.pwn_installed_bins`: "}]}
|
|
1986
1987
|
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.read_if_present Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.read_if_present`: "}]}
|
|
1988
|
+
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.scan_path_executables Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.scan_path_executables`: "}]}
|
|
1987
1989
|
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.type Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.type`: "}]}
|
|
1988
1990
|
{"messages":[{"role":"user","content":"PWN::Plugins::DetectOS.version Usage"},{"role":"assistant","content":"`PWN::Plugins::DetectOS.version`: Supported Method Parameters\n\nPWN::Plugins::DetectOS.version(\n\nos_release: 'optional - /etc/os-release body',\nlsb_release: 'optional - /etc/lsb-release body',\nbuild_prop: 'optional - Android build.prop body',\nsw_vers: 'optional - macOS/iOS product version',\nwin_ver: 'optional - Windows ver output',\nuname_r: 'optional - uname -r string',\ntype: 'optional - OS family from #type'\n\n)\n"}]}
|
|
1989
1991
|
{"messages":[{"role":"user","content":"PWN::Plugins::EIN.authors Usage"},{"role":"assistant","content":"`PWN::Plugins::EIN.authors`: Author(s)\n\n0day Inc. <support@0dayinc.com>\n"}]}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pwn
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.717
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- 0day Inc.
|
|
@@ -141,14 +141,14 @@ dependencies:
|
|
|
141
141
|
requirements:
|
|
142
142
|
- - ">="
|
|
143
143
|
- !ruby/object:Gem::Version
|
|
144
|
-
version: 4.0.
|
|
144
|
+
version: 4.0.20
|
|
145
145
|
type: :development
|
|
146
146
|
prerelease: false
|
|
147
147
|
version_requirements: !ruby/object:Gem::Requirement
|
|
148
148
|
requirements:
|
|
149
149
|
- - ">="
|
|
150
150
|
- !ruby/object:Gem::Version
|
|
151
|
-
version: 4.0.
|
|
151
|
+
version: 4.0.20
|
|
152
152
|
- !ruby/object:Gem::Dependency
|
|
153
153
|
name: bundler-audit
|
|
154
154
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -6862,7 +6862,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
6862
6862
|
- !ruby/object:Gem::Version
|
|
6863
6863
|
version: '0'
|
|
6864
6864
|
requirements: []
|
|
6865
|
-
rubygems_version: 4.0.
|
|
6865
|
+
rubygems_version: 4.0.20
|
|
6866
6866
|
specification_version: 4
|
|
6867
6867
|
summary: Automated Security Testing for CI/CD Pipelines & Beyond
|
|
6868
6868
|
test_files: []
|