pwn 0.4.474 → 0.4.477
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 +2 -2
- data/README.md +2 -2
- data/bin/pwn_serial_msr206 +15 -8
- data/bin/pwn_shodan_search +21 -21
- data/lib/pwn/plugins/msr206.rb +178 -97
- data/lib/pwn/plugins/serial.rb +2 -2
- data/lib/pwn/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12b3517ec1a98f073c21f689d8f0812da237bd0d2715956afe5de02e69a1c9f9
|
4
|
+
data.tar.gz: e7a84eaaee6639f4241bd08a0ceee50745f55f89cd348744fb2daa7e5881017a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25c56b798321a8fdf4c840b99ccf3c09819eb9493fea94305d5dd7a3425284b423155e741e7c5329a9af1f0c0b14831779a8e1238fcde5503514b7dcbd130d91
|
7
|
+
data.tar.gz: 830e16467f649042771d4ebe0fb8318af2abdc4ed8ab7cf7771c110c020569ebe2ff6c4be28d719e3ab00a0ffe834b004836b723e11ad0acaf17df7c87aef32c
|
data/Gemfile
CHANGED
@@ -59,7 +59,7 @@ gem 'rex', '2.0.13'
|
|
59
59
|
gem 'rmagick', '4.2.5'
|
60
60
|
gem 'rspec', '3.11.0'
|
61
61
|
gem 'rtesseract', '3.1.2'
|
62
|
-
gem 'rubocop', '1.30.
|
62
|
+
gem 'rubocop', '1.30.1'
|
63
63
|
gem 'rubocop-rake', '0.6.0'
|
64
64
|
gem 'rubocop-rspec', '2.11.1'
|
65
65
|
gem 'ruby-audio', '1.6.1'
|
@@ -70,7 +70,7 @@ gem 'savon', '2.12.1'
|
|
70
70
|
gem 'selenium-devtools', '0.102.0'
|
71
71
|
gem 'serialport', '1.3.2'
|
72
72
|
gem 'sinatra', '2.2.0'
|
73
|
-
gem 'slack-ruby-client', '1.
|
73
|
+
gem 'slack-ruby-client', '1.1.0'
|
74
74
|
gem 'socksify', '1.7.1'
|
75
75
|
gem 'spreadsheet', '1.3.0'
|
76
76
|
gem 'sqlite3', '1.4.2'
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ $ rvm use ruby-3.1.2@pwn
|
|
37
37
|
$ rvm list gemsets
|
38
38
|
$ gem install --verbose pwn
|
39
39
|
$ pwn
|
40
|
-
pwn[v0.4.
|
40
|
+
pwn[v0.4.477]:001 >>> PWN.help
|
41
41
|
```
|
42
42
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.1.2@pwn
|
|
52
52
|
$ gem uninstall --all --executables pwn
|
53
53
|
$ gem install --verbose pwn
|
54
54
|
$ pwn
|
55
|
-
pwn[v0.4.
|
55
|
+
pwn[v0.4.477]:001 >>> PWN.help
|
56
56
|
```
|
57
57
|
|
58
58
|
|
data/bin/pwn_serial_msr206
CHANGED
@@ -15,7 +15,7 @@ OptionParser.new do |options|
|
|
15
15
|
opts[:block_dev] = d
|
16
16
|
end
|
17
17
|
|
18
|
-
options.on('-bBAUD', '--baud=BAUD', '<Optional - (defaults to
|
18
|
+
options.on('-bBAUD', '--baud=BAUD', '<Optional - (defaults to 9_600)>') do |b|
|
19
19
|
opts[:baud] = b
|
20
20
|
end
|
21
21
|
|
@@ -31,7 +31,7 @@ OptionParser.new do |options|
|
|
31
31
|
opts[:parity] = p
|
32
32
|
end
|
33
33
|
|
34
|
-
options.on('-fFLOWCTRL', '--flow-control=FLOWCTRL', '<Optional - none||hard||soft (defaults to
|
34
|
+
options.on('-fFLOWCTRL', '--flow-control=FLOWCTRL', '<Optional - none||hard||soft (defaults to soft)>') do |f|
|
35
35
|
opts[:flow_control] = f
|
36
36
|
end
|
37
37
|
end.parse!
|
@@ -68,6 +68,13 @@ begin
|
|
68
68
|
cmd: :simulate_power_cycle_warm_reset
|
69
69
|
)
|
70
70
|
|
71
|
+
# Unsure if this switches the protocol from USI0 to USI1
|
72
|
+
# exec_resp = PWN::Plugins::MSR206.exec(
|
73
|
+
# msr206_obj: msr206_obj,
|
74
|
+
# cmd: :proto_usi1
|
75
|
+
# )
|
76
|
+
# puts exec_resp.inspect
|
77
|
+
|
71
78
|
# TODO: Parse Binary Bits to Derive Readable Configuration
|
72
79
|
# e.g. 'Read & Write All Three Tracks' if binary_resp == '11101111'
|
73
80
|
# Probably better to split each bit and then evaluate
|
@@ -87,7 +94,7 @@ begin
|
|
87
94
|
msr206_obj: msr206_obj,
|
88
95
|
cmd: :configuration_request
|
89
96
|
)
|
90
|
-
puts "Configuration Bits: #{exec_resp[:binary].first}"
|
97
|
+
puts "Configuration Bits: #{exec_resp[:binary].first.reverse}"
|
91
98
|
|
92
99
|
exec_resp = PWN::Plugins::MSR206.exec(
|
93
100
|
msr206_obj: msr206_obj,
|
@@ -121,14 +128,14 @@ begin
|
|
121
128
|
when :R
|
122
129
|
menu_msg = 'READY TO READ - PLEASE SWIPE CARD'
|
123
130
|
# Read Card
|
124
|
-
track_data = PWN::Plugins::MSR206.
|
131
|
+
track_data = PWN::Plugins::MSR206.read_card(
|
125
132
|
msr206_obj: msr206_obj,
|
126
133
|
type: :arm_to_read
|
127
134
|
)
|
128
135
|
when :C
|
129
136
|
menu_msg = 'READY TO COPY - PLEASE SWIPE ORIGINAL CARD'
|
130
137
|
# Read Original Card
|
131
|
-
track_data = PWN::Plugins::MSR206.
|
138
|
+
track_data = PWN::Plugins::MSR206.read_card(
|
132
139
|
msr206_obj: msr206_obj,
|
133
140
|
type: :arm_to_read
|
134
141
|
)
|
@@ -139,7 +146,7 @@ begin
|
|
139
146
|
when :E
|
140
147
|
menu_msg = 'READY TO EDIT - PLEASE SWIPE TARGET CARD'
|
141
148
|
# Read Target Card
|
142
|
-
track_data = PWN::Plugins::MSR206.
|
149
|
+
track_data = PWN::Plugins::MSR206.read_card(
|
143
150
|
msr206_obj: msr206_obj,
|
144
151
|
type: :arm_to_read
|
145
152
|
)
|
@@ -149,8 +156,8 @@ begin
|
|
149
156
|
# read edited card to verify successful write
|
150
157
|
when :B
|
151
158
|
menu_msg = 'READY TO BACKUP - PLEASE SWIPE CARD'
|
152
|
-
# Read Card
|
153
|
-
track_data = PWN::Plugins::MSR206.
|
159
|
+
# Read Card to Backup
|
160
|
+
track_data = PWN::Plugins::MSR206.read_card(
|
154
161
|
msr206_obj: msr206_obj,
|
155
162
|
type: :arm_to_read
|
156
163
|
)
|
data/bin/pwn_shodan_search
CHANGED
@@ -48,32 +48,32 @@ begin
|
|
48
48
|
query_results_file ||= "/tmp/shodan-results-#{timestamp}"
|
49
49
|
|
50
50
|
raw_query_results_file = "#{query_results_file}-RAW.json"
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
51
|
+
raw_results_arr = []
|
52
|
+
File.open(query_results_file, 'w') do |f|
|
53
|
+
queries.each do |query_line|
|
54
|
+
query = query_line.chomp
|
55
|
+
print "QUERY: '#{query}'"
|
56
|
+
f.puts("QUERY: '#{query}'")
|
57
|
+
search_results = PWN::Plugins::Shodan.search(
|
58
|
+
api_key: api_key,
|
59
|
+
query: query
|
60
|
+
)
|
61
|
+
puts " >>> Matches: #{search_results[:total]}"
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
raw_results = {}
|
64
|
+
raw_results[:query] = query
|
65
|
+
raw_results[:results] = search_results
|
66
|
+
raw_results_arr.push(raw_results)
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
68
|
+
search_results[:matches].select do |m|
|
69
|
+
f.puts "ORG: #{m[:org]} | PUBIP: #{m[:ip_str]} #{'*' * 36}"
|
70
|
+
f.puts "Product: #{m[:product]}"
|
71
|
+
f.puts "TCP Port: #{m[:port]}"
|
72
|
+
f.puts "Data: #{m[:data]}\n\n\n"
|
74
73
|
end
|
75
74
|
end
|
76
75
|
end
|
76
|
+
File.write(raw_query_results_file, raw_results_arr.to_json)
|
77
77
|
rescue SystemExit, Interrupt
|
78
78
|
puts "\nGoodbye."
|
79
79
|
end
|
data/lib/pwn/plugins/msr206.rb
CHANGED
@@ -12,7 +12,7 @@ module PWN
|
|
12
12
|
# data_bits: 'optional - (defaults to 8)',
|
13
13
|
# stop_bits: 'optional - (defaults to 1)',
|
14
14
|
# parity: 'optional - :even|:mark|:odd|:space|:none (defaults to :none),'
|
15
|
-
# flow_control: 'optional - :none
|
15
|
+
# flow_control: 'optional - :none|:hard|:soft (defaults to :soft)'
|
16
16
|
# )
|
17
17
|
|
18
18
|
public_class_method def self.connect(opts = {})
|
@@ -22,7 +22,7 @@ module PWN
|
|
22
22
|
opts[:data_bits] = 8 unless opts[:data_bits]
|
23
23
|
opts[:stop_bits] = 1 unless opts[:stop_bits]
|
24
24
|
opts[:parity] = :none unless opts[:parity]
|
25
|
-
opts[:flow_control] = :
|
25
|
+
opts[:flow_control] = :soft unless opts[:flow_control]
|
26
26
|
msr206_obj = PWN::Plugins::Serial.connect(opts)
|
27
27
|
rescue StandardError => e
|
28
28
|
disconnect(msr206_obj: msr206_obj) unless msr206_obj.nil?
|
@@ -34,6 +34,8 @@ module PWN
|
|
34
34
|
public_class_method def self.list_cmds
|
35
35
|
# Returns an Array of Symbols
|
36
36
|
cmds = %i[
|
37
|
+
proto_usi0
|
38
|
+
proto_usi1
|
37
39
|
version_report
|
38
40
|
simulate_power_cycle_warm_reset
|
39
41
|
configuration_request
|
@@ -319,7 +321,7 @@ module PWN
|
|
319
321
|
binary_byte_arr = []
|
320
322
|
if raw_byte_arr
|
321
323
|
raw_byte_arr.first.split.each do |byte_str|
|
322
|
-
binary_byte_arr.push([byte_str].pack('H*').unpack1('B*')
|
324
|
+
binary_byte_arr.push([byte_str].pack('H*').unpack1('B*'))
|
323
325
|
end
|
324
326
|
end
|
325
327
|
|
@@ -336,6 +338,7 @@ module PWN
|
|
336
338
|
private_class_method def self.parse_responses(opts = {})
|
337
339
|
msr206_obj = opts[:msr206_obj]
|
338
340
|
cmd = opts[:cmd]
|
341
|
+
cmd_bytes = opts[:cmd_bytes]
|
339
342
|
|
340
343
|
keep_parsing_responses = true
|
341
344
|
next_response_detected = false
|
@@ -343,22 +346,28 @@ module PWN
|
|
343
346
|
response[:cmd] = cmd
|
344
347
|
response[:cmd] ||= :na
|
345
348
|
|
349
|
+
if cmd_bytes.instance_of?(Array)
|
350
|
+
response[:cmd_bytes] = opts[:cmd_bytes].map do |base10_int|
|
351
|
+
"0x#{base10_int.to_s(16).rjust(2, '0')}"
|
352
|
+
end
|
353
|
+
end
|
354
|
+
response[:cmd_bytes] ||= :na
|
355
|
+
|
346
356
|
raw_byte_arr = []
|
347
|
-
|
348
|
-
|
357
|
+
raw_byte_arr_len = 0
|
358
|
+
last_raw_byte_arr_len = 0
|
349
359
|
|
350
360
|
parsed_cmd_resp_arr = []
|
351
|
-
bytes_in_cmd_resp = 0
|
352
361
|
cmd_resp = ''
|
353
362
|
|
354
363
|
while keep_parsing_responses
|
355
364
|
until next_response_detected
|
365
|
+
last_raw_byte_arr_len = raw_byte_arr_len
|
356
366
|
raw_byte_arr = PWN::Plugins::Serial.response(serial_obj: msr206_obj)
|
357
367
|
cmd_resp = raw_byte_arr.last
|
358
|
-
|
359
|
-
a_cmd_r_len = raw_byte_arr.length
|
368
|
+
raw_byte_arr_len = raw_byte_arr.length
|
360
369
|
|
361
|
-
next_response_detected = true if
|
370
|
+
next_response_detected = true if raw_byte_arr_len > last_raw_byte_arr_len
|
362
371
|
end
|
363
372
|
|
364
373
|
case cmd_resp
|
@@ -393,11 +402,11 @@ module PWN
|
|
393
402
|
when '7E'
|
394
403
|
response[:msg] = :command_not_supported_by_hardware
|
395
404
|
else
|
396
|
-
response[:msg] = :
|
405
|
+
response[:msg] = :data
|
397
406
|
end
|
398
407
|
|
399
408
|
next_response_detected = false
|
400
|
-
|
409
|
+
last_raw_byte_arr_len = raw_byte_arr_len
|
401
410
|
keep_parsing_responses = false
|
402
411
|
end
|
403
412
|
|
@@ -421,10 +430,15 @@ module PWN
|
|
421
430
|
public_class_method def self.exec(opts = {})
|
422
431
|
msr206_obj = opts[:msr206_obj]
|
423
432
|
cmd = opts[:cmd].to_s.scrub.strip.chomp
|
424
|
-
params = opts[:params]
|
433
|
+
params = opts[:params]
|
434
|
+
raise 'ERROR: params argument must be a byte array (e.g. [0x41]).' if params && !params.instance_of?(Array)
|
425
435
|
|
426
436
|
params_bytes = []
|
427
437
|
case cmd.to_sym
|
438
|
+
when :proto_usi0
|
439
|
+
cmd_bytes = [0x55, 0x53, 0x49, 0x30]
|
440
|
+
when :proto_usi1
|
441
|
+
cmd_bytes = [0x55, 0x53, 0x49, 0x31]
|
428
442
|
when :resume_transmission_to_host
|
429
443
|
cmd_bytes = [0x11]
|
430
444
|
when :pause_transmission_to_host
|
@@ -459,11 +473,11 @@ module PWN
|
|
459
473
|
cmd_bytes = [0x42]
|
460
474
|
when :load_iso_std_data_for_writing_track3
|
461
475
|
cmd_bytes = [0x43]
|
462
|
-
when :
|
476
|
+
when :load_custom_data_for_writing_track1
|
463
477
|
cmd_bytes = [0x45]
|
464
|
-
when :
|
478
|
+
when :load_custom_data_for_writing_track2
|
465
479
|
cmd_bytes = [0x46]
|
466
|
-
when :
|
480
|
+
when :load_custom_data_for_writing_track3
|
467
481
|
cmd_bytes = [0x47]
|
468
482
|
when :tx_error_data
|
469
483
|
cmd_bytes = [0x49]
|
@@ -485,6 +499,12 @@ module PWN
|
|
485
499
|
cmd_bytes = [0x52]
|
486
500
|
when :tx_iso_std_data_track3
|
487
501
|
cmd_bytes = [0x53]
|
502
|
+
when :tx_custom_data_forward_track1
|
503
|
+
cmd_bytes = [0x55]
|
504
|
+
when :tx_custom_data_forward_track2
|
505
|
+
cmd_bytes = [0x56]
|
506
|
+
when :tx_custom_data_forward_track3
|
507
|
+
cmd_bytes = [0x57]
|
488
508
|
when :tx_passbook_data
|
489
509
|
cmd_bytes = [0x58]
|
490
510
|
when :arm_to_write_no_raw
|
@@ -532,7 +552,7 @@ module PWN
|
|
532
552
|
end
|
533
553
|
|
534
554
|
# If parameters to a command are set, append them.
|
535
|
-
cmd_bytes +=
|
555
|
+
cmd_bytes += params if params
|
536
556
|
# Execute the command.
|
537
557
|
PWN::Plugins::Serial.request(
|
538
558
|
serial_obj: msr206_obj,
|
@@ -543,7 +563,8 @@ module PWN
|
|
543
563
|
# Return an array of hashes.
|
544
564
|
parse_responses(
|
545
565
|
msr206_obj: msr206_obj,
|
546
|
-
cmd: cmd.to_sym
|
566
|
+
cmd: cmd.to_sym,
|
567
|
+
cmd_bytes: cmd_bytes
|
547
568
|
)
|
548
569
|
rescue StandardError => e
|
549
570
|
raise e
|
@@ -553,25 +574,16 @@ module PWN
|
|
553
574
|
end
|
554
575
|
|
555
576
|
# Supported Method Parameters::
|
556
|
-
#
|
577
|
+
# wait_for_swipe(
|
557
578
|
# msr206_obj: 'required - msr206_obj returned from #connect method'
|
558
|
-
# type: 'required - swipe type'
|
579
|
+
# type: 'required - swipe type :arm_to_read || :arm_to_read_w_speed_prompts || :arm_to_write_no_raw || :arm_to_write_with_raw || :arm_to_write_with_raw_speed_prompts',
|
580
|
+
# encoding: required - :iso || :iso_alt || :raw'
|
559
581
|
# )
|
560
582
|
|
561
|
-
|
583
|
+
private_class_method def self.wait_for_swipe(opts = {})
|
562
584
|
msr206_obj = opts[:msr206_obj]
|
563
585
|
type = opts[:type].to_s.scrub.strip.chomp.to_sym
|
564
|
-
|
565
|
-
arm_to_read
|
566
|
-
arm_to_read_w_speed_prompts
|
567
|
-
arm_to_write_no_raw
|
568
|
-
arm_to_write_with_raw
|
569
|
-
arm_to_write_with_raw_speed_prompts
|
570
|
-
]
|
571
|
-
|
572
|
-
raise "ERROR Unsupported type in #wait_for_swipe - #{type}. Valid types:\n#{types_arr}" unless types_arr.include?(type)
|
573
|
-
|
574
|
-
track_data = {}
|
586
|
+
encoding = opts[:encoding].to_s.scrub.strip.chomp.to_sym
|
575
587
|
|
576
588
|
exec_resp = exec(
|
577
589
|
msr206_obj: msr206_obj,
|
@@ -583,11 +595,6 @@ module PWN
|
|
583
595
|
cmd: :yellow_off
|
584
596
|
)
|
585
597
|
|
586
|
-
exec_resp = PWN::Plugins::MSR206.exec(
|
587
|
-
msr206_obj: msr206_obj,
|
588
|
-
cmd: type
|
589
|
-
)
|
590
|
-
|
591
598
|
exec_resp = exec(
|
592
599
|
msr206_obj: msr206_obj,
|
593
600
|
cmd: :green_on
|
@@ -595,77 +602,110 @@ module PWN
|
|
595
602
|
|
596
603
|
exec_resp = PWN::Plugins::MSR206.exec(
|
597
604
|
msr206_obj: msr206_obj,
|
598
|
-
cmd:
|
605
|
+
cmd: type
|
599
606
|
)
|
600
607
|
|
601
608
|
print 'Ready. Please Swipe Card Now:'
|
602
609
|
loop do
|
603
610
|
exec_resp = parse_responses(
|
604
611
|
msr206_obj: msr206_obj,
|
605
|
-
cmd:
|
612
|
+
cmd: type
|
606
613
|
)
|
607
614
|
|
608
615
|
break if exec_resp[:msg] == :ack_command_completed
|
609
616
|
end
|
610
617
|
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
618
|
+
track_data_arr = []
|
619
|
+
|
620
|
+
case type
|
621
|
+
when :arm_to_read,
|
622
|
+
:arm_to_read_w_speed_prompts
|
623
|
+
|
624
|
+
if encoding == :iso
|
625
|
+
cmds_arr = %i[
|
626
|
+
tx_iso_std_data_track1
|
627
|
+
tx_iso_std_data_track2
|
628
|
+
tx_iso_std_data_track3
|
629
|
+
]
|
630
|
+
cmds_arr.each do |cmd|
|
631
|
+
puts "\n*** #{cmd.to_s.gsub('_', ' ').upcase} #{'*' * 17}"
|
632
|
+
exec_resp = exec(
|
633
|
+
msr206_obj: msr206_obj,
|
634
|
+
cmd: cmd
|
635
|
+
)
|
636
|
+
puts exec_resp[:decoded]
|
637
|
+
puts exec_resp.inspect
|
638
|
+
track_data_arr.push(exec_resp)
|
639
|
+
end
|
640
|
+
end
|
641
|
+
|
642
|
+
if encoding == :iso_alt
|
643
|
+
cmds_arr = %i[
|
644
|
+
alt_tx_iso_std_data_track1
|
645
|
+
alt_tx_iso_std_data_track2
|
646
|
+
alt_tx_iso_std_data_track3
|
647
|
+
]
|
648
|
+
|
649
|
+
cmds_arr.each do |cmd|
|
650
|
+
params_arr = [0x31, 0x32, 0x33]
|
651
|
+
params_arr.each do |param|
|
652
|
+
puts "\n*** #{cmd.to_s.gsub('_', ' ').upcase} #{'*' * 17}"
|
653
|
+
exec_resp = exec(
|
654
|
+
msr206_obj: msr206_obj,
|
655
|
+
cmd: cmd,
|
656
|
+
params: [param]
|
657
|
+
)
|
658
|
+
puts exec_resp[:decoded]
|
659
|
+
puts exec_resp.inspect
|
660
|
+
track_data_arr.push(exec_resp)
|
661
|
+
end
|
662
|
+
end
|
663
|
+
end
|
664
|
+
|
665
|
+
if encoding == :raw
|
666
|
+
cmds_arr = %i[
|
667
|
+
tx_custom_data_forward_track1
|
668
|
+
tx_custom_data_forward_track2
|
669
|
+
tx_custom_data_forward_track3
|
670
|
+
]
|
671
|
+
|
672
|
+
cmds_arr.each do |cmd|
|
673
|
+
params_arr = [0x33, 0x34, 0x35, 0x36, 0x37]
|
674
|
+
params_arr.each do |param|
|
675
|
+
puts "\n*** #{cmd.to_s.gsub('_', ' ').upcase} #{'*' * 17}"
|
676
|
+
# 2 byte command
|
677
|
+
exec_resp = exec(
|
678
|
+
msr206_obj: msr206_obj,
|
679
|
+
cmd: cmd,
|
680
|
+
params: [param]
|
681
|
+
)
|
682
|
+
puts exec_resp[:decoded]
|
683
|
+
puts exec_resp.inspect
|
684
|
+
track_data_arr.push(exec_resp)
|
685
|
+
|
686
|
+
# 3 byte command
|
687
|
+
exec_resp = exec(
|
688
|
+
msr206_obj: msr206_obj,
|
689
|
+
cmd: cmd,
|
690
|
+
params: [0x5f] + [param]
|
691
|
+
)
|
692
|
+
puts exec_resp[:decoded]
|
693
|
+
puts exec_resp.inspect
|
694
|
+
track_data_arr.push(exec_resp)
|
695
|
+
end
|
696
|
+
end
|
697
|
+
end
|
698
|
+
when :arm_to_write_no_raw,
|
699
|
+
:arm_to_write_with_raw,
|
700
|
+
:arm_to_write_with_raw_speed_prompts
|
701
|
+
|
702
|
+
cmds_arr = %i[
|
703
|
+
]
|
704
|
+
else
|
705
|
+
raise "ERROR Unsupported type in #wait_for_swipe - #{type}"
|
706
|
+
end
|
707
|
+
|
708
|
+
track_data_arr
|
669
709
|
rescue StandardError => e
|
670
710
|
raise e
|
671
711
|
ensure
|
@@ -675,6 +715,47 @@ module PWN
|
|
675
715
|
)
|
676
716
|
end
|
677
717
|
|
718
|
+
# Supported Method Parameters::
|
719
|
+
# PWN::Plugins::MSR206.read_card(
|
720
|
+
# msr206_obj: 'required - msr206_obj returned from #connect method'
|
721
|
+
# type: 'required - swipe type :arm_to_read || :arm_to_read_w_speed_prompts || :arm_to_write_no_raw || :arm_to_write_with_raw || :arm_to_write_with_raw_speed_prompts',
|
722
|
+
# )
|
723
|
+
|
724
|
+
public_class_method def self.read_card(opts = {})
|
725
|
+
msr206_obj = opts[:msr206_obj]
|
726
|
+
type = opts[:type].to_s.scrub.strip.chomp.to_sym
|
727
|
+
|
728
|
+
encoding = :waiting_for_selection
|
729
|
+
loop do
|
730
|
+
puts "\nENCODING OPTIONS:"
|
731
|
+
puts '[(I)SO Standard]'
|
732
|
+
puts '[(A)LT ISO Standard]'
|
733
|
+
puts '[(R)aw]'
|
734
|
+
print 'ENCODING TYPE >>> '
|
735
|
+
encoding_choice = gets.scrub.chomp.strip.upcase.to_sym
|
736
|
+
|
737
|
+
case encoding_choice
|
738
|
+
when :I
|
739
|
+
encoding = :iso
|
740
|
+
break
|
741
|
+
when :A
|
742
|
+
encoding = :iso_alt
|
743
|
+
break
|
744
|
+
when :R
|
745
|
+
encoding = :raw
|
746
|
+
break
|
747
|
+
end
|
748
|
+
end
|
749
|
+
|
750
|
+
wait_for_swipe(
|
751
|
+
msr206_obj: msr206_obj,
|
752
|
+
type: type,
|
753
|
+
encoding: encoding
|
754
|
+
)
|
755
|
+
rescue StandardError => e
|
756
|
+
raise e
|
757
|
+
end
|
758
|
+
|
678
759
|
# Supported Method Parameters::
|
679
760
|
# PWN::Plugins::MSR206.disconnect(
|
680
761
|
# msr206_obj: 'required - msr206_obj returned from #connect method'
|
@@ -706,7 +787,7 @@ module PWN
|
|
706
787
|
data_bits: 'optional (defaults to 8)',
|
707
788
|
stop_bits: 'optional (defaults to 1)',
|
708
789
|
parity: 'optional - :even|:mark|:odd|:space|:none (defaults to :none),'
|
709
|
-
flow_control: 'optional - :none
|
790
|
+
flow_control: 'optional - :none|:hard|:soft (defaults to :none)'
|
710
791
|
)
|
711
792
|
|
712
793
|
cmds = #{self}.list_cmds
|
data/lib/pwn/plugins/serial.rb
CHANGED
@@ -44,7 +44,7 @@ module PWN
|
|
44
44
|
opts[:stop_bits].to_i
|
45
45
|
end
|
46
46
|
|
47
|
-
case opts[:parity]
|
47
|
+
case opts[:parity].to_s.to_sym
|
48
48
|
when :even
|
49
49
|
parity = SerialPort::EVEN
|
50
50
|
when :mark
|
@@ -57,7 +57,7 @@ module PWN
|
|
57
57
|
parity = SerialPort::NONE
|
58
58
|
end
|
59
59
|
|
60
|
-
case opts[:flow_control]
|
60
|
+
case opts[:flow_control].to_s.to_sym
|
61
61
|
when :hard
|
62
62
|
flow_control = SerialPort::HARD
|
63
63
|
when :soft
|
data/lib/pwn/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.477
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0day Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -674,14 +674,14 @@ dependencies:
|
|
674
674
|
requirements:
|
675
675
|
- - '='
|
676
676
|
- !ruby/object:Gem::Version
|
677
|
-
version: 1.30.
|
677
|
+
version: 1.30.1
|
678
678
|
type: :runtime
|
679
679
|
prerelease: false
|
680
680
|
version_requirements: !ruby/object:Gem::Requirement
|
681
681
|
requirements:
|
682
682
|
- - '='
|
683
683
|
- !ruby/object:Gem::Version
|
684
|
-
version: 1.30.
|
684
|
+
version: 1.30.1
|
685
685
|
- !ruby/object:Gem::Dependency
|
686
686
|
name: rubocop-rake
|
687
687
|
requirement: !ruby/object:Gem::Requirement
|
@@ -828,14 +828,14 @@ dependencies:
|
|
828
828
|
requirements:
|
829
829
|
- - '='
|
830
830
|
- !ruby/object:Gem::Version
|
831
|
-
version: 1.
|
831
|
+
version: 1.1.0
|
832
832
|
type: :runtime
|
833
833
|
prerelease: false
|
834
834
|
version_requirements: !ruby/object:Gem::Requirement
|
835
835
|
requirements:
|
836
836
|
- - '='
|
837
837
|
- !ruby/object:Gem::Version
|
838
|
-
version: 1.
|
838
|
+
version: 1.1.0
|
839
839
|
- !ruby/object:Gem::Dependency
|
840
840
|
name: socksify
|
841
841
|
requirement: !ruby/object:Gem::Requirement
|