pwn 0.5.790 → 0.5.793

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43bc28ac60d5883af330355e4b3c12a7d0b8d553f194021a934eab172efe0d51
4
- data.tar.gz: b2c8133b2a5fd7a7be73e2245df3a6e2a35e5eb6319cde8676b109f9b423577a
3
+ metadata.gz: ad2a2e3fe7efc1387b2e1e74af3eb75a7f843fa48f6256e86670ffde794f091d
4
+ data.tar.gz: b48527c558f948fc39b09c8ac03a6fe90ef4be80ea042dcbe77c4f33cce00a08
5
5
  SHA512:
6
- metadata.gz: 316290237f20ebf205c02adcada75525462ac152d9c8ce0db918ac87b7d17457b8d1461c81bfad3cf19fc5bb649a6dfec5c05bed384e4389e2dcf19a9985267d
7
- data.tar.gz: 99d090c82e60a2641cf1c53b0a54a4ce09d7cede595d9c03d9958861ab48785a8022e17184bc3fd9b9ec935149477180dbf531668e60695005a7dde3d4001d80
6
+ metadata.gz: '08697b10f3966be151cca3d55d72f0c852256989bcbeb7ee3887a160d231e7463ea140e0498562783a052f05a802e35f028362e918fe2b50220a0f9f2d55e9de'
7
+ data.tar.gz: 0a88ece3b27161c451ddae0e20e9d6edf90328f66f0027abce7bc502117b7f999aa1b5361e423b9630c950d463ed4aa5bb4283225c9e6748256eaae6a9a58c51
data/Gemfile CHANGED
@@ -11,7 +11,7 @@ gemspec
11
11
  # In some circumstances custom flags are passed to gems in order
12
12
  # to build appropriately. Defer to ./reinstall_pwn_gemset.sh
13
13
  # to review these custom flags (e.g. pg, serialport, etc).
14
- gem 'activesupport', '<8.1.4'
14
+ gem 'activesupport', '<8.1.4.1'
15
15
  gem 'anemone', '0.7.2'
16
16
  gem 'authy', '3.0.1'
17
17
  gem 'aws-sdk', '3.3.0'
@@ -52,7 +52,7 @@ gem 'mail', '2.9.1'
52
52
  gem 'mcp', '1.9.0'
53
53
  gem 'meshtastic', '0.0.192'
54
54
  gem 'metasm', '1.0.6'
55
- gem 'mongo', '2.26.0'
55
+ gem 'mongo', '2.26.1'
56
56
  gem 'msfrpc-client', '1.1.2'
57
57
  gem 'netaddr', '2.0.6'
58
58
  gem 'net-ldap', '0.21.0'
@@ -482,11 +482,28 @@ module PWN
482
482
  options['rsa_mgf1_md'] = @opts.fetch(:mgf1_hash, digest)
483
483
  options['rsa_oaep_label'] = @opts[:label].b.unpack1('H*') if @opts[:label]
484
484
  end
485
- dummy.decrypt(wrapped, options)
485
+ message = dummy.decrypt(wrapped, options)
486
+ # OpenSSL 3 may return random bytes instead of raising when PKCS1
487
+ # padding is invalid. Never treat that as plaintext.
488
+ if padding == :pkcs1
489
+ verified = pkcs1_unpad(padded)
490
+ raise ResponseError, 'RSA decryption failed' unless verified == message
491
+ end
492
+ message
486
493
  rescue OpenSSL::OpenSSLError
487
494
  raise ResponseError, 'RSA decryption failed', cause: nil
488
495
  end
489
496
 
497
+ def pkcs1_unpad(padded)
498
+ bytes = padded.b.bytes
499
+ tail = bytes[2..] || []
500
+ found = tail.index(0)
501
+ separator = found.nil? ? nil : found + 2
502
+ raise ResponseError, 'RSA decryption failed' unless bytes[0].zero? && bytes[1] == 2 && separator && separator >= 10
503
+
504
+ padded.b.byteslice(separator + 1, padded.bytesize - separator - 1)
505
+ end
506
+
490
507
  def calculate_secret(identifier, peer)
491
508
  selected = slot(identifier)
492
509
  public_part = parse_key(peer)
data/lib/pwn/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PWN
4
- VERSION = '0.5.790'
4
+ VERSION = '0.5.793'
5
5
  end
@@ -515,13 +515,22 @@ describe 'pwn-ai curses launch' do # rubocop:disable Metrics/BlockLength -- publ
515
515
  @screen = screen
516
516
  output = double('terminal', tty?: true)
517
517
  previous = [$stdin, $stdout, $stderr]
518
- Timeout.timeout(60, Class.new(Exception)) do # rubocop:disable Lint/InheritException -- must escape Console rescue StandardError
519
- reader = lambda do
520
- key = keys.empty? ? tick.call : keys.shift
521
- Thread.pass if key.nil?
522
- key
518
+ @console = nil
519
+ allow(PWN::Plugins::REPL::AIConsole::Console).to receive(:new).and_wrap_original do |original, *args, **kwargs|
520
+ @console = original.call(*args, **kwargs)
521
+ end
522
+ expired = Class.new(Exception) # rubocop:disable Lint/InheritException -- must escape Console rescue StandardError
523
+ begin
524
+ Timeout.timeout(60, expired) do
525
+ reader = lambda do
526
+ key = keys.empty? ? tick.call : keys.shift
527
+ Thread.pass if key.nil?
528
+ key
529
+ end
530
+ PWN::Plugins::REPL::AIConsole.run(pry: @pry, input: input, output: output, curses: screen, getch: reader)
523
531
  end
