pwn 0.5.462 → 0.5.463
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 +69 -54
- 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: 5780100847051667d337b384cd5fc617fe46cface20e5903cd62dc23d59536cd
|
4
|
+
data.tar.gz: 8607ae725c223b7cd7c84a41d2532baf7cb6f9b623d184706ffa9e2a1c3a998e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2add06f66b9dd45458d2aa6b8c1ca0ad31f4af264e8a2c8edb8f9e861b10390244f48dea601bfdf65a29e536201c4b09ab8cb85f523d024498568879a79d556
|
7
|
+
data.tar.gz: dc0c22a8f9f089c455fdceb78ffc429fb8a3647a8b4a0a7a903d7b5da1e6eb975133e0d2cbea9402cb7455eb32230ac4b1fd6c7581a975e5beff02464766d035
|
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.463]: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.463]: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.463]: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. 10000)'
|
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)'
|
@@ -414,6 +416,8 @@ module PWN
|
|
414
416
|
project_key = issue_data[:fields][:project][:key]
|
415
417
|
summary = "CLONE - #{issue_data[:fields][:summary]}"
|
416
418
|
issue_type = issue_data[:fields][:issuetype][:name].downcase.to_sym
|
419
|
+
issue_type_id = issue_data[:fields][:issuetype][:id]
|
420
|
+
|
417
421
|
epic_name = nil
|
418
422
|
if issue_type == :epic
|
419
423
|
all_fields = get_all_fields
|
@@ -421,9 +425,15 @@ module PWN
|
|
421
425
|
epic_name = issue_data[:fields][epic_name_field_key.to_sym]
|
422
426
|
end
|
423
427
|
description = issue_data[:fields][:description]
|
424
|
-
#
|
425
|
-
#
|
426
|
-
#
|
428
|
+
# TODO: Better Field Handling:
|
429
|
+
# GET issue/createmeta/{projectIdOrKey}/issuetypes/{issueTypeId}
|
430
|
+
# to discover required/allowed fields dynamically before
|
431
|
+
# building the payload. Copy only what makes sense—some fields
|
432
|
+
# (e.g., status, created date) can't be set on creation.
|
433
|
+
issue_type_metadata = get_issue_type_metadata(
|
434
|
+
project_key: project_key,
|
435
|
+
issue_type_id: issue_type_id
|
436
|
+
)
|
427
437
|
filtered_fields = issue_data[:fields].compact
|
428
438
|
additional_fields = { fields: filtered_fields }
|
429
439
|
|
@@ -522,6 +532,11 @@ module PWN
|
|
522
532
|
comment: 'optional - comment to add or update in the issue (e.g. \"This is a comment\")'
|
523
533
|
)
|
524
534
|
|
535
|
+
issue_type_metadata = #{self}.get_issue_type_metadata(
|
536
|
+
project_key: 'required - project key (e.g. PWN)',
|
537
|
+
issue_type_id: 'required - issue type ID (e.g. 10000)'
|
538
|
+
)
|
539
|
+
|
525
540
|
issue_resp = #{self}.clone_issue(
|
526
541
|
issue: 'required - issue to clone (e.g. Bug, Issue, Story, or Epic ID)'
|
527
542
|
)
|
data/lib/pwn/version.rb
CHANGED