pwn 0.5.259 → 0.5.261

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: 5c06971d7679da9c7582786d7fdf1058eb60fffa8e7e3be9a0381e8c64c27669
4
- data.tar.gz: 18a09f571db9d4e5f7eccf39a1377afbaacc2b6ac7cedbf065d7efb7dc7c35f5
3
+ metadata.gz: a9c22ecc8e5ce9a02da49a22288572cede1eeb407125769c905c39adcea333cc
4
+ data.tar.gz: e70d1286edf8cba818e2b8b194cd6bb2781f76b455a3e0ac06f0f84ae8eb3d0a
5
5
  SHA512:
6
- metadata.gz: 0a5cb4e5cba87d9924fd7d8154993fc21c7b2846e219ec7b98437d275264d63e7b67dd811c618964afed1c50f43e3e47a2d497702eaa4ac932357d6c3865e0cb
7
- data.tar.gz: cff2183bfc7eaaba2f5069ecaab994c25c3eb672555f885fade51b77b8c46e9ed81ca51c2f350bf390cb691b9edfc60a9c626bf999694abe9e2d487236e68ab7
6
+ metadata.gz: 230d6425720c0fc61dea6b0404cf81614b739b309edd4f6f92e8a6d83b625b7c74fb4464c39c02cb67d13580292347a5fc4723eb4d040cb395e51b9887ee693d
7
+ data.tar.gz: 321b015fc9e68ccd447718dc501d4e9f5bce0d4f2fae3a85cb6815617ba0da36eac3039df9f089d309bd38002fa114353c7483afb4b018b6fd00f1ebb253ea03
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-04-22 21:19:03 UTC using RuboCop version 1.75.3.
3
+ # on 2025-04-22 22:15:44 UTC using RuboCop version 1.75.3.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -65,10 +65,11 @@ Metrics/BlockLength:
65
65
  - 'lib/pwn/plugins/repl.rb'
66
66
  - 'lib/pwn/sast/banned_function_calls_c.rb'
67
67
 
68
- # Offense count: 1
68
+ # Offense count: 2
69
69
  # Configuration parameters: CountBlocks, CountModifierForms, Max.
70
70
  Metrics/BlockNesting:
71
71
  Exclude:
72
+ - 'lib/pwn/plugins/son_micro_rfid.rb'
72
73
  - 'lib/pwn/plugins/tor.rb'
73
74
 
74
75
  # Offense count: 1
data/README.md CHANGED
@@ -37,7 +37,7 @@ $ cd /opt/pwn
37
37
  $ ./install.sh
38
38
  $ ./install.sh ruby-gem
39
39
  $ pwn
40
- pwn[v0.5.259]:001 >>> PWN.help
40
+ pwn[v0.5.261]:001 >>> PWN.help
41
41
  ```
42
42
 
43
43
  [![Installing the pwn Security Automation Framework](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/pwn_install.png)](https://youtu.be/G7iLUY4FzsI)
@@ -52,7 +52,7 @@ $ rvm use ruby-3.4.1@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.5.259]:001 >>> PWN.help
55
+ pwn[v0.5.261]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
  If you're using a multi-user install of RVM do:
@@ -62,7 +62,7 @@ $ rvm use ruby-3.4.1@pwn
62
62
  $ rvmsudo gem uninstall --all --executables pwn
63
63
  $ rvmsudo gem install --verbose pwn
64
64
  $ pwn
65
- pwn[v0.5.259]:001 >>> PWN.help
65
+ pwn[v0.5.261]:001 >>> PWN.help
66
66
  ```
67
67
 
68
68
  PWN periodically upgrades to the latest version of Ruby which is reflected in `/opt/pwn/.ruby-version`. The easiest way to upgrade to the latest version of Ruby from a previous PWN installation is to run the following script:
@@ -10,7 +10,7 @@ module PWN
10
10
  module MSR206
11
11
  # Logger instance for auditing and debugging
12
12
  private_class_method def self.logger