524
- PWN::Plugins::REPL::AIConsole.run(pry: @pry, input: input, output: output, curses: screen, getch: reader)
532
+ rescue expired
533
+ raise expired, "execution expired phase=#{@launch_phase.inspect} session=#{@pry.config.pwn_ai_session_id} paint=#{@paint.join[-240]}"
525
534
  end
526
535
  expect([$stdin, $stdout]).to eq(previous.take(2))
527
536
  expect(PWN::Plugins::Log.raw_stderr).to equal(previous[2])
@@ -2674,15 +2683,26 @@ describe 'pwn-ai curses launch' do # rubocop:disable Metrics/BlockLength -- publ
2674
2683
  expect(opts[:messages]).to include(hash_including(role: 'user', content: 'Previous fixture question'), hash_including(role: 'assistant', content: 'Previous fixture answer'))
2675
2684
  { choices: [{ message: { role: 'assistant', content: 'Selected route.', tool_calls: [] } }] }
2676
2685
  end
2677
- keys = "/model openai console-fixture\n/sessions resume resumed console\n".chars
2678
- submitted = false
2686
+ keys = "/model openai console-fixture\n".chars
2687
+ phase = :model
2679
2688
  launch(keys) do
2680
- if !submitted && @pry.config.pwn_ai_session_id == sid
2681
- submitted = true
2682
- keys.concat("what color is a lemon?\n".chars)
2689
+ @launch_phase = phase
2690
+ idle = @console && !@console.send(:busy?)
2691
+ case phase
2692
+ when :model
2693
+ if idle && @paint.join.include?('model=console-fixture')
2694
+ phase = :resume
2695
+ keys.concat("/sessions resume resumed console\n".chars)
2696
+ end
2683
2697
  nil
2684
- elsif @paint.any? { |row| row.include?('Selected route.') }
2685
- "\u0004"
2698
+ when :resume
2699
+ if idle && @pry.config.pwn_ai_session_id == sid
2700
+ phase = :ask
2701
+ keys.concat("what color is a lemon?\n".chars)
2702
+ end
2703
+ nil
2704
+ else
2705
+ "\u0004" if @paint.join.include?('Selected route.')
2686
2706
  end
2687
2707
  end
2688
2708
  expect(@pry.config.pwn_ai_session_id).to eq(sid)
@@ -1900,9 +1900,11 @@
1900
1900
  {"messages":[{"role":"user","content":"PWN::Backups.capture Usage"},{"role":"assistant","content":"`PWN::Backups.capture`: Supported Method Parameters\n\nPWN::Backups.capture(path: ‘/path/to/source’, label: ‘learning’)\n"}]}
1901
1901
  {"messages":[{"role":"user","content":"PWN::Backups.configure Usage"},{"role":"assistant","content":"`PWN::Backups.configure`: Supported Method Parameters\n\nPWN::Backups.configure(root: nil)\n"}]}
1902
1902
  {"messages":[{"role":"user","content":"PWN::Backups.directory Usage"},{"role":"assistant","content":"`PWN::Backups.directory`: Supported Method Parameters\n\nPWN::Backups.directory(label: ‘maintenance’) Caller must hold transaction through the final source mutation and ledger.\n"}]}
1903
+ {"messages":[{"role":"user","content":"PWN::Backups.expirable_name? Usage"},{"role":"assistant","content":"`PWN::Backups.expirable_name?`: "}]}
1903
1904
  {"messages":[{"role":"user","content":"PWN::Backups.help Usage"},{"role":"assistant","content":"`PWN::Backups.help`: "}]}
1904
1905
  {"messages":[{"role":"user","content":"PWN::Backups.legacy_inventory Usage"},{"role":"assistant","content":"`PWN::Backups.legacy_inventory`: "}]}
1905
1906
  {"messages":[{"role":"user","content":"PWN::Backups.legacy_unreferenced Usage"},{"role":"assistant","content":"`PWN::Backups.legacy_unreferenced`: "}]}
1907
+ {"messages":[{"role":"user","content":"PWN::Backups.owned_directory? Usage"},{"role":"assistant","content":"`PWN::Backups.owned_directory?`: "}]}
1906
1908
  {"messages":[{"role":"user","content":"PWN::Backups.reconcile Usage"},{"role":"assistant","content":"`PWN::Backups.reconcile`: Supported Method Parameters\n\nPWN::Backups.reconcile(generation: ‘name’, expected_sha256: ‘digest’, confirmed: true)\n"}]}
1907
1909
  {"messages":[{"role":"user","content":"PWN::Backups.reference_pins Usage"},{"role":"assistant","content":"`PWN::Backups.reference_pins`: "}]}
1908
1910
  {"messages":[{"role":"user","content":"PWN::Backups.relocate_legacy Usage"},{"role":"assistant","content":"`PWN::Backups.relocate_legacy`: Supported Method Parameters\n\nPWN::Backups.relocate_legacy(paths: [], dry_run: true, writers_stopped: false)\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.790
4
+ version: 0.5.793
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "<"
17
17
  - !ruby/object:Gem::Version
18
- version: 8.1.4
18
+ version: 8.1.4.1
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "<"
24
24
  - !ruby/object:Gem::Version
25
- version: 8.1.4
25
+ version: 8.1.4.1
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: anemone
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -547,14 +547,14 @@ dependencies:
547
547
  requirements:
548
548
  - - '='
549
549
  - !ruby/object:Gem::Version
550
- version: 2.26.0
550
+ version: 2.26.1
551
551
  type: :runtime
552
552
  prerelease: false
553
553
  version_requirements: !ruby/object:Gem::Requirement
554
554
  requirements:
555
555
  - - '='
556
556
  - !ruby/object:Gem::Version
557
- version: 2.26.0
557
+ version: 2.26.1
558
558
  - !ruby/object:Gem::Dependency
559
559
  name: msfrpc-client
560
560
  requirement: !ruby/object:Gem::Requirement