pwn 0.5.462 → 0.5.464
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 +2 -2
- data/README.md +3 -3
- data/lib/pwn/plugins/jira_server.rb +95 -72
- 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: 8da2a09f078aabba13bc4f410a20baf3e5cb2f99b41940468c92041107a35e15
|
|
4
|
+
data.tar.gz: ce349029a51dc7513d1aa49823a92585521f641195c0c72fb5bda1e6a52622ef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 211bcfd878c18e7c96ec58f8d3eefdba253f70b2922cf51bcb9f3ce0c760f9f5382d88143c068918903af995147bac5733308cdab3916de2fe1d73eb9282d9c8
|
|
7
|
+
data.tar.gz: 55f32eced8d19f73227670efb1779ee7cdeb3f3c87b4f4dd4a0fa2bd9d181abf8b69929a2f4837f4aa1e774b2cc1be7584e00c1a692d64dd24e5332adc8b0040
|
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-17
|
|
3
|
+
# on 2025-10-17 21:43:36 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
|
|
@@ -30,7 +30,7 @@ Lint/RedundantTypeConversion:
|
|
|
30
30
|
- 'lib/pwn/plugins/jenkins.rb'
|
|
31
31
|
- 'lib/pwn/plugins/repl.rb'
|
|
32
32
|
|
|
33
|
-
# Offense count:
|
|
33
|
+
# Offense count: 288
|
|
34
34
|
# This cop supports safe autocorrection (--autocorrect).
|
|
35
35
|
Lint/UselessAssignment:
|
|
36
36
|
Enabled: false
|
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.464]: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.464]: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.464]: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:
|
|
@@ -53,61 +53,45 @@ module PWN
|
|
|
53
53
|
max_request_attempts = 3
|
|
54
54
|
tot_request_attempts ||= 1
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
)
|
|
56
|
+
case http_method
|
|
57
|
+
when :delete, :get
|
|
58
|
+
headers[:params] = params
|
|
59
|
+
response = rest_client.execute(
|
|
60
|
+
method: http_method,
|
|
61
|
+
url: "#{base_uri}/#{rest_call}",
|
|
62
|
+
headers: headers,
|
|
63
|
+
verify_ssl: false,
|
|
64
|
+
timeout: 180
|
|
65
|
+
)
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
end
|
|
67
|
+
when :post, :put
|
|
68
|
+
if http_body.is_a?(Hash)
|
|
69
|
+
if http_body.key?(:multipart)
|
|
70
|
+
headers[:content_type] = 'multipart/form-data'
|
|
71
|
+
headers[:x_atlassian_token] = 'no-check'
|
|
72
|
+
else
|
|
73
|
+
http_body = http_body.to_json
|
|
76
74
|
end
|
|
77
|
-
|
|
78
|
-
response = rest_client.execute(
|
|
79
|
-
method: http_method,
|
|
80
|
-
url: "#{base_uri}/#{rest_call}",
|
|
81
|
-
headers: headers,
|
|
82
|
-
payload: http_body,
|
|
83
|
-
verify_ssl: false,
|
|
84
|
-
timeout: 180
|
|
85
|
-
)
|
|
86
|
-
else
|
|
87
|
-
raise @@logger.error("Unsupported HTTP Method #{http_method} for #{self} Plugin")
|
|
88
75
|
end
|
|
89
76
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
retry
|
|
110
|
-
end
|
|
77
|
+
response = rest_client.execute(
|
|
78
|
+
method: http_method,
|
|
79
|
+
url: "#{base_uri}/#{rest_call}",
|
|
80
|
+
headers: headers,
|
|
81
|
+
payload: http_body,
|
|
82
|
+
verify_ssl: false,
|
|
83
|
+
timeout: 180
|
|
84
|
+
)
|
|
85
|
+
else
|
|
86
|
+
raise @@logger.error("Unsupported HTTP Method #{http_method} for #{self} Plugin")
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
case response.code
|
|
90
|
+
when 201, 204
|
|
91
|
+
response = { http_response_code: response.code }
|
|
92
|
+
else
|
|
93
|
+
response = JSON.parse(response, symbolize_names: true) if response.is_a?(RestClient::Response)
|
|
94
|
+
response[:http_response_code] = response.code if response.is_a?(RestClient::Response)
|
|
111
95
|
end
|
|
112
96
|
|
|
113
97
|
response
|
|
@@ -400,6 +384,24 @@ module PWN
|
|
|
400
384
|
raise e
|
|
401
385
|
end
|
|
402
386
|
|
|
387
|
+
# Supported Method Parameters::
|
|
388
|
+
# issue_type_metadata = PWN::Plugins::JiraServer.get_issue_type_metadata(
|
|
389
|
+
# project_key: 'required - project key (e.g. PWN)',
|
|
390
|
+
# issue_type_id: 'required - issue type ID (e.g. issue[:fields][:issuetype][:id] from #get_issue method)'
|
|
391
|
+
# )
|
|
392
|
+
|
|
393
|
+
public_class_method def self.get_issue_type_metadata(opts = {})
|
|
394
|
+
project_key = opts[:project_key]
|
|
395
|
+
raise 'ERROR: project_key cannot be nil.' if project_key.nil?
|
|
396
|
+
|
|
397
|
+
issue_type_id = opts[:issue_type_id]
|
|
398
|
+
raise 'ERROR: issue_type_id cannot be nil.' if issue_type_id.nil?
|
|
399
|
+
|
|
400
|
+
rest_call(rest_call: "issue/createmeta/#{project_key}/issuetypes/#{issue_type_id}")
|
|
401
|
+
rescue StandardError => e
|
|
402
|
+
raise e
|
|
403
|
+
end
|
|
404
|
+
|
|
403
405
|
# Supported Method Parameters::
|
|
404
406
|
# issue_resp = PWN::Plugins::JiraServer.clone_issue(
|
|
405
407
|
# issue: 'required - issue to clone (e.g. Bug, Issue, Story, or Epic ID)'
|
|
@@ -413,28 +415,44 @@ module PWN
|
|
|
413
415
|
|
|
414
416
|
project_key = issue_data[:fields][:project][:key]
|
|
415
417
|
summary = "CLONE - #{issue_data[:fields][:summary]}"
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
description = issue_data[:fields][:description]
|
|
424
|
-
# Filter out nil values from the additional fields
|
|
425
|
-
# which can be problematic during issue creation if
|
|
426
|
-
# custom fields aren't in the proper context.
|
|
427
|
-
filtered_fields = issue_data[:fields].compact
|
|
428
|
-
additional_fields = { fields: filtered_fields }
|
|
429
|
-
|
|
430
|
-
create_issue(
|
|
431
|
-
project_key: project_key,
|
|
432
|
-
summary: summary,
|
|
433
|
-
issue_type: issue_type,
|
|
434
|
-
epic_name: epic_name,
|
|
435
|
-
description: description,
|
|
436
|
-
additional_fields: additional_fields
|
|
418
|
+
|
|
419
|
+
http_body = { summary: summary }
|
|
420
|
+
|
|
421
|
+
rest_call(
|
|
422
|
+
http_method: :post,
|
|
423
|
+
rest_call: "issue/#{issue}/clone",
|
|
424
|
+
http_body: http_body
|
|
437
425
|
)
|
|
426
|
+
# issue_type = issue_data[:fields][:issuetype][:name].downcase.to_sym
|
|
427
|
+
# issue_type_id = issue_data[:fields][:issuetype][:id]
|
|
428
|
+
|
|
429
|
+
# epic_name = nil
|
|
430
|
+
# if issue_type == :epic
|
|
431
|
+
# all_fields = get_all_fields
|
|
432
|
+
# epic_name_field_key = all_fields.find { |field| field[:name] == 'Epic Name' }[:id]
|
|
433
|
+
# epic_name = issue_data[:fields][epic_name_field_key.to_sym]
|
|
434
|
+
# end
|
|
435
|
+
# description = issue_data[:fields][:description]
|
|
436
|
+
# TODO: Better Field Handling:
|
|
437
|
+
# GET issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}
|
|
438
|
+
# to discover required/allowed fields dynamically before
|
|
439
|
+
# building the payload. Copy only what makes sense—some fields
|
|
440
|
+
# (e.g., status, created date) can't be set on creation.
|
|
441
|
+
# issue_type_metadata = get_issue_type_metadata(
|
|
442
|
+
# project_key: project_key,
|
|
443
|
+
# issue_type_id: issue_type_id
|
|
444
|
+
# )
|
|
445
|
+
# filtered_fields = issue_data[:fields].compact
|
|
446
|
+
# additional_fields = { fields: filtered_fields }
|
|
447
|
+
|
|
448
|
+
# create_issue(
|
|
449
|
+
# project_key: project_key,
|
|
450
|
+
# summary: summary,
|
|
451
|
+
# issue_type: issue_type,
|
|
452
|
+
# epic_name: epic_name,
|
|
453
|
+
# description: description,
|
|
454
|
+
# additional_fields: additional_fields
|
|
455
|
+
# )
|
|
438
456
|
rescue StandardError => e
|
|
439
457
|
raise e
|
|
440
458
|
end
|
|
@@ -522,6 +540,11 @@ module PWN
|
|
|
522
540
|
comment: 'optional - comment to add or update in the issue (e.g. \"This is a comment\")'
|
|
523
541
|
)
|
|
524
542
|
|
|
543
|
+
issue_type_metadata = #{self}.get_issue_type_metadata(
|
|
544
|
+
project_key: 'required - project key (e.g. PWN)',
|
|
545
|
+
issue_type_id: 'required - issue type ID (e.g. issue[:fields][:issuetype][:id] from #get_issue method)'
|
|
546
|
+
)
|
|
547
|
+
|
|
525
548
|
issue_resp = #{self}.clone_issue(
|
|
526
549
|
issue: 'required - issue to clone (e.g. Bug, Issue, Story, or Epic ID)'
|
|
527
550
|
)
|
data/lib/pwn/version.rb
CHANGED