pwn 0.4.454 → 0.4.459

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: 7706d2f67e06a72947df5fba37be484be147119aee1d537a5172b650619ee753
4
- data.tar.gz: 1254894deed2a1e8c72dc0c90e9924abd5d56d22a84a2d8f7305d8c22b94a8ed
3
+ metadata.gz: 34af764fdd574b15da3c45adb4097933e47a3aaca2de6dcb4c8f8005b6608f1d
4
+ data.tar.gz: 5bf7e7551c6c62d12a2c2811493034ba31a0545f59aa3a72483aa3701b04b626
5
5
  SHA512:
6
- metadata.gz: 0b05ab90c4110617d5bf15bfa590e32af4fe19bf70e7791d8571c2907c45dbe53470ae1364a0568e04366bfcf7c7eda13f18fdf0f5a639e6502d482fd88a364e
7
- data.tar.gz: 07bddeec0fd64dd636c738f644ea32f843bcf4237755a596fd9c4a80c1945cd6e8fe43e185e9716ba40d19e5731baf1ce427f93364c1d760d6e002b834908969
6
+ metadata.gz: 95f9def16df7e14a69731c08b4b7f4d3cf5e9e2e4b2c618b7c5b75dfba4bbbeed142f2aa03328ef3412c8bc95bc5ee87292ded504adc2d50d197113ce80c648d
7
+ data.tar.gz: 98d0f7cc871533e29b2c1321ae65ef48f56be4debc0bad1cb0617504567e0b12adf1d363c295746c5c1241c3666b42e95a46eaded7028467228cb799d0a33416
data/Gemfile CHANGED
@@ -67,7 +67,7 @@ gem 'ruby-nmap', '0.10.0'
67
67
  gem 'ruby-saml', '1.14.0'
68
68
  gem 'rvm', '1.11.3.9'
69
69
  gem 'savon', '2.12.1'
70
- gem 'selenium-devtools', '0.101.0'
70
+ gem 'selenium-devtools', '0.102.0'
71
71
  gem 'serialport', '1.3.2'
72
72
  gem 'sinatra', '2.2.0'
