pwn 0.5.277 → 0.5.278
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/.rubocop_todo.yml +9 -5
- data/Gemfile +1 -1
- data/README.md +3 -3
- data/lib/pwn/plugins/black_duck_binary_analysis.rb +3 -6
- data/lib/pwn/plugins/credit_card.rb +41 -5
- data/lib/pwn/plugins/vin.rb +361 -0
- data/lib/pwn/plugins.rb +1 -0
- data/lib/pwn/version.rb +1 -1
- data/spec/lib/pwn/plugins/vin_spec.rb +15 -0
- data/third_party/pwn_rdoc.jsonl +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31416d11bd1c37744603f4351c5ac23f36dcd6bf1a5f1ca613916e1cf2068cd0
|
4
|
+
data.tar.gz: 72ee67d2982cc404bd42f6be039945c7af2626fc5940409863726b2573400bee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f51183d1bba8bdbedcc6d8e27e689c820316ca2e28a43393e789db9ba4945b8ee90a6ee98e7a04a76d62b2b64ea49681bc43152d2fbc4d1c42a10260b4e89db
|
7
|
+
data.tar.gz: 2a94290f548adb5b6719a2ce55712e4db12a59e3a95870414fdbc3521b1bccfe9a87b57985632ef509406b607b7c6ec6ce4d2cebe437fb813cdef246150945b8
|
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-05-
|
3
|
+
# on 2025-05-30 23:04:07 UTC using RuboCop version 1.75.8.
|
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
|
@@ -50,7 +50,7 @@ Lint/RedundantTypeConversion:
|
|
50
50
|
- 'lib/pwn/plugins/jenkins.rb'
|
51
51
|
- 'lib/pwn/plugins/repl.rb'
|
52
52
|
|
53
|
-
# Offense count:
|
53
|
+
# Offense count: 307
|
54
54
|
# This cop supports safe autocorrection (--autocorrect).
|
55
55
|
# Configuration parameters: AutoCorrect.
|
56
56
|
Lint/UselessAssignment:
|
@@ -116,6 +116,11 @@ Metrics/ModuleLength:
|
|
116
116
|
- 'lib/pwn/plugins/son_micro_rfid.rb'
|
117
117
|
- 'lib/pwn/plugins/transparent_browser.rb'
|
118
118
|
|
119
|
+
# Offense count: 2
|
120
|
+
Naming/AccessorMethodName:
|
121
|
+
Exclude:
|
122
|
+
- 'lib/pwn/plugins/vin.rb'
|
123
|
+
|
119
124
|
# Offense count: 1
|
120
125
|
# This cop supports safe autocorrection (--autocorrect).
|
121
126
|
# Configuration parameters: EnforcedStyle.
|
@@ -148,7 +153,7 @@ Style/IfUnlessModifier:
|
|
148
153
|
- 'lib/pwn/plugins/baresip.rb'
|
149
154
|
- 'lib/pwn/plugins/mail_agent.rb'
|
150
155
|
|
151
|
-
# Offense count:
|
156
|
+
# Offense count: 9
|
152
157
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
153
158
|
Style/MapIntoArray:
|
154
159
|
Exclude:
|
@@ -158,7 +163,6 @@ Style/MapIntoArray:
|
|
158
163
|
- 'bin/pwn_jenkins_thinBackup_aws_s3'
|
159
164
|
- 'bin/pwn_www_uri_buster'
|
160
165
|
- 'lib/pwn/plugins/char.rb'
|
161
|
-
- 'lib/pwn/plugins/credit_card.rb'
|
162
166
|
- 'lib/pwn/plugins/nexpose_vuln_scan.rb'
|
163
167
|
|
164
168
|
# Offense count: 9
|
@@ -218,7 +222,7 @@ Style/RedundantStringEscape:
|
|
218
222
|
- 'lib/pwn/sast/redos.rb'
|
219
223
|
- 'vagrant/provisioners/kali_customize.rb'
|
220
224
|
|
221
|
-
# Offense count:
|
225
|
+
# Offense count: 58
|
222
226
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
223
227
|
Style/SlicingWithRange:
|
224
228
|
Enabled: false
|
data/Gemfile
CHANGED
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.
|
40
|
+
pwn[v0.5.278]:001 >>> PWN.help
|
41
41
|
```
|
42
42
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.4.4@pwn
|
|
52
52
|
$ gem uninstall --all --executables pwn
|
53
53
|
$ gem install --verbose pwn
|
54
54
|
$ pwn
|
55
|
-
pwn[v0.5.
|
55
|
+
pwn[v0.5.278]: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.4@pwn
|
|
62
62
|
$ rvmsudo gem uninstall --all --executables pwn
|
63
63
|
$ rvmsudo gem install --verbose pwn
|
64
64
|
$ pwn
|
65
|
-
pwn[v0.5.
|
65
|
+
pwn[v0.5.278]: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:
|
@@ -88,6 +88,8 @@ module PWN
|
|
88
88
|
response
|
89
89
|
rescue RestClient::ExceptionWithResponse => e
|
90
90
|
if e.response
|
91
|
+
puts "HTTP BASE URI: #{base_bd_bin_analysis_api_uri}"
|
92
|
+
puts "HTTP PATH: #{rest_call}"
|
91
93
|
puts "HTTP RESPONSE CODE: #{e.response.code}"
|
92
94
|
puts "HTTP RESPONSE HEADERS:\n#{e.response.headers}"
|
93
95
|
puts "HTTP RESPONSE BODY:\n#{e.response.body.inspect}\n\n\n"
|
@@ -107,12 +109,7 @@ module PWN
|
|
107
109
|
|
108
110
|
retry
|
109
111
|
rescue StandardError => e
|
110
|
-
|
111
|
-
when '400 Bad Request', '404 Resource Not Found'
|
112
|
-
"#{e.message}: #{e.response}"
|
113
|
-
else
|
114
|
-
raise e
|
115
|
-
end
|
112
|
+
raise e
|
116
113
|
ensure
|
117
114
|
spinner.stop unless spinner.nil?
|
118
115
|
end
|
@@ -7,20 +7,50 @@ module PWN
|
|
7
7
|
module Plugins
|
8
8
|
# This plugin provides useful credit card capabilities
|
9
9
|
module CreditCard
|
10
|
+
# Supported Method Parameters::
|
11
|
+
# PWN::Plugins::CreditCard.list_types
|
12
|
+
|
13
|
+
public_class_method def self.list_types
|
14
|
+
%i[
|
15
|
+
amex
|
16
|
+
unionpay
|
17
|
+
dankort
|
18
|
+
diners
|
19
|
+
elo
|
20
|
+
discover
|
21
|
+
hipercard
|
22
|
+
jcb
|
23
|
+
maestro
|
24
|
+
mastercard
|
25
|
+
mir
|
26
|
+
rupay
|
27
|
+
solo
|
28
|
+
switch
|
29
|
+
visa
|
30
|
+
]
|
31
|
+
rescue StandardError => e
|
32
|
+
raise e
|
33
|
+
end
|
34
|
+
|
10
35
|
# Supported Method Parameters::
|
11
36
|
# PWN::Plugins::CreditCard.generate(
|
12
|
-
# type: '
|
37
|
+
# type: 'optional - card type from #list_types method to generate (defaults to :random)',
|
13
38
|
# count: 'optional - number of numbers to generate (defaults to 1)'
|
14
39
|
# )
|
15
40
|
|
16
41
|
public_class_method def self.generate(opts = {})
|
17
|
-
type = opts[:type]
|
42
|
+
type = opts[:type] ||= :random
|
43
|
+
type = type.to_s.strip.scrub.chomp.downcase.to_sym
|
44
|
+
|
18
45
|
count = opts[:count].to_i
|
19
46
|
count = 1 if count.zero?
|
20
47
|
|
21
48
|
cc_result_arr = []
|
22
49
|
(1..count).each do
|
23
|
-
|
50
|
+
gen_type = list_types.sample if type == :random
|
51
|
+
gen_type = type unless type == :random
|
52
|
+
cc_hash = type(cc: CreditCardValidations::Factory.random(gen_type))
|
53
|
+
cc_result_arr.push(cc_hash)
|
24
54
|
end
|
25
55
|
|
26
56
|
cc_result_arr
|
@@ -35,7 +65,11 @@ module PWN
|
|
35
65
|
|
36
66
|
public_class_method def self.type(opts = {})
|
37
67
|
cc = opts[:cc].to_s.scrub.strip.chomp
|
38
|
-
|
68
|
+
cc_hash = {}
|
69
|
+
cc_hash[:number] = cc
|
70
|
+
cc_hash[:type] = cc.credit_card_brand
|
71
|
+
|
72
|
+
cc_hash
|
39
73
|
rescue StandardError => e
|
40
74
|
raise e
|
41
75
|
end
|
@@ -52,8 +86,10 @@ module PWN
|
|
52
86
|
|
53
87
|
public_class_method def self.help
|
54
88
|
puts "USAGE:
|
89
|
+
#{self}.list_types
|
90
|
+
|
55
91
|
#{self}.generate(
|
56
|
-
type: 'required - card to generate
|
92
|
+
type: 'required - card to generate from #list_types method to generate',
|
57
93
|
count: 'optional - number of numbers to generate (defaults to 1)'
|
58
94
|
)
|
59
95
|
|
@@ -0,0 +1,361 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cgi'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module PWN
|
7
|
+
module Plugins
|
8
|
+
# This plugin provides useful VIN generation and decoding capabilities using the NHTSA vPIC API
|
9
|
+
module VIN
|
10
|
+
# Constants for VIN generation
|
11
|
+
WEIGHTS = [8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2].freeze
|
12
|
+
LETTER_VALUES = {
|
13
|
+
'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 6, 'G' => 7, 'H' => 8,
|
14
|
+
'J' => 1, 'K' => 2, 'L' => 3, 'M' => 4, 'N' => 5, 'P' => 7, 'R' => 9,
|
15
|
+
'S' => 2, 'T' => 3, 'U' => 4, 'V' => 5, 'W' => 6, 'X' => 7, 'Y' => 8, 'Z' => 9
|
16
|
+
}.freeze
|
17
|
+
YEAR_CODES = %w[A B C D E F G H J K L M N P R S T V W X Y 1 2 3 4 5 6 7 8 9].freeze
|
18
|
+
|
19
|
+
# Supported Method Parameters:
|
20
|
+
# vin_rest_call(
|
21
|
+
# http_method: 'optional - e.g. :get, :post (defaults to :get)',
|
22
|
+
# rest_call: 'required - rest call to make per the schema',
|
23
|
+
# params: 'optional - params passed in the URI or HTTP Headers',
|
24
|
+
# http_headers: 'optional - HTTP Headers to pass in the request'
|
25
|
+
# )
|
26
|
+
private_class_method def self.vin_rest_call(opts = {})
|
27
|
+
http_method = opts[:http_method] || :get
|
28
|
+
rest_call = opts[:rest_call]
|
29
|
+
params = opts[:params] ||= {}
|
30
|
+
headers = opts[:http_headers] ||= {
|
31
|
+
content_type: 'application/json; charset=utf-8'
|
32
|
+
}
|
33
|
+
|
34
|
+
base_url = 'https://vpic.nhtsa.dot.gov/api/'
|
35
|
+
browser_obj = PWN::Plugins::TransparentBrowser.open(browser_type: :rest)
|
36
|
+
rest_client = browser_obj[:browser]::Request
|
37
|
+
|
38
|
+
case http_method
|
39
|
+
when :get
|
40
|
+
headers[:params] = params
|
41
|
+
response = rest_client.execute(
|
42
|
+
method: http_method,
|
43
|
+
url: "#{base_url}#{rest_call}",
|
44
|
+
headers: headers,
|
45
|
+
verify_ssl: false,
|
46
|
+
timeout: 5400
|
47
|
+
)
|
48
|
+
else
|
49
|
+
raise ArgumentError, "Unsupported HTTP method: #{http_method}"
|
50
|
+
end
|
51
|
+
|
52
|
+
response
|
53
|
+
rescue RestClient::ExceptionWithResponse => e
|
54
|
+
if e.response
|
55
|
+
puts "HTTP BASE URL: #{base_url}"
|
56
|
+
puts "HTTP PATH: #{rest_call}"
|
57
|
+
puts "HTTP RESPONSE CODE: #{e.response.code}"
|
58
|
+
puts "HTTP RESPONSE HEADERS:\n#{e.response.headers}"
|
59
|
+
puts "HTTP RESPONSE BODY:\n#{e.response.body.inspect}\n\n\n"
|
60
|
+
end
|
61
|
+
rescue StandardError => e
|
62
|
+
puts e.backtrace.join("\n")
|
63
|
+
raise e
|
64
|
+
end
|
65
|
+
|
66
|
+
# Supported Method Parameters:
|
67
|
+
# manufacturers = PWN::Plugins::VIN.get_all_manufacturers
|
68
|
+
public_class_method def self.get_all_manufacturers
|
69
|
+
rest_call = 'vehicles/getallmanufacturers'
|
70
|
+
page = 1
|
71
|
+
|
72
|
+
all_manufacturers = []
|
73
|
+
loop do
|
74
|
+
params = {
|
75
|
+
format: 'json',
|
76
|
+
page: page
|
77
|
+
}
|
78
|
+
response = vin_rest_call(
|
79
|
+
rest_call: rest_call,
|
80
|
+
params: params
|
81
|
+
)
|
82
|
+
json_resp = JSON.parse(response, symbolize_names: true)
|
83
|
+
print '.'
|
84
|
+
break if json_resp[:Results].empty?
|
85
|
+
|
86
|
+
page += 1
|
87
|
+
all_manufacturers.concat(json_resp[:Results])
|
88
|
+
end
|
89
|
+
|
90
|
+
all_manufacturers
|
91
|
+
rescue StandardError => e
|
92
|
+
raise e
|
93
|
+
end
|
94
|
+
|
95
|
+
# Supported Method Parameters:
|
96
|
+
# makes = PWN::Plugins::VIN.get_all_makes
|
97
|
+
public_class_method def self.get_all_makes
|
98
|
+
rest_call = 'vehicles/getallmakes'
|
99
|
+
params = { format: 'json' }
|
100
|
+
response = vin_rest_call(
|
101
|
+
rest_call: rest_call,
|
102
|
+
params: params
|
103
|
+
)
|
104
|
+
JSON.parse(response, symbolize_names: true)
|
105
|
+
rescue StandardError => e
|
106
|
+
raise e
|
107
|
+
end
|
108
|
+
|
109
|
+
# Supported Method Parameters:
|
110
|
+
# wmis = PWN::Plugins::VIN.get_wmis_for_manufacturer(
|
111
|
+
# mfr: 'required - Mfr_CommonName returned from #get_all_manufacturers method'
|
112
|
+
# )
|
113
|
+
public_class_method def self.get_wmis_for_manufacturer(opts = {})
|
114
|
+
mfr = opts[:mfr]
|
115
|
+
raise "Invalid manufacturer: #{mfr}" unless mfr.is_a?(String)
|
116
|
+
|
117
|
+
uri_encoded_mfr = CGI.escape_uri_component(mfr)
|
118
|
+
rest_call = "vehicles/GetWMIsForManufacturer/#{uri_encoded_mfr}"
|
119
|
+
params = { format: 'json' }
|
120
|
+
response = vin_rest_call(
|
121
|
+
rest_call: rest_call,
|
122
|
+
params: params
|
123
|
+
)
|
124
|
+
JSON.parse(response, symbolize_names: true)
|
125
|
+
rescue StandardError => e
|
126
|
+
raise e
|
127
|
+
end
|
128
|
+
|
129
|
+
# Supported Method Parameters:
|
130
|
+
# models = PWN::Plugins::VIN.decode_wmi(
|
131
|
+
# wmi: 'required - WMI to decode (e.g. "1FD")'
|
132
|
+
# )
|
133
|
+
public_class_method def self.decode_wmi(opts = {})
|
134
|
+
wmi = opts[:wmi]
|
135
|
+
raise "Invalid WMI: #{wmi}" unless wmi.is_a?(String) && wmi.length == 3
|
136
|
+
|
137
|
+
rest_call = "vehicles/decodewmi/#{wmi}"
|
138
|
+
params = { format: 'json' }
|
139
|
+
response = vin_rest_call(
|
140
|
+
rest_call: rest_call,
|
141
|
+
params: params
|
142
|
+
)
|
143
|
+
JSON.parse(response, symbolize_names: true)
|
144
|
+
rescue StandardError => e
|
145
|
+
raise e
|
146
|
+
end
|
147
|
+
|
148
|
+
# Supported Method Parameters:
|
149
|
+
# models = PWN::Plugins::VIN.decode_vin(
|
150
|
+
# vin: 'required - 17 character VIN to decode'
|
151
|
+
# )
|
152
|
+
public_class_method def self.decode_vin(opts = {})
|
153
|
+
vin = opts[:vin]
|
154
|
+
raise "Invalid VIN: #{vin}" unless vin.is_a?(String) && vin.length == 17
|
155
|
+
|
156
|
+
rest_call = "vehicles/decodevin/#{vin}"
|
157
|
+
params = { format: 'json' }
|
158
|
+
response = vin_rest_call(
|
159
|
+
rest_call: rest_call,
|
160
|
+
params: params
|
161
|
+
)
|
162
|
+
JSON.parse(response, symbolize_names: true)
|
163
|
+
rescue StandardError => e
|
164
|
+
raise e
|
165
|
+
end
|
166
|
+
|
167
|
+
# Supported Method Parameters:
|
168
|
+
# models = PWN::Plugins::VIN.get_models_for_make(
|
169
|
+
# make: 'required - Make_Name returned from get_all_makes'
|
170
|
+
# )
|
171
|
+
public_class_method def self.get_models_for_make(opts = {})
|
172
|
+
make = opts[:make]
|
173
|
+
valid_makes = get_all_makes[:Results].map { |m| m[:Make_Name] }
|
174
|
+
raise "Invalid make: #{make}" unless valid_makes.include?(make.to_s.upcase)
|
175
|
+
|
176
|
+
uri_encoded_make = CGI.escape_uri_component(make)
|
177
|
+
rest_call = "vehicles/getmodelsformake/#{uri_encoded_make}"
|
178
|
+
params = { format: 'json' }
|
179
|
+
response = vin_rest_call(
|
180
|
+
rest_call: rest_call,
|
181
|
+
params: params
|
182
|
+
)
|
183
|
+
json_resp = JSON.parse(response, symbolize_names: true)
|
184
|
+
rescue StandardError => e
|
185
|
+
raise e
|
186
|
+
end
|
187
|
+
|
188
|
+
# Supported Method Parameters:
|
189
|
+
# models = PWN::Plugins::VIN.get_models_for_make_year(
|
190
|
+
# make: 'required - Make_Name returned from get_all_makes',
|
191
|
+
# year: 'optional - e.g. 2023 (defaults to current year)'
|
192
|
+
# )
|
193
|
+
public_class_method def self.get_models_for_make_year(opts = {})
|
194
|
+
make = opts[:make]
|
195
|
+
valid_makes = get_all_makes[:Results].map { |m| m[:Make_Name] }
|
196
|
+
raise "Invalid make: #{make}" unless valid_makes.include?(make.to_s.upcase)
|
197
|
+
|
198
|
+
year = opts[:year] || Time.now.year
|
199
|
+
|
200
|
+
uri_encoded_make = CGI.escape_uri_component(make)
|
201
|
+
rest_call = "vehicles/getmodelsformakeyear/make/#{uri_encoded_make}/modelyear/#{year}"
|
202
|
+
params = { format: 'json' }
|
203
|
+
response = vin_rest_call(
|
204
|
+
rest_call: rest_call,
|
205
|
+
params: params
|
206
|
+
)
|
207
|
+
json_resp = JSON.parse(response, symbolize_names: true)
|
208
|
+
rescue StandardError => e
|
209
|
+
raise e
|
210
|
+
end
|
211
|
+
|
212
|
+
# Supported Method Parameters:
|
213
|
+
# models = PWN::Plugins::VIN.get_vehicle_types_for_make(
|
214
|
+
# make: 'required - Make_Name returned from get_all_makes'
|
215
|
+
# )
|
216
|
+
public_class_method def self.get_vehicle_types_for_make(opts = {})
|
217
|
+
make = opts[:make]
|
218
|
+
valid_makes = get_all_makes[:Results].map { |m| m[:Make_Name] }
|
219
|
+
raise "Invalid make: #{make}" unless valid_makes.include?(make.to_s.upcase)
|
220
|
+
|
221
|
+
uri_encoded_make = CGI.escape_uri_component(make)
|
222
|
+
rest_call = "vehicles/GetVehicleTypesForMake/#{uri_encoded_make}"
|
223
|
+
params = { format: 'json' }
|
224
|
+
response = vin_rest_call(
|
225
|
+
rest_call: rest_call,
|
226
|
+
params: params
|
227
|
+
)
|
228
|
+
json_resp = JSON.parse(response, symbolize_names: true)
|
229
|
+
rescue StandardError => e
|
230
|
+
raise e
|
231
|
+
end
|
232
|
+
|
233
|
+
# Supported Method Parameters:
|
234
|
+
# models = PWN::Plugins::VIN.get_manufacturer_details(
|
235
|
+
# mfr: 'required - Mfr_Name returned from get_all_manufacturers'
|
236
|
+
# )
|
237
|
+
public_class_method def self.get_manufacturer_details(opts = {})
|
238
|
+
mfr = opts[:mfr]
|
239
|
+
|
240
|
+
uri_encoded_mfr = CGI.escape_uri_component(mfr)
|
241
|
+
rest_call = "vehicles/getmanufacturerdetails/#{uri_encoded_mfr}"
|
242
|
+
params = { format: 'json' }
|
243
|
+
response = vin_rest_call(
|
244
|
+
rest_call: rest_call,
|
245
|
+
params: params
|
246
|
+
)
|
247
|
+
json_resp = JSON.parse(response, symbolize_names: true)
|
248
|
+
rescue StandardError => e
|
249
|
+
raise e
|
250
|
+
end
|
251
|
+
|
252
|
+
# Supported Method Parameters:
|
253
|
+
# vin = PWN::Plugins::VIN.generate_vin(
|
254
|
+
# mfr: 'required - manufacturer name (i.e. Mfr_CommonName from #get_all_manufacturers)',
|
255
|
+
# year: 'optional - year of the vehicle (defaults to current year)'
|
256
|
+
# )
|
257
|
+
public_class_method def self.generate_vin(opts = {})
|
258
|
+
mfr = opts[:mfr]
|
259
|
+
year = opts[:year] || Time.now.year
|
260
|
+
|
261
|
+
raise ArgumentError, 'Manufacturer is required' unless mfr
|
262
|
+
|
263
|
+
wmis = get_wmis_for_manufacturer(mfr: mfr)
|
264
|
+
raise "No WMIs found for manufacturer: #{mfr}" if wmis[:Results].empty?
|
265
|
+
|
266
|
+
wmi = wmis[:Results].first[:WMI]
|
267
|
+
raise "Invalid WMI: #{wmi}" unless wmi.is_a?(String) && wmi.length == 3
|
268
|
+
|
269
|
+
# Fixed VDS for simplicity
|
270
|
+
vds = '12345'
|
271
|
+
year_code = get_year_code(year)
|
272
|
+
plant_code = 'A'
|
273
|
+
serial = format('%06d', rand(1_000_000))
|
274
|
+
|
275
|
+
vin = "#{wmi}#{vds}0#{year_code}#{plant_code}#{serial}"
|
276
|
+
check_digit = calculate_check_digit(vin)
|
277
|
+
vin[8] = check_digit
|
278
|
+
vin
|
279
|
+
end
|
280
|
+
|
281
|
+
# Helper method to get the year code for a given year
|
282
|
+
private_class_method def self.get_year_code(year)
|
283
|
+
index = (year - 1980) % 30
|
284
|
+
YEAR_CODES[index]
|
285
|
+
end
|
286
|
+
|
287
|
+
# Helper method to calculate the check digit for a VIN
|
288
|
+
private_class_method def self.calculate_check_digit(vin)
|
289
|
+
raise "Invalid VIN length: #{vin.length}" unless vin.length == 17
|
290
|
+
|
291
|
+
total = 0
|
292
|
+
vin.each_char.with_index do |char, i|
|
293
|
+
# Skip check digit position
|
294
|
+
next if i == 8
|
295
|
+
|
296
|
+
value = if char =~ /\d/
|
297
|
+
char.to_i
|
298
|
+
else
|
299
|
+
LETTER_VALUES[char.upcase] || raise("Invalid character in VIN: #{char}")
|
300
|
+
end
|
301
|
+
total += value * WEIGHTS[i]
|
302
|
+
end
|
303
|
+
check_digit = total % 11
|
304
|
+
check_digit = 'X' if check_digit == 10
|
305
|
+
check_digit.to_s
|
306
|
+
end
|
307
|
+
|
308
|
+
# Author(s):: 0day Inc. <support@0dayinc.com>
|
309
|
+
public_class_method def self.authors
|
310
|
+
"AUTHOR(S):
|
311
|
+
0day Inc. <support@0dayinc.com>
|
312
|
+
"
|
313
|
+
end
|
314
|
+
|
315
|
+
# Display Usage for this Module
|
316
|
+
public_class_method def self.help
|
317
|
+
puts "USAGE:
|
318
|
+
manufacturers = #{self}.get_all_manufacturers
|
319
|
+
|
320
|
+
makes = #{self}.get_all_makes
|
321
|
+
|
322
|
+
wmis = #{self}.get_wmis_for_manufacturer(
|
323
|
+
mfr: 'required - Mfr_CommonName returned from #get_all_manufacturers method'
|
324
|
+
)
|
325
|
+
|
326
|
+
models = #{self}.decode_wmi(
|
327
|
+
wmi: 'required - WMI to decode (e.g. \"1FD\")'
|
328
|
+
)
|
329
|
+
|
330
|
+
models = #{self}.decode_vin(
|
331
|
+
vin: 'required - 17 character VIN to decode'
|
332
|
+
)
|
333
|
+
|
334
|
+
models = #{self}.get_models_for_make(
|
335
|
+
make: 'required - Make_Name returned from get_all_makes'
|
336
|
+
)
|
337
|
+
|
338
|
+
models = #{self}.get_models_for_make_year(
|
339
|
+
make: 'required - Make_Name returned from get_all_makes',
|
340
|
+
year: 'optional - e.g. 2023 (defaults to current year)'
|
341
|
+
)
|
342
|
+
|
343
|
+
models = #{self}.get_vehicle_types_for_make(
|
344
|
+
make: 'required - Make_Name returned from get_all_makes'
|
345
|
+
)
|
346
|
+
|
347
|
+
details = #{self}.get_manufacturer_details(
|
348
|
+
mfr: 'required - Mfr_Name returned from get_all_manufacturers'
|
349
|
+
)
|
350
|
+
|
351
|
+
vin = #{self}.generate_vin(
|
352
|
+
mfr: 'required - manufacturer name (e.g., Mfr_CommonName from get_all_manufacturers)',
|
353
|
+
year: 'optional - year of the vehicle (defaults to current year)'
|
354
|
+
)
|
355
|
+
|
356
|
+
#{self}.authors
|
357
|
+
"
|
358
|
+
end
|
359
|
+
end
|
360
|
+
end
|
361
|
+
end
|
data/lib/pwn/plugins.rb
CHANGED
@@ -72,6 +72,7 @@ module PWN
|
|
72
72
|
autoload :TwitterAPI, 'pwn/plugins/twitter_api'
|
73
73
|
autoload :URIScheme, 'pwn/plugins/uri_scheme'
|
74
74
|
autoload :Vault, 'pwn/plugins/vault'
|
75
|
+
autoload :VIN, 'pwn/plugins/vin'
|
75
76
|
autoload :Voice, 'pwn/plugins/voice'
|
76
77
|
autoload :Vsphere, 'pwn/plugins/vsphere'
|
77
78
|
autoload :XXD, 'pwn/plugins/xxd'
|
data/lib/pwn/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe PWN::Plugins::VIN do
|
6
|
+
it 'should display information for authors' do
|
7
|
+
authors_response = PWN::Plugins::VIN
|
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::VIN
|
13
|
+
expect(help_response).to respond_to :help
|
14
|
+
end
|
15
|
+
end
|
data/third_party/pwn_rdoc.jsonl
CHANGED
@@ -472,7 +472,7 @@
|
|
472
472
|
{"messages":[{"role":"user","content":"PWN::Plugins::BlackDuckBinaryAnalysis.bd_bin_analysis_rest_call Usage"},{"role":"assistant","content":"`PWN::Plugins::BlackDuckBinaryAnalysis.bd_bin_analysis_rest_call`: Supported Method Parameters\n\nbd_bin_analysis_rest_call(\n\ntoken: 'required - Black Duck Binary Analysis API token',\nhttp_method: 'optional HTTP method (defaults to GET)\nrest_call: 'required rest call to make per the schema',\nparams: 'optional params passed in the URI or HTTP Headers',\nhttp_headers: 'optional HTTP headers sent in HTTP methods that support it e.g. POST'\nhttp_body: 'optional HTTP body sent in HTTP methods that support it e.g. POST'\n\n)\n"}]}
|
473
473
|
{"messages":[{"role":"user","content":"PWN::Plugins::BlackDuckBinaryAnalysis.create_group Usage"},{"role":"assistant","content":"`PWN::Plugins::BlackDuckBinaryAnalysis.create_group`: Supported Method Parameters\n\nresponse = PWN::Plugins::BlackDuckBinaryAnalysis.create_group(\n\ntoken: 'required - Bearer token',\nname: 'required - group name',\ndesc: 'optional - group description',\nparent_id: 'optional - parent group id',\ndelete_binary: 'optional - delete binary after analysis C|Y|N (Default: C== company default)',\nbinary_cleanup_age: 'optional - after how long the binary will be deleted in seconds (Default: 2_592_000 / 30 days)',\nproduct_cleanup_age: 'optional - after how long the product will be deleted in seconds (Default: 2_592_000 / 30 days)',\nfile_download_enabled: 'optional - allow download of uploaded binaries from group (Default: false),\nlow_risk_tolerance: 'optional - low risk tolerance nil|true|false (Default: nil == company default)',\ninclude_historical_vulns: 'optional - include historical vulns nil|true|false (Default: nil == company default)',\ncvss3_fallback: 'optional - cvss3 fallback nil|true|false (Default: nil == company default)',\nassume_unknown_version_as_latest: 'optional - assume unknown version as latest nil|true|false (Default: nil == company default)',\ncustom_data: 'optional - custom data hash (Default: {}, see group metadata for details)',\nscan_infoleak: 'optional - scan infoleak nil|true|false (Default: nil == company default)',\ncode_analysis: 'optional - code analysis nil|true|false (Default: nil == company default)',\nscan_code_similarity: 'optional - scan code similarity nil|true|false (Default: nil == company default)'\n\n)\n"}]}
|
474
474
|
{"messages":[{"role":"user","content":"PWN::Plugins::BlackDuckBinaryAnalysis.delete_group Usage"},{"role":"assistant","content":"`PWN::Plugins::BlackDuckBinaryAnalysis.delete_group`: Supported Method Parameters\n\nresponse = PWN::Plugins::BlackDuckBinaryAnalysis.delete_group(\n\ntoken: 'required - Bearer token',\ngroup_id: 'required - group id'\n\n)\n"}]}
|
475
|
-
{"messages":[{"role":"user","content":"PWN::Plugins::BlackDuckBinaryAnalysis.generate_product_report Usage"},{"role":"assistant","content":"`PWN::Plugins::BlackDuckBinaryAnalysis.generate_product_report`: Supported Method Parameters\n\nresponse = PWN::Plugins::BlackDuckBinaryAnalysis.generate_product_report(\n\ntoken: 'required - Bearer token',\nproduct_id: 'required - product id',\noutput_path: 'required - path to output file',\ntype: 'optional - report type csv_libs||csv_vulns|pdf (Defaults to csv_vulns)'\n\n)\n"}]}
|
475
|
+
{"messages":[{"role":"user","content":"PWN::Plugins::BlackDuckBinaryAnalysis.generate_product_report Usage"},{"role":"assistant","content":"`PWN::Plugins::BlackDuckBinaryAnalysis.generate_product_report`: Supported Method Parameters\n\nresponse = PWN::Plugins::BlackDuckBinaryAnalysis.generate_product_report(\n\ntoken: 'required - Bearer token',\nproduct_id: 'required - product id',\noutput_path: 'required - path to output file',\ntype: 'optional - report type csv_libs||csv_vulns|pdf|spdx (Defaults to csv_vulns)'\n\n)\n"}]}
|
476
476
|
{"messages":[{"role":"user","content":"PWN::Plugins::BlackDuckBinaryAnalysis.get_apps Usage"},{"role":"assistant","content":"`PWN::Plugins::BlackDuckBinaryAnalysis.get_apps`: Supported Method Parameters\n\nresponse = PWN::Plugins::BlackDuckBinaryAnalysis.get_apps(\n\ntoken: 'required - Bearer token'\n\n)\n"}]}
|
477
477
|
{"messages":[{"role":"user","content":"PWN::Plugins::BlackDuckBinaryAnalysis.get_apps_by_group Usage"},{"role":"assistant","content":"`PWN::Plugins::BlackDuckBinaryAnalysis.get_apps_by_group`: Supported Method Parameters\n\nresponse = PWN::Plugins::BlackDuckBinaryAnalysis.get_apps_by_group(\n\ntoken: 'required - Bearer token',\ngroup_id: 'required - group id'\n\n)\n"}]}
|
478
478
|
{"messages":[{"role":"user","content":"PWN::Plugins::BlackDuckBinaryAnalysis.get_audit_trail Usage"},{"role":"assistant","content":"`PWN::Plugins::BlackDuckBinaryAnalysis.get_audit_trail`: Supported Method Parameters\n\nresponse = PWN::Plugins::BlackDuckBinaryAnalysis.get_audit_trail(\n\ntoken: 'required - Bearer token'\n\n)\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.
|
4
|
+
version: 0.5.278
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0day Inc.
|
@@ -785,14 +785,14 @@ dependencies:
|
|
785
785
|
requirements:
|
786
786
|
- - '='
|
787
787
|
- !ruby/object:Gem::Version
|
788
|
-
version: 13.
|
788
|
+
version: 13.3.0
|
789
789
|
type: :development
|
790
790
|
prerelease: false
|
791
791
|
version_requirements: !ruby/object:Gem::Requirement
|
792
792
|
requirements:
|
793
793
|
- - '='
|
794
794
|
- !ruby/object:Gem::Version
|
795
|
-
version: 13.
|
795
|
+
version: 13.3.0
|
796
796
|
- !ruby/object:Gem::Dependency
|
797
797
|
name: rb-readline
|
798
798
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1877,6 +1877,7 @@ files:
|
|
1877
1877
|
- lib/pwn/plugins/twitter_api.rb
|
1878
1878
|
- lib/pwn/plugins/uri_scheme.rb
|
1879
1879
|
- lib/pwn/plugins/vault.rb
|
1880
|
+
- lib/pwn/plugins/vin.rb
|
1880
1881
|
- lib/pwn/plugins/voice.rb
|
1881
1882
|
- lib/pwn/plugins/vsphere.rb
|
1882
1883
|
- lib/pwn/plugins/xxd.rb
|
@@ -2214,6 +2215,7 @@ files:
|
|
2214
2215
|
- spec/lib/pwn/plugins/twitter_api_spec.rb
|
2215
2216
|
- spec/lib/pwn/plugins/uri_scheme_spec.rb
|
2216
2217
|
- spec/lib/pwn/plugins/vault_spec.rb
|
2218
|
+
- spec/lib/pwn/plugins/vin_spec.rb
|
2217
2219
|
- spec/lib/pwn/plugins/voice_spec.rb
|
2218
2220
|
- spec/lib/pwn/plugins/vsphere_spec.rb
|
2219
2221
|
- spec/lib/pwn/plugins/xxd_spec.rb
|