13
- @logger ||= Logger.new('msr206.log')
13
+ @logger ||= Logger.new('/tmp/pwn-msr206.log')
14
14
  end
15
15
 
16
16
  # Supported Method Parameters::
@@ -10,7 +10,7 @@ module PWN
10
10
  module SonMicroRFID
11
11
  # Logger instance for auditing and debugging
12
12
  private_class_method def self.logger
13
- @logger ||= Logger.new('sonmicro_rfid.log')
13
+ @logger ||= Logger.new('/tmp/pwn-sonmicro_rfid.log')
14
14
  end
15
15
 
16
16
  # Supported Method Parameters::
@@ -335,11 +335,16 @@ module PWN
335
335
 
336
336
  # Supported Method Parameters::
337
337
  # PWN::Plugins::SonMicroRFID.read_tag(
338
- # son_micro_rfid_obj: 'required - son_micro_rfid_obj returned from #connect method'
338
+ # son_micro_rfid_obj: 'required - son_micro_rfid_obj returned from #connect method',
339
+ # authn: 'optional - authentication flag (default: false)',
340
+ # key: 'optional - key for authentication (default: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF])'
339
341
  # )
340
342
 
341
343
  public_class_method def self.read_tag(opts = {})
342
344
  son_micro_rfid_obj = opts[:son_micro_rfid_obj]
345
+ authn = opts[:authn] ||= false
346
+ key = opts[:key] ||= [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
347
+
343
348
  logger.info('Starting read_tag')
344
349
 
345
350
  print 'Reader Activated. Please Scan Tag...'
@@ -349,7 +354,7 @@ module PWN
349
354
  )
350
355
 
351
356
  rfid_data = exec_resp.last
352
- logger.info("\n#{rfid_data.inspect}")
357
+ logger.info(rfid_data)
353
358
 
354
359
  if rfid_data[:resp_code_desc] == :no_tag_present
355
360
  logger.error('No RFID tag detected')
@@ -366,21 +371,23 @@ module PWN
366
371
  )
367
372
  rfid_data[:block_data] = exec_resp.last[:block_data] if exec_resp.last[:resp_code_desc] == :read_success
368
373
  when :mifare_classic_1k, :mifare_classic_4k
369
- exec_resp = exec(
370
- son_micro_rfid_obj: son_micro_rfid_obj,
371
- cmd: :authenticate,
372
- params: { block: 0, key_type: :key_a, key: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF] }
373
- )
374
- if exec_resp.last[:resp_code_desc] == :auth_success
374
+ if authn
375
375
  exec_resp = exec(
376
376
  son_micro_rfid_obj: son_micro_rfid_obj,
377
- cmd: :read_block,
378
- params: { block: 0 }
377
+ cmd: :authenticate,
378
+ params: { block: 0, key_type: :key_a, key: key }
379
379
  )
380
- rfid_data[:block_data] = exec_resp.last[:block_data] if exec_resp.last[:resp_code_desc] == :read_success
381
- else
382
- logger.error("Authentication failed for #{rfid_data[:resp_code_desc]}")
383
- raise 'Authentication failed'
380
+ if exec_resp.last[:resp_code_desc] == :auth_success
381
+ exec_resp = exec(
382
+ son_micro_rfid_obj: son_micro_rfid_obj,
383
+ cmd: :read_block,
384
+ params: { block: 0 }
385
+ )
386
+ rfid_data[:block_data] = exec_resp.last[:block_data] if exec_resp.last[:resp_code_desc] == :read_success
387
+ else
388
+ logger.error("Authentication failed for #{rfid_data[:resp_code_desc]}")
389
+ raise 'Authentication failed'
390
+ end
384
391
  end
385
392
  end
386
393
 
@@ -397,12 +404,16 @@ module PWN
397
404
  # Supported Method Parameters::
398
405
  # PWN::Plugins::SonMicroRFID.write_tag(
399
406
  # son_micro_rfid_obj: 'required - son_micro_rfid_obj returned from #connect method',