73
73
  gem 'slack-ruby-client', '1.0.0'
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.454]:001 >>> PWN.help
40
+ pwn[v0.4.459]: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.1.2@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.4.454]:001 >>> PWN.help
55
+ pwn[v0.4.459]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -0,0 +1,372 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PWN
4
+ module Plugins
5
+ # This plugin is used for interacting with a three track
6
+ # MSR206 Magnetic Stripe Reader / Writer
7
+ module MSR206
8
+ # Supported Method Parameters::
9
+ # msr206_obj = PWN::Plugins::MSR206.connect(
10
+ # block_dev: 'optional - serial block device path (defaults to /dev/ttyUSB0)',
11
+ # baud: 'optional - (defaults to 9600)',
12
+ # data_bits: 'optional - (defaults to 8)',
13
+ # stop_bits: 'optional - (defaults to 1)',
14
+ # parity: 'optional - (defaults to SerialPort::NONE)',
15
+ # flow_control: 'optional - (defaults to SerialPort::HARD) SerialPort::NONE|SerialPort::SOFT|SerialPort::HARD'
16
+ # )
17
+
18
+ public_class_method def self.connect(opts = {})
19
+ # Default Baud Rate for this Device is 19200
20
+ opts[:baud] = 19_200 if opts[:baud].nil?
21
+ msr206_obj = PWN::Plugins::Serial.connect(opts)
22
+ rescue StandardError => e
23
+ disconnect(msr206_obj: msr206_obj) unless msr206_obj.nil?
24
+ raise e
25
+ end
26
+
27
+ # Supported Method Parameters::
28
+ # cmds = PWN::Plugins::MSR206.list_cmds
29
+ public_class_method def self.list_cmds
30
+ # Returns an Array of Symbols
31
+ cmds = %i[
32
+ version_report
33
+ simulate_power_cycle_warm_reset
34
+ configuration_request
35
+ reproduce_last_command
36
+ resume_transmission_to_host
37
+ pause_transmission_to_host
38
+ abort_command
39
+ red_on
40
+ red_off
41
+ red_flash
42
+ green_on
43
+ green_off
44
+ green_flash
45
+ yellow_on
46
+ yellow_off
47
+ yellow_flash
48
+ arm_to_read
49
+ arm_to_read_w_speed_prompts
50
+ tx_iso_std_data_track1
51
+ tx_iso_std_data_track2
52
+ tx_iso_std_data_track3
53
+ alt_tx_iso_std_data_track1
54
+ alt_tx_iso_std_data_track2
55
+ alt_tx_iso_std_data_track3
56
+ tx_error_data
57
+ tx_custom_data_forward_track1
58
+ tx_custom_data_forward_track2
59
+ tx_custom_data_forward_track3
60
+ tx_passbook_data
61
+ alt_tx_passbook_data
62
+ write_verify
63
+ card_edge_detect
64
+ load_iso_std_data_for_writing_track1
65
+ load_iso_std_data_for_writing_track2
66
+ load_iso_std_data_for_writing_track3
67
+ alt_load_iso_std_data_for_writing_track1
68
+ alt_load_iso_std_data_for_writing_track2
69
+ alt_load_iso_std_data_for_writing_track3
70
+ load_passbook_data_for_writing
71
+ load_custom_data_for_writing_track1
72
+ load_custom_data_for_writing_track2
73
+ load_custom_data_for_writing_track3
74
+ set_write_density
75
+ set_write_density_210_bpi_tracks13
76
+ set_write_density_75_bpi_tracks13
77
+ set_write_density_210_bpi_tracks2
78
+ set_write_density_75_bpi_tracks2
79
+ set_default_write_current
80
+ view_default_write_current
81
+ set_temp_write_current
82
+ view_temp_write_current
83
+ arm_to_write_with_raw
84
+ arm_to_write_no_raw
85
+ arm_to_write_with_raw_speed_prompts
86
+ ]
87
+ rescue StandardError => e
88
+ raise e
89
+ end
90
+
91
+ # Supported Method Parameters::
92
+ # cmd_response_arr = get_cmd_responses(
93
+ # msr206_obj: 'required - msr206_obj returned from #connect method'
94
+ # )
95
+
96
+ public_class_method def self.get_cmd_responses(opts = {})
97
+ msr206_obj = opts[:msr206_obj]
98
+
99
+ raw_byte_arr = PWN::Plugins::Serial.dump_session_data(
100
+ serial_obj: msr206_obj
101
+ )
102
+
103
+ hex_esc_raw_resp = ''
104
+ raw_byte_arr.each do |byte|
105
+ this_byte = byte.unpack1('H*')
106
+ # Needed when #unpack1 returns 2 bytes instead of one
107
+ # e.g."ް" translates to deb0 (that's not a double quote ")
108
+ # instead of de b0
109
+ # this condition is ghetto-hacker-ish.
110
+ if this_byte.length == 4
111
+ byte_one = this_byte[1..2]
112
+ byte_two = this_byte[-2..-1]
113
+ hex_esc_raw_resp = "#{hex_esc_raw_resp}\s#{byte_one}"
114
+ hex_esc_raw_resp = "#{hex_esc_raw_resp}\s#{byte_two}"
115
+ else
116
+ hex_esc_raw_resp = "#{hex_esc_raw_resp}\s#{this_byte}"
117
+ end
118
+ end
119
+
120
+ # Return command response array in space-delimited hex
121
+ cmd_response_arr = hex_esc_raw_resp.upcase.strip.split(/(?=FF)/)
122
+ cmd_response_arr.map(&:strip)
123
+ rescue StandardError => e
124
+ # Flush Responses for Next Request
125
+ PWN::Plugins::Serial.flush_session_data(
126
+ serial_obj: msr206_obj
127
+ )
128
+
129
+ raise e
130
+ end
131
+
132
+ # Supported Method Parameters::
133
+ # parsed_cmd_resp_arr = parse_responses(
134
+ # cmd_resp: 'required - command response string'
135
+ # )
136
+
137
+ private_class_method def self.parse_responses(opts = {})
138
+ msr206_obj = opts[:msr206_obj]
139
+ cmd = opts[:cmd].to_s.scrub.strip.chomp
140
+
141
+ keep_parsing_responses = true
142
+ next_response_detected = false
143
+ all_cmd_responses = []
144
+ a_cmd_r_len = 0
145
+ last_a_cmd_r_len = 0
146
+
147
+ parsed_cmd_resp_arr = []
148
+ bytes_in_cmd_resp = 0
149
+ cmd_resp = ''
150
+
151
+ while keep_parsing_responses
152
+ until next_response_detected
153
+ all_cmd_responses = get_cmd_responses(
154
+ msr206_obj: msr206_obj
155
+ )
156
+ # bytes_in_cmd_resp = cmd_resp.split.length if cmd_resp
157
+ a_cmd_r_len = all_cmd_responses.length
158
+
159
+ next_response_detected = true if a_cmd_r_len > last_a_cmd_r_len
160
+ end
161
+
162
+ # cmd_resp = all_cmd_responses.last
163
+ # case cmd_resp
164
+ # when '21', '28', '29', '2A', '2B', '2D', '2F', '3A', '31', '32', '33', '3E', '3F', '5E', '7E', '98 FE'
165
+ # next_response_detected = true
166
+ # end
167
+ next_response_detected = false
168
+ last_a_cmd_r_len = a_cmd_r_len
169
+ print "\n"
170
+ keep_parsing_responses = false
171
+ end
172
+
173
+ all_cmd_responses
174
+ rescue StandardError => e
175
+ raise e
176
+ ensure
177
+ # Flush Responses for Next Request
178
+ PWN::Plugins::Serial.flush_session_data(
179
+ serial_obj: msr206_obj
180
+ )
181
+ end
182
+
183
+ # Supported Method Parameters::
184
+ # PWN::Plugins::MSR206.exec(
185
+ # msr206_obj: 'required - msr206_obj returned from #connect method'
186
+ # cmd: 'required - cmd returned from #list_cmds method',
187
+ # params: 'optional - parameters for specific command returned from #list_params method'
188
+ # )
189
+ public_class_method def self.exec(opts = {})
190
+ msr206_obj = opts[:msr206_obj]
191
+ cmd = opts[:cmd].to_s.scrub.strip.chomp
192
+ params = opts[:params].to_s.scrub.strip.chomp
193
+
194
+ params_bytes = []
195
+ case cmd.to_sym
196
+ when :resume_transmission_to_host
197
+ cmd_bytes = [0x11]
198
+ when :pause_transmission_to_host
199
+ cmd_bytes = [0x13]
200
+ when :abort_command
201
+ cmd_bytes = [0x1B]
202
+ when :configuration_request
203
+ cmd_bytes = [0x23]
204
+ when :reproduce_last_command
205
+ cmd_bytes = [0x25]
206
+ when :card_edge_detect
207
+ cmd_bytes = [0x26]
208
+ when :green_flash
209
+ cmd_bytes = [0x28]
210
+ when :red_flash
211
+ cmd_bytes = [0x29]
212
+ when :version_report
213
+ cmd_bytes = [0x39]
214
+ when :power_on_report
215
+ cmd_bytes = [0x3A]
216
+ when :set_write_density
217
+ cmd_bytes = [0x3B]
218
+ when :set_temp_write_current
219
+ cmd_bytes = [0x3C]
220
+ when :view_temp_write_current
221
+ cmd_bytes = [0x3E]
222
+ when :write_verify
223
+ cmd_bytes = [0x3F]
224
+ when :arm_to_write_with_raw
225
+ cmd_bytes = [0x40]
226
+ when :load_iso_std_data_for_writing_track1
227
+ cmd_bytes = [0x41]
228
+ when :load_iso_std_data_for_writing_track2
229
+ cmd_bytes = [0x42]
230
+ when :load_iso_std_data_for_writing_track3
231
+ cmd_bytes = [0x43]
232
+ when :tx_custom_data_forward_track1, :load_custom_data_for_writing_track1
233
+ cmd_bytes = [0x45]
234
+ when :tx_custom_data_forward_track2, :load_custom_data_for_writing_track2
235
+ cmd_bytes = [0x46]
236
+ when :tx_custom_data_forward_track3, :load_custom_data_for_writing_track3
237
+ cmd_bytes = [0x47]
238
+ when :tx_error_data
239
+ cmd_bytes = [0x49]
240
+ when :yellow_on
241
+ cmd_bytes = [0x4B]
242
+ when :green_on
243
+ cmd_bytes = [0x4C]
244
+ when :red_on
245
+ cmd_bytes = [0x4D]
246
+ when :set_write_density_210_bpi_tracks2
247
+ cmd_bytes = [0x4E]
248
+ when :set_write_density_210_bpi_tracks13
249
+ cmd_bytes = [0x4F]
250
+ when :arm_to_read
251
+ cmd_bytes = [0x50]
252
+ when :tx_iso_std_data_track1
253
+ cmd_bytes = [0x51]
254
+ when :tx_iso_std_data_track2
255
+ cmd_bytes = [0x52]
256
+ when :tx_iso_std_data_track3
257
+ cmd_bytes = [0x53]
258
+ when :tx_passbook_data
259
+ cmd_bytes = [0x58]
260
+ when :arm_to_write_no_raw
261
+ cmd_bytes = [0x5A]
262
+ when :set_default_write_current
263
+ cmd_bytes = [0x5B]
264
+ when :view_default_write_current
265
+ cmd_bytes = [0x5D]
266
+ when :alt_load_iso_std_data_for_writing_track1
267
+ cmd_bytes = [0x61]
268
+ when :alt_load_iso_std_data_for_writing_track2
269
+ cmd_bytes = [0x62]
270
+ when :alt_load_iso_std_data_for_writing_track3
271
+ cmd_bytes = [0x63]
272
+ when :load_passbook_data_for_writing
273
+ cmd_bytes = [0x6A]
274
+ when :yellow_off
275
+ cmd_bytes = [0x6B]
276
+ when :green_off
277
+ cmd_bytes = [0x6C]
278
+ when :red_off
279
+ cmd_bytes = [0x6D]
280
+ when :set_write_density_75_bpi_tracks2
281
+ cmd_bytes = [0x6E]
282
+ when :set_write_density_75_bpi_tracks13
283
+ cmd_bytes = [0x6F]
284
+ when :arm_to_read_w_speed_prompts
285
+ cmd_bytes = [0x70]
286
+ when :alt_tx_iso_std_data_track1
287
+ cmd_bytes = [0x71]
288
+ when :alt_tx_iso_std_data_track2
289
+ cmd_bytes = [0x72]
290
+ when :alt_tx_iso_std_data_track3
291
+ cmd_bytes = [0x73]
292
+ when :alt_tx_passbook_data
293
+ cmd_bytes = [0x78]
294
+ when :arm_to_write_with_raw_speed_prompts
295
+ cmd_bytes = [0x7A]
296
+ when :yellow_flash
297
+ cmd_bytes = [0x7C]
298
+ when :simulate_power_cycle_warm_reset
299
+ cmd_bytes = [0x7F]
300
+ else
301
+ raise "Unsupported Command: #{cmd}. Supported commands are:\n#{list_cmds}\n\n\n"
302
+ end
303
+
304
+ # If parameters to a command are set, append them.
305
+ cmd_bytes += params_bytes unless params_bytes.empty?
306
+ # Execute the command.
307
+ cmd_bytes.each do |byte|
308
+ msr206_obj[:serial_conn].putc(byte)
309
+ end
310
+
311
+ # Parse commands response(s).
312
+ # Return an array of hashes.
313
+ parse_responses(
314
+ msr206_obj: msr206_obj,
315
+ cmd: cmd.to_sym
316
+ )
317
+ rescue StandardError => e
318
+ raise e
319
+ end
320
+
321
+ # Supported Method Parameters::
322
+ # PWN::Plugins::MSR206.disconnect(
323
+ # msr206_obj: 'required - msr206_obj returned from #connect method'
324
+ # )
325
+
326
+ public_class_method def self.disconnect(opts = {})
327
+ PWN::Plugins::Serial.disconnect(
328
+ serial_obj: opts[:msr206_obj]
329
+ )
330
+ rescue StandardError => e
331
+ raise e
332
+ end
333
+
334
+ # Author(s):: 0day Inc. <request.pentest@0dayinc.com>
335
+
336
+ public_class_method def self.authors
337
+ "AUTHOR(S):
338
+ 0day Inc. <request.pentest@0dayinc.com>
339
+ "
340
+ end
341
+
342
+ # Display Usage for this Module
343
+
344
+ public_class_method def self.help
345
+ puts "USAGE:
346
+ msr206_obj = #{self}.connect(
347
+ block_dev: 'optional serial block device path (defaults to /dev/ttyUSB0)',
348
+ baud: 'optional (defaults to 9600)',
349
+ data_bits: 'optional (defaults to 8)',
350
+ stop_bits: 'optional (defaults to 1)',
351
+ parity: 'optional (defaults to SerialPort::NONE)',
352
+ flow_control: 'optional (defaults to SerialPort::NONE)'
353
+ )
354
+
355
+ cmds = #{self}.list_cmds
356
+
357
+ parsed_cmd_resp_arr = #{self}.exec(
358
+ msr206_obj: 'required msr206_obj returned from #connect method',
359
+ cmd: 'required - cmd returned from #list_cmds method',
360
+ params: 'optional - parameters for specific command returned from #list_params method'
361
+ )
362
+
363
+ #{self}.disconnect(
364
+ msr206_obj: 'required msr206_obj returned from #connect method'
365
+ )
366
+
367
+ #{self}.authors
368
+ "
369
+ end
370
+ end
371
+ end
372
+ end
@@ -151,7 +151,7 @@ module PWN
151
151
  end
