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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f371cf3eb02a4607a5beee3b2ed121d32fde6668f999a07ab9fd999932ca6e86
4
- data.tar.gz: 0dc423db8c188f9bd0857030df2c4ebf4a383a6ce0bb6e0830f12684de1b304e
3
+ metadata.gz: 5780100847051667d337b384cd5fc617fe46cface20e5903cd62dc23d59536cd
4
+ data.tar.gz: 8607ae725c223b7cd7c84a41d2532baf7cb6f9b623d184706ffa9e2a1c3a998e
5
5
  SHA512:
6
- metadata.gz: 595c9d855daf84c494de3d020255e8d2535b4d7cdaec299a43b67fcecd69555809137c3bd77849092be8181b21105391a35f700ecc01f9bd1ab4cc96fc20767d
7
- data.tar.gz: bb1e0d1b2745d3aa38e122274f3740b01eb4a03e43e26163b33dcbffa5681a26b86214c33a43a63a824b6d6dd60622c7314e9d1cbb35111660623968b239d51c
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 15:32:33 UTC using RuboCop version 1.81.1.
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: 287
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.462]:001 >>> PWN.help
40
+ pwn[v0.5.463]: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.4.4@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.5.462]:001 >>> PWN.help
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.462]:001 >>> PWN.help
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
- begin
57
- case http_method
58
- when :delete, :get
59
- headers[:params] = params
60
- response = rest_client.execute(
61
- method: http_method,
62
- url: "#{base_uri}/#{rest_call}",
63
- headers: headers,
64
- verify_ssl: false,
65
- timeout: 180
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
- when :post, :put
69
- if http_body.is_a?(Hash)
70
- if http_body.key?(:multipart)
71
- headers[:content_type] = 'multipart/form-data'
72
- headers[:x_atlassian_token] = 'no-check'
73
- else
74
- http_body = http_body.to_json
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
- case response.code
91
- when 201, 204
92
- response = { http_response_code: response.code }
93
- else
94
- response = JSON.parse(response, symbolize_names: true) if response.is_a?(RestClient::Response)
95
- response[:http_response_code] = response.code if response.is_a?(RestClient::Response)
96
- end
97
- rescue RestClient::ExceptionWithResponse => e
98
- # Do our best to clone issues with custom fields that
99
- # may not be compatible for the current context.
100
- if rest_call == 'issue' &&
101
- http_method == :post &&
102
- e.response.body.keys.include?(:errors) &&
103
- e.response.code == 400
104
-
105
- errors = e.response.body[:errors]
106
- incompatible_fields = errors.keys
107
- http_body[:fields] = http_body[:fields].except(*incompatible_fields)
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
- # 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.
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PWN
4
- VERSION = '0.5.462'
4
+ VERSION = '0.5.463'
5
5
  end
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.462
4
+ version: 0.5.463
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.