400
- # rfid_data: 'required - RFID data to write (see #read_tag for structure)'
407
+ # rfid_data: 'required - RFID data to write (see #read_tag for structure)',
408
+ # authn: 'optional - authentication flag (default: false)',
409
+ # key: 'optional - key for authentication (default: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF])'
401
410
  # )
402
411
 
403
412
  public_class_method def self.write_tag(opts = {})
404
413
  son_micro_rfid_obj = opts[:son_micro_rfid_obj]
405
414
  rfid_data = opts[:rfid_data]
415
+ authn = opts[:authn] ||= false
416
+ key = opts[:key] ||= [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
406
417
  logger.info('Starting write_tag')
407
418
 
408
419
  unless rfid_data.is_a?(Hash) && rfid_data[:resp_code_desc] && rfid_data[:tag_id]
@@ -444,27 +455,29 @@ module PWN
444
455
  end
445
456
  end
446
457
  when :mifare_classic_1k, :mifare_classic_4k
447
- exec_resp = exec(
448
- son_micro_rfid_obj: son_micro_rfid_obj,
449
- cmd: :authenticate,
450
- params: { block: 0, key_type: :key_a, key: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF] }
451
- )
452
- if exec_resp.last[:resp_code_desc] == :auth_success
453
- if rfid_data[:block_data]
454
- data = rfid_data[:block_data].split.map { |b| b.to_i(16) }
455
- exec_resp = exec(
456
- son_micro_rfid_obj: son_micro_rfid_obj,
457
- cmd: :write_block,
458
- params: { block: 0, data: data }
459
- )
460
- unless exec_resp.last[:resp_code_desc] == :write_success
461
- logger.error('Failed to write block for Classic')
462
- raise 'Failed to write block'
458
+ if authn
459
+ exec_resp = exec(
460
+ son_micro_rfid_obj: son_micro_rfid_obj,
461
+ cmd: :authenticate,
462
+ params: { block: 0, key_type: :key_a, key: key }
463
+ )
464
+ if exec_resp.last[:resp_code_desc] == :auth_success
465
+ if rfid_data[:block_data]
466
+ data = rfid_data[:block_data].split.map { |b| b.to_i(16) }
467
+ exec_resp = exec(
468
+ son_micro_rfid_obj: son_micro_rfid_obj,
469
+ cmd: :write_block,
470
+ params: { block: 0, data: data }
471
+ )
472
+ unless exec_resp.last[:resp_code_desc] == :write_success
473
+ logger.error('Failed to write block for Classic')
474
+ raise 'Failed to write block'
475
+ end
463
476
  end
477
+ else
478
+ logger.error("Authentication failed for #{rfid_data[:resp_code_desc]}")
479
+ raise 'Authentication failed'
464
480
  end
465
- else
466
- logger.error("Authentication failed for #{rfid_data[:resp_code_desc]}")
467
- raise 'Authentication failed'
468
481
  end
469
482
  else
470
483
  logger.error("Unsupported tag type: #{rfid_data[:resp_code_desc]}")
@@ -720,12 +733,16 @@ module PWN
720
733
  )
721
734
 
722
735
  rfid_data = #{self}.read_tag(
723
- son_micro_rfid_obj: 'required son_micro_rfid_obj returned from #connect method'
736
+ son_micro_rfid_obj: 'required son_micro_rfid_obj returned from #connect method',
737
+ authn: 'optional - authentication flag (default: false)',
738
+ key: 'optional - key for authentication (default: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF])'
724
739
  )
725
740
 
726
741
  rfid_data = #{self}.write_tag(
727
742
  son_micro_rfid_obj: 'required son_micro_rfid_obj returned from #connect method',
728
- rfid_data: 'required - RFID data to write'
743
+ rfid_data: 'required - RFID data to write',
744
+ authn: 'optional - authentication flag (default: false)',
745
+ key: 'optional - key for authentication (default: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF])'
729
746
  )
730
747
 
731
748
  rfid_data = #{self}.backup_tag(
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.259'
4
+ VERSION = '0.5.261'
5
5
  end
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.259
4
+ version: 0.5.261
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.