152
152
 
153
153
  # Supported Method Parameters::
154
- # parsed_cmd_resp_arr = parse_cmd_resp(
154
+ # parsed_cmd_resp_arr = parse_responses(
155
155
  # cmd_resp: 'required - command response string'
156
156
  # )
157
157
 
data/lib/pwn/plugins.rb CHANGED
@@ -32,6 +32,7 @@ module PWN
32
32
  autoload :JSONPathify, 'pwn/plugins/json_pathify'
33
33
  autoload :MailAgent, 'pwn/plugins/mail_agent'
34
34
  autoload :Metasploit, 'pwn/plugins/metasploit'
35
+ autoload :MSR206, 'pwn/plugins/msr206'
35
36
  autoload :NessusCloud, 'pwn/plugins/nessus_cloud'
36
37
  autoload :NexposeVulnScan, 'pwn/plugins/nexpose_vuln_scan'
37
38
  autoload :NmapIt, 'pwn/plugins/nmap_it'
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.4.454'
4
+ VERSION = '0.4.459'
5
5
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe PWN::Plugins::MSR206 do
6
+ it 'should display information for authors' do
7
+ authors_response = PWN::Plugins::MSR206
8
+ expect(authors_response).to respond_to :authors
9
+ end
10
+
11
+ it 'should display information for existing help method' do
12
+ help_response = PWN::Plugins::MSR206
13
+ expect(help_response).to respond_to :help
14
+ end
15
+ end
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.454
4
+ version: 0.4.459
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-05-24 00:00:00.000000000 Z
11
+ date: 2022-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -786,14 +786,14 @@ dependencies:
786
786
  requirements:
787
787
  - - '='
788
788
  - !ruby/object:Gem::Version
789
- version: 0.101.0
789
+ version: 0.102.0
790
790
  type: :runtime
791
791
  prerelease: false
792
792
  version_requirements: !ruby/object:Gem::Requirement
793
793
  requirements:
794
794
  - - '='
795
795
  - !ruby/object:Gem::Version
796
- version: 0.101.0
796
+ version: 0.102.0
797
797
  - !ruby/object:Gem::Dependency
798
798
  name: serialport
799
799
  requirement: !ruby/object:Gem::Requirement
@@ -1531,6 +1531,7 @@ files:
1531
1531
  - lib/pwn/plugins/json_pathify.rb
1532
1532
  - lib/pwn/plugins/mail_agent.rb
1533
1533
  - lib/pwn/plugins/metasploit.rb
1534
+ - lib/pwn/plugins/msr206.rb
1534
1535
  - lib/pwn/plugins/nessus_cloud.rb
1535
1536
  - lib/pwn/plugins/nexpose_vuln_scan.rb
1536
1537
  - lib/pwn/plugins/nmap_it.rb
@@ -1827,6 +1828,7 @@ files:
1827
1828
  - spec/lib/pwn/plugins/json_pathify_spec.rb
1828
1829
  - spec/lib/pwn/plugins/mail_agent_spec.rb
1829
1830
  - spec/lib/pwn/plugins/metasploit_spec.rb
1831
+ - spec/lib/pwn/plugins/msr206_spec.rb
1830
1832
  - spec/lib/pwn/plugins/nessus_cloud_spec.rb
1831
1833
  - spec/lib/pwn/plugins/nexpose_vuln_scan_spec.rb
1832
1834
  - spec/lib/pwn/plugins/nmap_it_spec.rb
@@ -2096,6 +2098,7 @@ test_files:
2096
2098
  - spec/lib/pwn/plugins/json_pathify_spec.rb
2097
2099
  - spec/lib/pwn/plugins/mail_agent_spec.rb
2098
2100
  - spec/lib/pwn/plugins/metasploit_spec.rb
2101
+ - spec/lib/pwn/plugins/msr206_spec.rb
2099
2102
  - spec/lib/pwn/plugins/nessus_cloud_spec.rb
2100
2103
  - spec/lib/pwn/plugins/nexpose_vuln_scan_spec.rb
2101
2104
  - spec/lib/pwn/plugins/nmap_it_spec.rb