pwn 0.5.800 → 0.5.802
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/Rakefile +1 -1
- data/lib/pwn/plugins/jobs.rb +57 -25
- data/lib/pwn/version.rb +1 -1
- data/spec/integration/rake_example_timing_spec.rb +64 -0
- data/spec/lib/pwn/plugins/plugins_b_operational_regression_spec.rb +29 -5
- data/spec/lib/pwn/plugins/repl_mesh_dm_transport_spec.rb +1 -0
- data/spec/lib/pwn/plugins/repl_mesh_key_exchange_spec.rb +3 -0
- data/spec/lib/pwn/plugins/repl_spec.rb +3 -0
- data/spec/lib/pwn/sdr/decoder/base_spec.rb +3 -1
- data/spec/lib/pwn/sessions_spec.rb +3 -0
- data/spec/lib/pwn/www/login_yubikey_spec.rb +2 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/support/gate_failure_formatter.rb +30 -5
- data/third_party/pwn_rdoc.jsonl +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 80052ce5d8a763fc4bc6909d6335b59c7a3aaf5cbb201a60ac10d637c7138bb5
|
|
4
|
+
data.tar.gz: 679d21109b6baead7be731bc85e9cc89ac9227af20f5caa61ef49c6ec92494cc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5761d5ab7b986ce9790d840426620470e5b5f72711c3f12df210c85edac5e63725f456770e96af6d27a39ae6be895f3b63c53640c7088d770e39aea93a728b97
|
|
7
|
+
data.tar.gz: 7fb6b534ca7f69574ec430d5b85ae99cafee9dd1f3045b6e18657cd8855e68c0aea0e473936feff1951e15ee9d9796ed33ff3a8110bb5773503744482b8167b1
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
|
@@ -27,7 +27,7 @@ class DiagnosticSpecTask < RSpec::Core::RakeTask
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
DiagnosticSpecTask.new(:spec) do |task|
|
|
30
|
-
task.rspec_opts = "#{task.rspec_opts} --require ./spec/support/gate_failure_formatter.rb --format
|
|
30
|
+
task.rspec_opts = "#{task.rspec_opts} --require ./spec/support/gate_failure_formatter.rb --format GateFailureFormatter"
|
|
31
31
|
end
|
|
32
32
|
task :silence_rspec_filter_banner do
|
|
33
33
|
ENV['PWN_RAKE_SPEC'] = '1'
|
data/lib/pwn/plugins/jobs.rb
CHANGED
|
@@ -16,6 +16,25 @@ module PWN
|
|
|
16
16
|
module Jobs
|
|
17
17
|
JOBS_DIR = File.join(Dir.home, '.pwn', 'jobs')
|
|
18
18
|
|
|
19
|
+
# Do not start the command until its process group is owned and its deadline is still live.
|
|
20
|
+
# FD 3 reports launch failures only; successful exec closes it before any job code runs.
|
|
21
|
+
GRAPH_LAUNCH = <<~RUBY
|
|
22
|
+
status = IO.for_fd(3)
|
|
23
|
+
status.close_on_exec = true
|
|
24
|
+
exit! 124 unless STDIN.getbyte == 1
|
|
25
|
+
if Process.clock_gettime(Process::CLOCK_MONOTONIC) >= Float(ARGV.fetch(0))
|
|
26
|
+
status.syswrite('timeout')
|
|
27
|
+
exit! 124
|
|
28
|
+
end
|
|
29
|
+
begin
|
|
30
|
+
exec(ARGV.fetch(1))
|
|
31
|
+
rescue SystemCallError => e
|
|
32
|
+
status.syswrite(e.errno.to_s)
|
|
33
|
+
exit! 127
|
|
34
|
+
end
|
|
35
|
+
RUBY
|
|
36
|
+
private_constant :GRAPH_LAUNCH
|
|
37
|
+
|
|
19
38
|
public_class_method def self.required_bins
|
|
20
39
|
[]
|
|
21
40
|
end
|
|
@@ -209,8 +228,6 @@ module PWN
|
|
|
209
228
|
Thread.new do
|
|
210
229
|
timeout = (job[:timeout] || opts[:timeout]).to_f
|
|
211
230
|
timeout = 3_600 if timeout <= 0
|
|
212
|
-
out = err = ''
|
|
213
|
-
st = nil
|
|
214
231
|
signaled = false
|
|
215
232
|
notify = lambda do
|
|
216
233
|
next if signaled
|
|
@@ -219,12 +236,10 @@ module PWN
|
|
|
219
236
|
started << true
|
|
220
237
|
end
|
|
221
238
|
begin
|
|
222
|
-
|
|
223
|
-
out, err, st = capture_graph(command: job[:command].to_s, dir: dir, groups: groups, started: notify)
|
|
224
|
-
end
|
|
239
|
+
out, err, st = capture_graph(command: job[:command].to_s, dir: dir, groups: groups, started: notify, timeout: timeout)
|
|
225
240
|
{ id: job[:id], ok: st.success?, stdout: out, stderr: err, exit: st.exitstatus }
|
|
226
241
|
rescue Timeout::Error
|
|
227
|
-
{ id: job[:id], ok: false, stdout:
|
|
242
|
+
{ id: job[:id], ok: false, stdout: '', stderr: 'timeout', exit: 124, timeout: true }
|
|
228
243
|
ensure
|
|
229
244
|
notify.call
|
|
230
245
|
end
|
|
@@ -250,29 +265,46 @@ module PWN
|
|
|
250
265
|
end
|
|
251
266
|
|
|
252
267
|
private_class_method def self.capture_graph(opts = {})
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
opts[:
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
[readers[0].value, readers[1].value, waiter.value]
|
|
260
|
-
ensure
|
|
261
|
-
if waiter.alive? || readers.any?(&:alive?)
|
|
262
|
-
begin
|
|
263
|
-
Process.kill('KILL', -waiter.pid)
|
|
264
|
-
rescue Errno::ESRCH, Errno::EPERM
|
|
265
|
-
nil
|
|
266
|
-
end
|
|
267
|
-
end
|
|
268
|
-
readers.each do |thread|
|
|
269
|
-
thread.kill if thread.alive?
|
|
270
|
-
thread.join
|
|
271
|
-
end
|
|
268
|
+
deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC) + opts.fetch(:timeout)
|
|
269
|
+
launcher = [RbConfig.ruby, '--disable=gems,rubyopt', '-e', GRAPH_LAUNCH, '--', deadline.to_s, opts.fetch(:command)]
|
|
270
|
+
IO.pipe do |status, writer|
|
|
271
|
+
Open3.popen3(*launcher, 3 => writer, chdir: opts[:dir], pgroup: true) do |stdin, stdout, stderr, waiter|
|
|
272
|
+
writer.close
|
|
273
|
+
capture_owned_graph(opts.merge(deadline: deadline, stdin: stdin, outputs: [stdout, stderr], waiter: waiter, status: status))
|
|
272
274
|
end
|
|
273
275
|
end
|
|
274
276
|
end
|
|
275
277
|
|
|
278
|
+
private_class_method def self.capture_owned_graph(opts = {})
|
|
279
|
+
waiter = opts.fetch(:waiter)
|
|
280
|
+
deadline = opts.fetch(:deadline)
|
|
281
|
+
readers = []
|
|
282
|
+
finished = false
|
|
283
|
+
opts.fetch(:groups) << waiter.pid
|
|
284
|
+
opts.fetch(:started).call
|
|
285
|
+
raise Timeout::Error if Process.clock_gettime(Process::CLOCK_MONOTONIC) >= deadline
|
|
286
|
+
|
|
287
|
+
opts[:stdin].write("\x01")
|
|
288
|
+
opts[:stdin].close
|
|
289
|
+
readers = opts[:outputs].map { |io| Thread.new { io.read } }
|
|
290
|
+
[*readers, waiter].each do |thread|
|
|
291
|
+
remaining = deadline - Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
292
|
+
raise Timeout::Error unless remaining.positive? && thread.join(remaining)
|
|
293
|
+
end
|
|
294
|
+
finished = true
|
|
295
|
+
status = opts[:status].read
|
|
296
|
+
raise Timeout::Error if status == 'timeout'
|
|
297
|
+
raise SystemCallError.new(opts[:command], Integer(status)) unless status.empty?
|
|
298
|
+
|
|
299
|
+
[readers[0].value, readers[1].value, waiter.value]
|
|
300
|
+
ensure
|
|
301
|
+
cancel_graph(groups: [waiter.pid]) if waiter && !finished
|
|
302
|
+
readers&.each do |thread|
|
|
303
|
+
thread.kill if thread.alive?
|
|
304
|
+
thread.join
|
|
305
|
+
end
|
|
306
|
+
end
|
|
307
|
+
|
|
276
308
|
private_class_method def self.cancel_graph(opts = {})
|
|
277
309
|
Array(opts[:groups]).uniq.each do |pid|
|
|
278
310
|
Process.kill('KILL', -pid)
|
data/lib/pwn/version.rb
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'json'
|
|
5
|
+
require 'open3'
|
|
6
|
+
|
|
7
|
+
RSpec.describe 'rake spec timing output' do
|
|
8
|
+
it 'prints one timed stdout row per selected example and keeps failure diagnostics' do
|
|
9
|
+
Dir.mktmpdir('pwn-rake-timing') do |dir|
|
|
10
|
+
file = File.join(dir, 'timing_spec.rb')
|
|
11
|
+
report = File.join(dir, 'results.json')
|
|
12
|
+
File.write(file, <<~RUBY)
|
|
13
|
+
require 'spec_helper'
|
|
14
|
+
RSpec.configure { |c| c.add_formatter('json', ENV.fetch('TIMING_REPORT')) }
|
|
15
|
+
RSpec.describe 'formatter fixture' do
|
|
16
|
+
it 'passes', :measured do
|
|
17
|
+
sleep 0.01
|
|
18
|
+
STDOUT.puts 'fixture output must stay hidden'
|
|
19
|
+
end
|
|
20
|
+
it('fails', :measured) { raise 'timing fixture failure' }
|
|
21
|
+
it('is pending', :measured)
|
|
22
|
+
it('is filtered out') { raise 'unexpected execution' }
|
|
23
|
+
end
|
|
24
|
+
RUBY
|
|
25
|
+
env = {
|
|
26
|
+
'SPEC' => file, 'PWN_SPEC_VERBOSE' => nil, 'TIMING_REPORT' => report,
|
|
27
|
+
'SPEC_OPTS' => '--tag measured --order defined'
|
|
28
|
+
}
|
|
29
|
+
stdout, stderr, status = Open3.capture3(env, RbConfig.ruby, Gem.bin_path('rake', 'rake'), 'spec', chdir: File.expand_path('../..', __dir__))
|
|
30
|
+
expect(status.exitstatus).to eq(1), stderr
|
|
31
|
+
results = JSON.parse(File.read(report)).fetch('examples')
|
|
32
|
+
expect(results.map { |ex| ex.fetch('status') }).to eq(%w[passed failed pending])
|
|
33
|
+
expect(results.first.fetch('run_time')).to be >= 0.01
|
|
34
|
+
rows = results.map.with_index(1) do |ex, n|
|
|
35
|
+
format("[#{n}/3] #{file}:#{ex.fetch('line_number')} %<seconds>.6fs", seconds: ex.fetch('run_time'))
|
|
36
|
+
end
|
|
37
|
+
expect(stdout.lines.map(&:chomp).grep(%r{^\[\d+/})).to eq(rows)
|
|
38
|
+
expect(stdout).not_to include('fixture output must stay hidden')
|
|
39
|
+
expect(stdout).not_to match(/^[.F*]+$/)
|
|
40
|
+
expect(stdout.index('timing fixture failure')).to be < stdout.index(rows.last)
|
|
41
|
+
expect(stdout).to include('3 examples, 1 failure, 1 pending')
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
RSpec.describe GateFailureFormatter do
|
|
47
|
+
it 'colors only the duration on a terminal, using the unrounded runtime for both thresholds' do
|
|
48
|
+
stream = StringIO.new
|
|
49
|
+
allow(stream).to receive(:tty?).and_return(true)
|
|
50
|
+
allow(RSpec.configuration).to receive(:color_mode).and_return(:automatic)
|
|
51
|
+
allow(ENV).to receive(:[]).and_call_original
|
|
52
|
+
allow(ENV).to receive(:[]).with('NO_COLOR').and_return(nil)
|
|
53
|
+
formatter = described_class.new(stream)
|
|
54
|
+
cases = [[0.9999999, 32], [1.0, 33], [5.0, 33], [10.0, 33], [10.0000001, 31]]
|
|
55
|
+
formatter.start(RSpec::Core::Notifications::StartNotification.new(cases.size, 0))
|
|
56
|
+
expected = cases.map.with_index(1) do |(seconds, code), n|
|
|
57
|
+
result = instance_double(RSpec::Core::Example::ExecutionResult, run_time: seconds)
|
|
58
|
+
example = instance_double(RSpec::Core::Example, metadata: { absolute_file_path: __FILE__, line_number: n }, execution_result: result)
|
|
59
|
+
formatter.example_finished(RSpec::Core::Notifications::ExampleNotification.new(example))
|
|
60
|
+
format("[#{n}/#{cases.size}] #{__FILE__}:#{n} \e[#{code}m%<seconds>.6fs\e[0m", seconds: seconds)
|
|
61
|
+
end
|
|
62
|
+
expect(stream.string.lines.map(&:chomp)).to eq(expected)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'spec_helper'
|
|
4
|
+
require 'shellwords'
|
|
4
5
|
require 'tmpdir'
|
|
5
6
|
|
|
6
7
|
RSpec.describe PWN::Plugins::DAOLDAP do
|
|
@@ -286,11 +287,34 @@ RSpec.describe PWN::Plugins::BinaryParser do
|
|
|
286
287
|
end
|
|
287
288
|
|
|
288
289
|
RSpec.describe PWN::Plugins::Jobs do
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
290
|
+
%i[capture spawn_handoff].each do |phase|
|
|
291
|
+
it "[B025] terminates a timed-out graph command before its later write (#{phase})" do
|
|
292
|
+
Dir.mktmpdir('pwn-graph-deadline-') do |dir|
|
|
293
|
+
File.write(File.join(dir, 'slow.rb'), <<~RUBY)
|
|
294
|
+
require 'timeout'
|
|
295
|
+
Timeout.timeout(5) { sleep 0.01 until File.exist?('release') }
|
|
296
|
+
File.write('marker', 'late')
|
|
297
|
+
RUBY
|
|
298
|
+
waiter = nil
|
|
299
|
+
allow(Open3).to receive(:popen3).and_wrap_original do |open, *args, **opts, &capture|
|
|
300
|
+
open.call(*args, **opts) do |*handles|
|
|
301
|
+
waiter = handles.last
|
|
302
|
+
if phase == :spawn_handoff
|
|
303
|
+
sleep 0.1 # The deadline expires while Open3 still owns the handles.
|
|
304
|
+
File.write(File.join(dir, 'release'), 'go')
|
|
305
|
+
waiter.join(0.3) # An unguarded payload can write and exit before capture is called.
|
|
306
|
+
end
|
|
307
|
+
capture.call(*handles)
|
|
308
|
+
ensure
|
|
309
|
+
# Also expose a survivor of normal capture cleanup before Open3 joins it.
|
|
310
|
+
File.write(File.join(dir, 'release'), 'go')
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
graph = described_class.graph(artifact_dir: dir, jobs: [{ id: 'slow', command: Shellwords.join([RbConfig.ruby, 'slow.rb']), timeout: 0.05 }])
|
|
314
|
+
expect(graph[:jobs]['slow']).to include(ok: false, timeout: true, exit: 124)
|
|
315
|
+
expect(File.exist?(File.join(dir, 'marker'))).to be(false)
|
|
316
|
+
expect(waiter.value).to be_signaled.or have_attributes(exitstatus: 124)
|
|
317
|
+
end
|
|
294
318
|
end
|
|
295
319
|
end
|
|
296
320
|
end
|
|
@@ -18,6 +18,7 @@ describe PWN::Plugins::REPL, 'mesh DM transport replay' do
|
|
|
18
18
|
packet = nil
|
|
19
19
|
allow(Meshtastic::Serial).to receive(:send_to_radio) do |opts|
|
|
20
20
|
packet = Meshtastic::ToRadio.decode(opts[:to_radio]).packet
|
|
21
|
+
sender[:proto_data] << { packet: { decoded: { portnum: :ROUTING_APP, request_id: packet.id, payload: { error_reason: :NONE } } } }
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
described_class.pwn_mesh_dispatch_slash!(request: '/msg !bbccddee hello receiver', env: env, pry: :fixture)
|
|
@@ -27,6 +27,8 @@ describe PWN::Plugins::REPL, 'mesh DM key exchange' do
|
|
|
27
27
|
expect(packet.decoded.want_response).to eq(true)
|
|
28
28
|
expect(Meshtastic::User.decode(packet.decoded.payload).public_key).to eq('a' * 32)
|
|
29
29
|
obj[:proto_data] << { packet: { from: 0xbbccddee, decoded: { portnum: 4, payload: Meshtastic::User.new(remote_user).to_proto } } }
|
|
30
|
+
elsif packet.decoded.portnum == :TEXT_MESSAGE_APP
|
|
31
|
+
obj[:proto_data] << { packet: { decoded: { portnum: :ROUTING_APP, request_id: packet.id, payload: { error_reason: :NONE } } } }
|
|
30
32
|
end
|
|
31
33
|
end
|
|
32
34
|
described_class.send(:mesh_send_text, env: env, obj: obj, to: '!bbccddee', text: 'private', channel_name: 'LongFast')
|
|
@@ -60,6 +62,7 @@ describe PWN::Plugins::REPL, 'mesh DM key exchange' do
|
|
|
60
62
|
packet = Meshtastic::ToRadio.decode(opts[:to_radio]).packet
|
|
61
63
|
expect(packet.pki_encrypted).to eq(true)
|
|
62
64
|
expect(packet.decoded.payload).to eq('retained text')
|
|
65
|
+
obj[:proto_data] << { packet: { decoded: { portnum: :ROUTING_APP, request_id: packet.id, payload: { error_reason: :NONE } } } }
|
|
63
66
|
end
|
|
64
67
|
described_class.send(:pwn_mesh_run_msg, env: env, args: [])
|
|
65
68
|
expect(PWN::MeshPendingDm).to be_nil
|
|
@@ -748,6 +748,7 @@ describe PWN::Plugins::REPL do # rubocop:disable Metrics/BlockLength
|
|
|
748
748
|
require 'meshtastic'
|
|
749
749
|
obj = { proto_data: [{ channel: { index: 3, role: :SECONDARY, settings: { name: 'LongFast' } } }] }
|
|
750
750
|
env = { transport: 'serial', channel: { active: 'LongFast', LongFast: { channel_num: 99 } } }
|
|
751
|
+
allow(described_class).to receive(:mesh_wait_tx_slot).and_return(:ok)
|
|
751
752
|
expect(Meshtastic::Serial).to receive(:send_text).with(hash_including(channel: 3))
|
|
752
753
|
described_class.send(:mesh_send_text, env: env, obj: obj, channel: 99, text: 'slot three')
|
|
753
754
|
end
|
|
@@ -764,6 +765,7 @@ describe PWN::Plugins::REPL do # rubocop:disable Metrics/BlockLength
|
|
|
764
765
|
transport: 'serial',
|
|
765
766
|
channel: { active: 'LongFast', LongFast: { psk: 'AQ==', channel_num: 8, topic: '2/e/LongFast/#' } }
|
|
766
767
|
}
|
|
768
|
+
allow(described_class).to receive(:mesh_wait_tx_slot).and_return(:ok)
|
|
767
769
|
expect(Meshtastic::Serial).to receive(:send_text).with(hash_including(channel: 2, text: 'hello LongFast'))
|
|
768
770
|
described_class.send(:mesh_send_text, env: env, obj: obj, text: 'hello LongFast')
|
|
769
771
|
end
|
|
@@ -781,6 +783,7 @@ describe PWN::Plugins::REPL do # rubocop:disable Metrics/BlockLength
|
|
|
781
783
|
transport: 'serial',
|
|
782
784
|
channel: { active: 'LongFast', LongFast: { psk: 'AQ==', channel_num: 8 } }
|
|
783
785
|
}
|
|
786
|
+
allow(described_class).to receive(:mesh_wait_tx_slot).and_return(:ok)
|
|
784
787
|
expect(Meshtastic::Serial).to receive(:send_text).with(hash_including(channel: 2, text: 'hello LongFast'))
|
|
785
788
|
described_class.send(:mesh_send_text, env: env, obj: obj, text: 'hello LongFast')
|
|
786
789
|
end
|
|
@@ -439,6 +439,8 @@ describe PWN::SDR::Decoder::Base do
|
|
|
439
439
|
end
|
|
440
440
|
|
|
441
441
|
it 'emits IQ frames before pipe EOF and exits on EOF without ENTER' do
|
|
442
|
+
# Keep interactive mode on, but model an idle keyboard, not the rake terminal.
|
|
443
|
+
allow($stdin).to receive(:read_nonblock).with(1, exception: false).and_return(:wait_readable)
|
|
442
444
|
reader, writer = IO.pipe
|
|
443
445
|
output = StringIO.new
|
|
444
446
|
received = Queue.new
|
|
@@ -454,7 +456,7 @@ describe PWN::SDR::Decoder::Base do
|
|
|
454
456
|
expect(frame[:samples].length).to eq(2)
|
|
455
457
|
expect(writer).not_to be_closed
|
|
456
458
|
writer.close
|
|
457
|
-
Timeout.timeout(2) { worker.value }
|
|
459
|
+
expect(Timeout.timeout(2) { worker.value }).to include(reason: :eof, capture_complete: true)
|
|
458
460
|
expect(JSON.parse(output.string)['samples']).to eq(frame[:samples])
|
|
459
461
|
expect(reader).to be_closed
|
|
460
462
|
ensure
|
|
@@ -392,6 +392,9 @@ end
|
|
|
392
392
|
describe PWN::Sessions do
|
|
393
393
|
include_context 'pwn tmp sandbox'
|
|
394
394
|
|
|
395
|
+
# Dependency discovery uses Dir.home independently of the session directory.
|
|
396
|
+
before { allow(Dir).to receive(:home).and_return(@tmp) }
|
|
397
|
+
|
|
395
398
|
it 'caps provisional titles at seven Unicode-whitespace words without shortening requests' do
|
|
396
399
|
sid = described_class.create(id: 'seven_words')[:id]
|
|
397
400
|
request = "Investigate\u00a0café\u2003login failures and repair expired certificates today"
|
|
@@ -17,6 +17,8 @@ RSpec.shared_context 'offline MFA browser' do |selectors|
|
|
|
17
17
|
@authenticated = false
|
|
18
18
|
@otp_written = false
|
|
19
19
|
@form_ready = false
|
|
20
|
+
# The fake browser updates its URL on click; it needs no redirect delay.
|
|
21
|
+
allow(described_class).to receive(:sleep).with(3).and_return(3)
|
|
20
22
|
stub_const('PWN::Plugins::YubiKey', Module.new)
|
|
21
23
|
allow(PWN::Plugins::YubiKey).to receive(:oath_code) do
|
|
22
24
|
raise 'OATH requested before the MFA form was ready' unless @form_ready
|
data/spec/spec_helper.rb
CHANGED
|
@@ -12,7 +12,7 @@ Dir[File.join(__dir__, 'support', '**', '*.rb')].reject { |f| f.include?('/suppo
|
|
|
12
12
|
# RSpec binds its formatter to $stdout at configure-time (before any example
|
|
13
13
|
# runs), so redirecting $stdout / $stderr *inside* each example swallows any
|
|
14
14
|
# incidental `puts` / `print` / `p` / `warn` emitted by the code under test
|
|
15
|
-
# WITHOUT affecting the
|
|
15
|
+
# WITHOUT affecting the formatter's timing rows or failure reports.
|
|
16
16
|
#
|
|
17
17
|
# Escape hatches:
|
|
18
18
|
# - `PWN_SPEC_VERBOSE=1 rake spec` → no redirection at all
|
|
@@ -1,14 +1,39 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'rspec/core/formatters/
|
|
3
|
+
require 'rspec/core/formatters/base_text_formatter'
|
|
4
4
|
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
# Show each example's elapsed time, retaining immediate failures and the normal summary.
|
|
6
|
+
class GateFailureFormatter < RSpec::Core::Formatters::BaseTextFormatter
|
|
7
|
+
RSpec::Core::Formatters.register self, :example_finished, :example_failed
|
|
8
|
+
|
|
9
|
+
def start(notification)
|
|
10
|
+
super
|
|
11
|
+
@completed = 0
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def example_finished(notification)
|
|
15
|
+
example = notification.example
|
|
16
|
+
@completed += 1
|
|
17
|
+
location = "#{example.metadata.fetch(:absolute_file_path)}:#{example.metadata.fetch(:line_number)}"
|
|
18
|
+
output.puts "[#{@completed}/#{@example_count}] #{location} #{formatted_duration(example.execution_result.run_time)}"
|
|
19
|
+
end
|
|
9
20
|
|
|
10
21
|
def example_failed(notification)
|
|
11
22
|
output.puts notification.fully_formatted(1)
|
|
12
23
|
output.flush
|
|
13
24
|
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def formatted_duration(seconds)
|
|
29
|
+
text = format('%<seconds>.6fs', seconds: seconds)
|
|
30
|
+
return text unless ENV['NO_COLOR'].to_s.empty? && RSpec.configuration.color_enabled?(output)
|
|
31
|
+
|
|
32
|
+
code = case seconds
|
|
33
|
+
when ...1 then 32 # green
|
|
34
|
+
when ..10 then 33 # yellow
|
|
35
|
+
else 31 # red
|
|
36
|
+
end
|
|
37
|
+
"\e[#{code}m#{text}\e[0m"
|
|
38
|
+
end
|
|
14
39
|
end
|
data/third_party/pwn_rdoc.jsonl
CHANGED
|
@@ -3166,6 +3166,7 @@
|
|
|
3166
3166
|
{"messages":[{"role":"user","content":"PWN::Plugins::Jobs.authors Usage"},{"role":"assistant","content":"`PWN::Plugins::Jobs.authors`: "}]}
|
|
3167
3167
|
{"messages":[{"role":"user","content":"PWN::Plugins::Jobs.cancel_graph Usage"},{"role":"assistant","content":"`PWN::Plugins::Jobs.cancel_graph`: "}]}
|
|
3168
3168
|
{"messages":[{"role":"user","content":"PWN::Plugins::Jobs.capture_graph Usage"},{"role":"assistant","content":"`PWN::Plugins::Jobs.capture_graph`: "}]}
|
|
3169
|
+
{"messages":[{"role":"user","content":"PWN::Plugins::Jobs.capture_owned_graph Usage"},{"role":"assistant","content":"`PWN::Plugins::Jobs.capture_owned_graph`: "}]}
|
|
3169
3170
|
{"messages":[{"role":"user","content":"PWN::Plugins::Jobs.graph Usage"},{"role":"assistant","content":"`PWN::Plugins::Jobs.graph`: "}]}
|
|
3170
3171
|
{"messages":[{"role":"user","content":"PWN::Plugins::Jobs.harvest Usage"},{"role":"assistant","content":"`PWN::Plugins::Jobs.harvest`: "}]}
|
|
3171
3172
|
{"messages":[{"role":"user","content":"PWN::Plugins::Jobs.help Usage"},{"role":"assistant","content":"`PWN::Plugins::Jobs.help`: "}]}
|
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.802
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- 0day Inc.
|
|
@@ -128,7 +128,7 @@ dependencies:
|
|
|
128
128
|
-
|
|
129
129
|
- "="
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: 8.1.
|
|
131
|
+
version: 8.1.1
|
|
132
132
|
type: :runtime
|
|
133
133
|
prerelease: false
|
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -136,7 +136,7 @@ dependencies:
|
|
|
136
136
|
-
|
|
137
137
|
- "="
|
|
138
138
|
- !ruby/object:Gem::Version
|
|
139
|
-
version: 8.1.
|
|
139
|
+
version: 8.1.1
|
|
140
140
|
- !ruby/object:Gem::Dependency
|
|
141
141
|
name: bson
|
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -6883,6 +6883,7 @@ files:
|
|
|
6883
6883
|
- spec/integration/native_ruby_helpers_spec.rb
|
|
6884
6884
|
- spec/integration/persistence_roundtrip_spec.rb
|
|
6885
6885
|
- spec/integration/prompt_builder_spec.rb
|
|
6886
|
+
- spec/integration/rake_example_timing_spec.rb
|
|
6886
6887
|
- spec/integration/readme_security_spec.rb
|
|
6887
6888
|
- spec/integration/reinforced_feedback_loop_spec.rb
|
|
6888
6889
|
- spec/integration/reports_spec.rb
|