pwn 0.5.456 → 0.5.457
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 +3 -2
- data/README.md +3 -3
- data/lib/pwn/ai/grok.rb +2 -0
- data/lib/pwn/ai/ollama.rb +2 -0
- data/lib/pwn/ai/open_ai.rb +2 -0
- data/lib/pwn/blockchain/btc.rb +12 -11
- data/lib/pwn/config.rb +46 -36
- data/lib/pwn/plugins/jira_server.rb +18 -136
- data/lib/pwn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d18d46d4d3513f94b7970b19fc9ba46648bb8f2aef25c7836645e451d9f688b4
|
4
|
+
data.tar.gz: 808e8f707c74cb9b08ac1adc8b806be3e838475a39dada1a283887fb1a1f0a63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed9838ac68373814f5f00fa5818eff1c26c3e65ea8366c6fe3e78b0cb68fd7e434a274b344e086d99904186744ec81c5c2de6d50c86dd1ea24b4f65d8044cd1f
|
7
|
+
data.tar.gz: 7f5bb258530d291e3adba3e1589d4ce1641db7c2c4ecaee8dc43acdf83d80f56528c17da630488953867b9c5468b5bc337aa0bcdbe82184df969a2d93d2f136e
|
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-10-
|
3
|
+
# on 2025-10-17 15:32:33 UTC using RuboCop version 1.81.1.
|
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
|
@@ -67,13 +67,14 @@ Metrics/ModuleLength:
|
|
67
67
|
- 'lib/pwn/plugins/android.rb'
|
68
68
|
- 'lib/pwn/plugins/transparent_browser.rb'
|
69
69
|
|
70
|
-
# Offense count:
|
70
|
+
# Offense count: 7
|
71
71
|
Naming/AccessorMethodName:
|
72
72
|
Exclude:
|
73
73
|
- 'lib/pwn/ai/grok.rb'
|
74
74
|
- 'lib/pwn/ai/ollama.rb'
|
75
75
|
- 'lib/pwn/ai/open_ai.rb'
|
76
76
|
- 'lib/pwn/blockchain/btc.rb'
|
77
|
+
- 'lib/pwn/plugins/jira_server.rb'
|
77
78
|
- 'lib/pwn/plugins/vin.rb'
|
78
79
|
|
79
80
|
# 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.
|
40
|
+
pwn[v0.5.457]: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.457]: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.457]: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:
|
data/lib/pwn/ai/grok.rb
CHANGED
@@ -25,6 +25,8 @@ module PWN
|
|
25
25
|
|
26
26
|
private_class_method def self.grok_rest_call(opts = {})
|
27
27
|
engine = PWN::Env[:ai][:grok]
|
28
|
+
raise 'ERROR: Jira Server Hash not found in PWN::Env. Run i`pwn -Y default.yaml`, then `PWN::Env` for usage.' if engine.nil?
|
29
|
+
|
28
30
|
token = engine[:key] ||= PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'Grok API Key')
|
29
31
|
|
30
32
|
http_method = if opts[:http_method].nil?
|
data/lib/pwn/ai/ollama.rb
CHANGED
@@ -26,6 +26,8 @@ module PWN
|
|
26
26
|
|
27
27
|
private_class_method def self.ollama_rest_call(opts = {})
|
28
28
|
engine = PWN::Env[:ai][:ollama]
|
29
|
+
raise 'ERROR: Jira Server Hash not found in PWN::Env. Run i`pwn -Y default.yaml`, then `PWN::Env` for usage.' if engine.nil?
|
30
|
+
|
29
31
|
base_uri = engine[:base_uri]
|
30
32
|
raise 'ERROR: base_uri must be provided in PWN::Env[:ai][:ollama][:base_uri]' if base_uri.nil?
|
31
33
|
|
data/lib/pwn/ai/open_ai.rb
CHANGED
@@ -24,6 +24,8 @@ module PWN
|
|
24
24
|
|
25
25
|
private_class_method def self.open_ai_rest_call(opts = {})
|
26
26
|
engine = PWN::Env[:ai][:openai]
|
27
|
+
raise 'ERROR: Jira Server Hash not found in PWN::Env. Run i`pwn -Y default.yaml`, then `PWN::Env` for usage.' if engine.nil?
|
28
|
+
|
27
29
|
token = engine[:key] ||= PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'OpenAI API Key')
|
28
30
|
http_method = if opts[:http_method].nil?
|
29
31
|
:get
|
data/lib/pwn/blockchain/btc.rb
CHANGED
@@ -21,19 +21,20 @@ module PWN
|
|
21
21
|
# )
|
22
22
|
|
23
23
|
private_class_method def self.btc_rest_call(opts = {})
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
rpc_host = PWN::Env[:plugins][:blockchain][:bitcoin][:rpc_host] ||= '127.0.0.1'
|
31
|
-
rpc_port = PWN::Env[:plugins][:blockchain][:bitcoin][:rpc_port] ||= '8332'
|
24
|
+
blockchain = PWN::Env[:plugins][:blockchain][:bitcoin]
|
25
|
+
raise 'ERROR: Jira Server Hash not found in PWN::Env. Run i`pwn -Y default.yaml`, then `PWN::Env` for usage.' if blockchain.nil?
|
26
|
+
|
27
|
+
rpc_host = blockchain[:rpc_host] ||= '127.0.0.1'
|
28
|
+
rpc_port = blockchain[:rpc_port] ||= '8332'
|
32
29
|
base_uri = "http://#{rpc_host}:#{rpc_port}"
|
30
|
+
|
31
|
+
rpc_user = blockchain[:rpc_user] ||= PWN::Plugins::AuthenticationHelper.username(prompt: 'Bitcoin Node RPC Username')
|
32
|
+
rpc_pass = blockchain[:rpc_pass] ||= PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'Bitcoin Node RPC Password')
|
33
|
+
|
34
|
+
http_method = opts[:http_method] ||= :get
|
35
|
+
|
33
36
|
rest_call = opts[:rest_call].to_s.scrub
|
34
37
|
params = opts[:params]
|
35
|
-
rpc_user = PWN::Env[:plugins][:blockchain][:bitcoin][:rpc_user] ||= PWN::Plugins::AuthenticationHelper.username(prompt: 'Bitcoin Node RPC Username')
|
36
|
-
rpc_pass = PWN::Env[:plugins][:blockchain][:bitcoin][:rpc_pass] ||= PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'Bitcoin Node RPC Password')
|
37
38
|
|
38
39
|
basic_auth = Base64.strict_encode64("#{rpc_user}:#{rpc_pass}")
|
39
40
|
|
@@ -59,7 +60,7 @@ module PWN
|
|
59
60
|
end
|
60
61
|
|
61
62
|
retries = 0
|
62
|
-
case http_method
|
63
|
+
case http_method.to_s.scrub.downcase.to_sym
|
63
64
|
when :delete, :get
|
64
65
|
headers[:params] = params
|
65
66
|
response = rest_client.execute(
|
data/lib/pwn/config.rb
CHANGED
@@ -7,43 +7,9 @@ module PWN
|
|
7
7
|
# Used to manage PWN configuration settings within PWN drivers.
|
8
8
|
module Config
|
9
9
|
# Supported Method Parameters::
|
10
|
-
# PWN::Config.
|
11
|
-
#
|
10
|
+
# env = PWN::Config.default_env(
|
11
|
+
# pwn_env_path: 'optional - Path to pwn.yaml file. Defaults to ~/.pwn/pwn.yaml'
|
12
12
|
# )
|
13
|
-
public_class_method def self.redact_sensitive_artifacts(opts = {})
|
14
|
-
config = opts[:config] ||= PWN::Env
|
15
|
-
|
16
|
-
sensitive_keys = %i[api_key key pass password psk token]
|
17
|
-
|
18
|
-
# Transform values at the current level: redact sensitive keys
|
19
|
-
config.transform_values.with_index do |v, k|
|
20
|
-
if sensitive_keys.include?(config.keys[k])
|
21
|
-
'>>> REDACTED >>> USE `pwn-vault` FOR ADMINISTRATION <<< REDACTED <<<'
|
22
|
-
else
|
23
|
-
v.is_a?(Hash) ? redact_sensitive_artifacts(config: v) : v
|
24
|
-
end
|
25
|
-
end
|
26
|
-
rescue StandardError => e
|
27
|
-
raise e
|
28
|
-
end
|
29
|
-
|
30
|
-
# Supported Method Parameters::
|
31
|
-
# env = PWN::Config.init_driver_options
|
32
|
-
public_class_method def self.init_driver_options
|
33
|
-
env = {
|
34
|
-
driver_opts: {
|
35
|
-
pwn_env_path: nil,
|
36
|
-
pwn_dec_path: nil
|
37
|
-
}
|
38
|
-
}
|
39
|
-
PWN.const_set(:Env, env)
|
40
|
-
# puts '[*] Loaded driver options.'
|
41
|
-
rescue StandardError => e
|
42
|
-
raise e
|
43
|
-
end
|
44
|
-
|
45
|
-
# Supported Method Parameters::
|
46
|
-
# env = PWN::Config.default_env
|
47
13
|
public_class_method def self.default_env(opts = {})
|
48
14
|
pwn_env_path = opts[:pwn_env_path]
|
49
15
|
pwn_dec_path = "#{pwn_env_path}.decryptor"
|
@@ -119,6 +85,10 @@ module PWN
|
|
119
85
|
}
|
120
86
|
},
|
121
87
|
hunter: { api_key: 'hunter.how API Key' },
|
88
|
+
jira_server: {
|
89
|
+
base_uri: 'Jira Server Base API URI (e.g. https://jira.company.com/rest/api/latest)',
|
90
|
+
token: 'Jira Server API Token'
|
91
|
+
},
|
122
92
|
meshtastic: {
|
123
93
|
mqtt: {
|
124
94
|
host: 'mqtt.meshtastic.org',
|
@@ -165,6 +135,42 @@ module PWN
|
|
165
135
|
raise e
|
166
136
|
end
|
167
137
|
|
138
|
+
# Supported Method Parameters::
|
139
|
+
# PWN::Config.redact_sensitive_artifacts(
|
140
|
+
# config: 'optional - Hash to redact sensitive artifacts from. Defaults to PWN::Env'
|
141
|
+
# )
|
142
|
+
public_class_method def self.redact_sensitive_artifacts(opts = {})
|
143
|
+
config = opts[:config] ||= PWN::Env
|
144
|
+
|
145
|
+
sensitive_keys = %i[api_key key pass password psk token]
|
146
|
+
|
147
|
+
# Transform values at the current level: redact sensitive keys
|
148
|
+
config.transform_values.with_index do |v, k|
|
149
|
+
if sensitive_keys.include?(config.keys[k])
|
150
|
+
'>>> REDACTED >>> USE `pwn-vault` FOR ADMINISTRATION <<< REDACTED <<<'
|
151
|
+
else
|
152
|
+
v.is_a?(Hash) ? redact_sensitive_artifacts(config: v) : v
|
153
|
+
end
|
154
|
+
end
|
155
|
+
rescue StandardError => e
|
156
|
+
raise e
|
157
|
+
end
|
158
|
+
|
159
|
+
# Supported Method Parameters::
|
160
|
+
# env = PWN::Config.init_driver_options
|
161
|
+
public_class_method def self.init_driver_options
|
162
|
+
env = {
|
163
|
+
driver_opts: {
|
164
|
+
pwn_env_path: nil,
|
165
|
+
pwn_dec_path: nil
|
166
|
+
}
|
167
|
+
}
|
168
|
+
PWN.const_set(:Env, env)
|
169
|
+
# puts '[*] Loaded driver options.'
|
170
|
+
rescue StandardError => e
|
171
|
+
raise e
|
172
|
+
end
|
173
|
+
|
168
174
|
# Supported Method Parameters::
|
169
175
|
# PWN::Config.refresh_env(
|
170
176
|
# pwn_env_path: 'optional - Path to pwn.yaml file. Defaults to ~/.pwn/pwn.yaml',
|
@@ -266,6 +272,10 @@ module PWN
|
|
266
272
|
pwn_env_path: 'optional - Path to pwn.yaml file. Defaults to ~/.pwn/pwn.yaml'
|
267
273
|
)
|
268
274
|
|
275
|
+
#{self}.redact_sensitive_artifacts(
|
276
|
+
config: 'optional - Hash to redact sensitive artifacts from. Defaults to PWN::Env'
|
277
|
+
)
|
278
|
+
|
269
279
|
#{self}.refresh_env(
|
270
280
|
pwn_env_path: 'optional - Path to pwn.yaml file. Defaults to ~/.pwn/pwn.yaml',
|
271
281
|
pwn_dec_path: 'optional - Path to pwn.yaml.decryptor file. Defaults to ~/.pwn/pwn.yaml.decryrptor'
|
@@ -22,7 +22,12 @@ module PWN
|
|
22
22
|
# )
|
23
23
|
|
24
24
|
private_class_method def self.rest_call(opts = {})
|
25
|
-
|
25
|
+
jserver = PWN::Env[:plugins][:jira_server]
|
26
|
+
raise 'ERROR: Jira Server Hash not found in PWN::Env. Run i`pwn -Y default.yaml`, then `PWN::Env` for usage.' if jserver.nil?
|
27
|
+
|
28
|
+
base_uri = jserver[:base_uri]
|
29
|
+
token = jserver[:token]
|
30
|
+
|
26
31
|
http_method = if opts[:http_method].nil?
|
27
32
|
:get
|
28
33
|
else
|
@@ -36,9 +41,8 @@ module PWN
|
|
36
41
|
}
|
37
42
|
|
38
43
|
http_body = opts[:http_body]
|
39
|
-
base_api_uri = opts[:base_api_uri]
|
40
44
|
|
41
|
-
raise 'ERROR:
|
45
|
+
raise 'ERROR: base_uri cannot be nil.' if base_uri.nil?
|
42
46
|
|
43
47
|
browser_obj = PWN::Plugins::TransparentBrowser.open(browser_type: :rest)
|
44
48
|
rest_client = browser_obj[:browser]::Request
|
@@ -54,7 +58,7 @@ module PWN
|
|
54
58
|
headers[:params] = params
|
55
59
|
response = rest_client.execute(
|
56
60
|
method: http_method,
|
57
|
-
url: "#{
|
61
|
+
url: "#{base_uri}/#{rest_call}",
|
58
62
|
headers: headers,
|
59
63
|
verify_ssl: false,
|
60
64
|
timeout: 180
|
@@ -72,7 +76,7 @@ module PWN
|
|
72
76
|
|
73
77
|
response = rest_client.execute(
|
74
78
|
method: http_method,
|
75
|
-
url: "#{
|
79
|
+
url: "#{base_uri}/#{rest_call}",
|
76
80
|
headers: headers,
|
77
81
|
payload: http_body,
|
78
82
|
verify_ssl: false,
|
@@ -93,7 +97,7 @@ module PWN
|
|
93
97
|
response
|
94
98
|
rescue RestClient::ExceptionWithResponse => e
|
95
99
|
if e.response
|
96
|
-
puts "HTTP BASE URL: #{
|
100
|
+
puts "HTTP BASE URL: #{base_uri}"
|
97
101
|
puts "HTTP PATH: #{rest_call}"
|
98
102
|
puts "HTTP RESPONSE CODE: #{e.response.code}"
|
99
103
|
puts "HTTP RESPONSE HEADERS: #{e.response.headers}"
|
@@ -127,45 +131,22 @@ module PWN
|
|
127
131
|
end
|
128
132
|
|
129
133
|
# Supported Method Parameters::
|
130
|
-
# all_fields = PWN::Plugins::JiraServer.get_all_fields
|
131
|
-
# base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
132
|
-
# token: 'required - personal access token'
|
133
|
-
# )
|
134
|
-
|
135
|
-
public_class_method def self.get_all_fields(opts = {})
|
136
|
-
base_api_uri = opts[:base_api_uri]
|
137
|
-
|
138
|
-
token = opts[:token]
|
139
|
-
token ||= PWN::Plugins::AuthenticationHelper.mask_password(
|
140
|
-
prompt: 'Personal Access Token'
|
141
|
-
)
|
134
|
+
# all_fields = PWN::Plugins::JiraServer.get_all_fields
|
142
135
|
|
143
|
-
|
144
|
-
|
145
|
-
token: token,
|
146
|
-
rest_call: 'field'
|
147
|
-
)
|
136
|
+
public_class_method def self.get_all_fields
|
137
|
+
rest_call(rest_call: 'field')
|
148
138
|
rescue StandardError => e
|
149
139
|
raise e
|
150
140
|
end
|
151
141
|
|
152
142
|
# Supported Method Parameters::
|
153
143
|
# user = PWN::Plugins::JiraServer.get_user(
|
154
|
-
# base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
155
|
-
# token: 'required - personal access token',
|
156
144
|
# username: 'required - username to lookup (e.g. jane.doe)',
|
157
145
|
# params: 'optional - additional parameters to pass in the URI (e.g. expand, etc.)'
|
158
146
|
# )
|
159
147
|
|
160
148
|
public_class_method def self.get_user(opts = {})
|
161
|
-
|
162
|
-
|
163
|
-
token = opts[:token]
|
164
|
-
token ||= PWN::Plugins::AuthenticationHelper.mask_password(
|
165
|
-
prompt: 'Personal Access Token'
|
166
|
-
)
|
167
|
-
|
168
|
-
username = opts[:username]
|
149
|
+
username = opts[:username] || PWN::Plugins::AuthenticationHelper.username
|
169
150
|
raise 'ERROR: username cannot be nil.' if username.nil?
|
170
151
|
|
171
152
|
params = { key: username }
|
@@ -174,8 +155,6 @@ module PWN
|
|
174
155
|
params.merge!(additional_params) if additional_params.is_a?(Hash)
|
175
156
|
|
176
157
|
rest_call(
|
177
|
-
base_api_uri: base_api_uri,
|
178
|
-
token: token,
|
179
158
|
rest_call: 'user',
|
180
159
|
params: params
|
181
160
|
)
|
@@ -185,28 +164,17 @@ module PWN
|
|
185
164
|
|
186
165
|
# Supported Method Parameters::
|
187
166
|
# issue_resp = PWN::Plugins::JiraServer.get_issue(
|
188
|
-
# base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
189
|
-
# token: 'required - personal access token',
|
190
167
|
# issue: 'required - issue to lookup (e.g. Bug, Issue, Story, or Epic ID)',
|
191
168
|
# params: 'optional - additional parameters to pass in the URI (e.g. fields, expand, etc.)'
|
192
169
|
# )
|
193
170
|
|
194
171
|
public_class_method def self.get_issue(opts = {})
|
195
|
-
base_api_uri = opts[:base_api_uri]
|
196
|
-
|
197
|
-
token = opts[:token]
|
198
|
-
token ||= PWN::Plugins::AuthenticationHelper.mask_password(
|
199
|
-
prompt: 'Personal Access Token'
|
200
|
-
)
|
201
|
-
|
202
172
|
issue = opts[:issue]
|
203
173
|
params = opts[:params]
|
204
174
|
|
205
175
|
raise 'ERROR: issue cannot be nil.' if issue.nil?
|
206
176
|
|
207
177
|
rest_call(
|
208
|
-
base_api_uri: base_api_uri,
|
209
|
-
token: token,
|
210
178
|
rest_call: "issue/#{issue}",
|
211
179
|
params: params
|
212
180
|
)
|
@@ -216,8 +184,6 @@ module PWN
|
|
216
184
|
|
217
185
|
# Supported Method Parameters::
|
218
186
|
# issue_resp = PWN::Plugins::JiraServer.create_issue(
|
219
|
-
# base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
220
|
-
# token: 'required - personal access token',
|
221
187
|
# project_key: 'required - project key (e.g. PWN)',
|
222
188
|
# summary: 'required - summary of the issue (e.g. Epic for PWN-1337)',
|
223
189
|
# issue_type: 'required - issue type (e.g. :epic, :story, :bug)',
|
@@ -229,12 +195,6 @@ module PWN
|
|
229
195
|
# )
|
230
196
|
|
231
197
|
public_class_method def self.create_issue(opts = {})
|
232
|
-
base_api_uri = opts[:base_api_uri]
|
233
|
-
|
234
|
-
token = opts[:token]
|
235
|
-
token ||= PWN::Plugins::AuthenticationHelper.mask_password(
|
236
|
-
prompt: 'Personal Access Token'
|
237
|
-
)
|
238
198
|
project_key = opts[:project_key]
|
239
199
|
raise 'ERROR: project_key cannot be nil.' if project_key.nil?
|
240
200
|
|
@@ -254,7 +214,7 @@ module PWN
|
|
254
214
|
|
255
215
|
comment = opts[:comment]
|
256
216
|
|
257
|
-
all_fields = get_all_fields(
|
217
|
+
all_fields = get_all_fields(base_uri: base_uri, token: token)
|
258
218
|
epic_name_field_key = all_fields.find { |field| field[:name] == 'Epic Name' }[:id]
|
259
219
|
|
260
220
|
epic_name = opts[:epic_name]
|
@@ -277,8 +237,6 @@ module PWN
|
|
277
237
|
|
278
238
|
issue_resp = rest_call(
|
279
239
|
http_method: :post,
|
280
|
-
base_api_uri: base_api_uri,
|
281
|
-
token: token,
|
282
240
|
rest_call: 'issue',
|
283
241
|
http_body: http_body
|
284
242
|
)
|
@@ -295,8 +253,6 @@ module PWN
|
|
295
253
|
|
296
254
|
rest_call(
|
297
255
|
http_method: :post,
|
298
|
-
base_api_uri: base_api_uri,
|
299
|
-
token: token,
|
300
256
|
rest_call: "issue/#{issue}/attachments",
|
301
257
|
http_body: http_body
|
302
258
|
)
|
@@ -305,38 +261,24 @@ module PWN
|
|
305
261
|
|
306
262
|
if comment
|
307
263
|
issue_comment(
|
308
|
-
base_api_uri: base_api_uri,
|
309
|
-
token: token,
|
310
264
|
issue: issue,
|
311
265
|
comment_action: :add,
|
312
266
|
comment: comment
|
313
267
|
)
|
314
268
|
end
|
315
269
|
|
316
|
-
get_issue(
|
317
|
-
base_api_uri: base_api_uri,
|
318
|
-
token: token,
|
319
|
-
issue: issue
|
320
|
-
)
|
270
|
+
get_issue(issue: issue)
|
321
271
|
rescue StandardError => e
|
322
272
|
raise e
|
323
273
|
end
|
324
274
|
|
325
275
|
# Supported Method Parameters::
|
326
276
|
# issue_resp = PWN::Plugins::JiraServer.update_issue(
|
327
|
-
# base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
328
|
-
# token: 'required - personal access token',
|
329
277
|
# fields: 'required - fields to update in the issue (e.g. summary, description, labels, components, custom fields, etc.)',
|
330
278
|
# attachments: 'optional - array of attachment paths to upload to the issue (e.g. ["/tmp/file1.txt", "/tmp/file2.txt"])',
|
331
279
|
# )
|
332
280
|
|
333
281
|
public_class_method def self.update_issue(opts = {})
|
334
|
-
base_api_uri = opts[:base_api_uri]
|
335
|
-
|
336
|
-
token = opts[:token]
|
337
|
-
token ||= PWN::Plugins::AuthenticationHelper.mask_password(
|
338
|
-
prompt: 'Personal Access Token'
|
339
|
-
)
|
340
282
|
issue = opts[:issue]
|
341
283
|
raise 'ERROR: project_key cannot be nil.' if issue.nil?
|
342
284
|
|
@@ -350,8 +292,6 @@ module PWN
|
|
350
292
|
|
351
293
|
rest_call(
|
352
294
|
http_method: :put,
|
353
|
-
base_api_uri: base_api_uri,
|
354
|
-
token: token,
|
355
295
|
rest_call: "issue/#{issue}",
|
356
296
|
http_body: http_body
|
357
297
|
)
|
@@ -367,8 +307,6 @@ module PWN
|
|
367
307
|
|
368
308
|
rest_call(
|
369
309
|
http_method: :post,
|
370
|
-
base_api_uri: base_api_uri,
|
371
|
-
token: token,
|
372
310
|
rest_call: "issue/#{issue}/attachments",
|
373
311
|
http_body: http_body
|
374
312
|
)
|
@@ -376,8 +314,6 @@ module PWN
|
|
376
314
|
end
|
377
315
|
|
378
316
|
get_issue(
|
379
|
-
base_api_uri: base_api_uri,
|
380
|
-
token: token,
|
381
317
|
issue: issue
|
382
318
|
)
|
383
319
|
rescue StandardError => e
|
@@ -386,8 +322,6 @@ module PWN
|
|
386
322
|
|
387
323
|
# Supported Method Parameters::
|
388
324
|
# issue_resp = PWN::Plugins::JiraServer.issue_comment(
|
389
|
-
# base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
390
|
-
# token: 'required - personal access token',
|
391
325
|
# issue: 'required - issue to delete (e.g. Bug, Issue, Story, or Epic ID)',
|
392
326
|
# comment_action: 'required - action to perform on the issue comment (e.g. :delete, :add, :update - Defaults to :add)',
|
393
327
|
# comment_id: 'optional - comment ID to delete or update (e.g. 10000)',
|
@@ -396,13 +330,6 @@ module PWN
|
|
396
330
|
# )
|
397
331
|
|
398
332
|
public_class_method def self.issue_comment(opts = {})
|
399
|
-
base_api_uri = opts[:base_api_uri]
|
400
|
-
|
401
|
-
token = opts[:token]
|
402
|
-
token ||= PWN::Plugins::AuthenticationHelper.mask_password(
|
403
|
-
prompt: 'Personal Access Token'
|
404
|
-
)
|
405
|
-
|
406
333
|
issue = opts[:issue]
|
407
334
|
raise 'ERROR: issue cannot be nil.' if issue.nil?
|
408
335
|
|
@@ -434,43 +361,26 @@ module PWN
|
|
434
361
|
|
435
362
|
rest_call(
|
436
363
|
http_method: http_method,
|
437
|
-
base_api_uri: base_api_uri,
|
438
|
-
token: token,
|
439
364
|
rest_call: rest_call,
|
440
365
|
http_body: http_body
|
441
366
|
)
|
442
367
|
|
443
|
-
get_issue(
|
444
|
-
base_api_uri: base_api_uri,
|
445
|
-
token: token,
|
446
|
-
issue: issue
|
447
|
-
)
|
368
|
+
get_issue(issue: issue)
|
448
369
|
rescue StandardError => e
|
449
370
|
raise e
|
450
371
|
end
|
451
372
|
|
452
373
|
# Supported Method Parameters::
|
453
374
|
# issue_resp = PWN::Plugins::JiraServer.delete_issue(
|
454
|
-
# base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
455
|
-
# token: 'required - personal access token',
|
456
375
|
# issue: 'required - issue to delete (e.g. Bug, Issue, Story, or Epic ID)'
|
457
376
|
# )
|
458
377
|
|
459
378
|
public_class_method def self.delete_issue(opts = {})
|
460
|
-
base_api_uri = opts[:base_api_uri]
|
461
|
-
|
462
|
-
token = opts[:token]
|
463
|
-
token ||= PWN::Plugins::AuthenticationHelper.mask_password(
|
464
|
-
prompt: 'Personal Access Token'
|
465
|
-
)
|
466
|
-
|
467
379
|
issue = opts[:issue]
|
468
380
|
raise 'ERROR: issue cannot be nil.' if issue.nil?
|
469
381
|
|
470
382
|
rest_call(
|
471
383
|
http_method: :delete,
|
472
|
-
base_api_uri: base_api_uri,
|
473
|
-
token: token,
|
474
384
|
rest_call: "issue/#{issue}"
|
475
385
|
)
|
476
386
|
rescue StandardError => e
|
@@ -479,26 +389,15 @@ module PWN
|
|
479
389
|
|
480
390
|
# Supported Method Parameters::
|
481
391
|
# issue_resp = PWN::Plugins::JiraServer.delete_attachment(
|
482
|
-
# base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
483
|
-
# token: 'required - personal access token',
|
484
392
|
# id: 'required - attachment ID to delete (e.g. 10000) found in #get_issue method'
|
485
393
|
# )
|
486
394
|
|
487
395
|
public_class_method def self.delete_attachment(opts = {})
|
488
|
-
base_api_uri = opts[:base_api_uri]
|
489
|
-
|
490
|
-
token = opts[:token]
|
491
|
-
token ||= PWN::Plugins::AuthenticationHelper.mask_password(
|
492
|
-
prompt: 'Personal Access Token'
|
493
|
-
)
|
494
|
-
|
495
396
|
id = opts[:id]
|
496
397
|
raise 'ERROR: attachment_id cannot be nil.' if id.nil?
|
497
398
|
|
498
399
|
rest_call(
|
499
400
|
http_method: :delete,
|
500
|
-
base_api_uri: base_api_uri,
|
501
|
-
token: token,
|
502
401
|
rest_call: "attachment/#{id}"
|
503
402
|
)
|
504
403
|
rescue StandardError => e
|
@@ -517,28 +416,19 @@ module PWN
|
|
517
416
|
|
518
417
|
public_class_method def self.help
|
519
418
|
puts "USAGE:
|
520
|
-
all_fields = #{self}.get_all_fields
|
521
|
-
base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
522
|
-
token: 'required - personal access token'
|
523
|
-
)
|
419
|
+
all_fields = #{self}.get_all_fields
|
524
420
|
|
525
421
|
user = #{self}.get_user(
|
526
|
-
base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
527
|
-
token: 'required - personal access token',
|
528
422
|
username: 'required - username to lookup (e.g. jane.doe')',
|
529
423
|
params: 'optional - additional parameters to pass in the URI (e.g. expand, etc.)'
|
530
424
|
)
|
531
425
|
|
532
426
|
issue_resp = #{self}.get_issue(
|
533
|
-
base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
534
|
-
token: 'required - personal access token',
|
535
427
|
issue: 'required - issue to lookup (e.g. Bug, Issue, Story, or Epic ID)',
|
536
428
|
params: 'optional - additional parameters to pass in the URI'
|
537
429
|
)
|
538
430
|
|
539
431
|
issue_resp = #{self}.create_issue(
|
540
|
-
base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
541
|
-
token: 'required - personal access token',
|
542
432
|
project_key: 'required - project key (e.g. PWN)',
|
543
433
|
summary: 'required - summary of the issue (e.g. Epic for PWN-1337)',
|
544
434
|
issue_type: 'required - issue type (e.g. :epic, :story, :bug)',
|
@@ -550,16 +440,12 @@ module PWN
|
|
550
440
|
)
|
551
441
|
|
552
442
|
issue_resp = #{self}.update_issue(
|
553
|
-
base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
554
|
-
token: 'required - personal access token',
|
555
443
|
issue: 'required - issue to update (e.g. Bug, Issue, Story, or Epic ID)',
|
556
444
|
fields: 'required - fields to update in the issue (e.g. summary, description, labels, components, custom fields, etc.)',
|
557
445
|
attachments: 'optional - array of attachment paths to upload to the issue (e.g. [\"/tmp/file1.txt\", \"/tmp/file2.txt\"])'
|
558
446
|
)
|
559
447
|
|
560
448
|
issue_resp = #{self}.issue_comment(
|
561
|
-
base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
562
|
-
token: 'required - personal access token',
|
563
449
|
issue: 'required - issue to comment on (e.g. Bug, Issue, Story, or Epic ID)',
|
564
450
|
comment_action: 'required - action to perform on the issue comment (e.g. :delete, :add, :update - Defaults to :add)',
|
565
451
|
comment_id: 'optional - comment ID to delete or update (e.g. 10000)',
|
@@ -568,14 +454,10 @@ module PWN
|
|
568
454
|
)
|
569
455
|
|
570
456
|
issue_resp = #{self}.delete_issue(
|
571
|
-
base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
572
|
-
token: 'required - personal access token',
|
573
457
|
issue: 'required - issue to delete (e.g. Bug, Issue, Story, or Epic ID)'
|
574
458
|
)
|
575
459
|
|
576
460
|
issue_resp = #{self}.delete_attachment(
|
577
|
-
base_api_uri: 'required - base URI for Jira (e.g. https:/jira.corp.com/rest/api/latest)',
|
578
|
-
token: 'required - personal access token',
|
579
461
|
id: 'required - attachment ID to delete (e.g. 10000) found in #get_issue method'
|
580
462
|
)
|
581
463
|
|
data/lib/pwn/version.rb
CHANGED