Module: PWN::Plugins::JiraServer

Defined in:
lib/pwn/plugins/jira_server.rb

Overview

This plugin is used for interacting w/ on-prem Jira Server’s REST API using the ‘rest’ browser type of PWN::Plugins::TransparentBrowser. This is based on the following Jira API Specification: developer.atlassian.com/server/jira/platform/rest-apis/

Constant Summary collapse

@@logger =
PWN::Plugins::PWNLogger.create

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. <[email protected]>



146
147
148
149
150
# File 'lib/pwn/plugins/jira_server.rb', line 146

public_class_method def self.authors
  "AUTHOR(S):
    0day Inc. <[email protected]>
  "
end

.get_issue(opts = {}) ⇒ Object

Supported Method Parameters

issue_resp = PWN::Plugins::JiraServer.get_issue(

base_api_uri: 'required - base URI for Jira (e.g. https:/corp.jira.com/rest/api/latest)',
token: 'required - bearer token',
issue: 'required - issue to lookup'

)



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/pwn/plugins/jira_server.rb', line 95

public_class_method def self.get_issue(opts = {})
  base_api_uri = opts[:base_api_uri]

  token = opts[:token]
  token ||= PWN::Plugins::AuthenticationHelper.mask_password(
    prompt: 'Personal Access Token'
  )

  issue = opts[:issue]

  raise 'ERROR: issue cannot be nil.' if issue.nil?

  rest_call(
    base_api_uri: base_api_uri,
    token: token,
    rest_call: "issue/#{issue}"
  )
rescue StandardError => e
  raise e
end

.helpObject

Display Usage for this Module



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/pwn/plugins/jira_server.rb', line 154

public_class_method def self.help
  puts "USAGE:
    issue_resp = #{self}.get_issue(
      base_api_uri: 'required - base URI for Jira (e.g. https:/corp.jira.com/rest/api/latest)',
      token: 'required - bearer token',
      issue: 'required - issue to lookup'
    )

    jira_resp = #{self}.manual_call(
      base_api_uri: 'required - base URI for Jira (e.g. https:/corp.jira.com/rest/api/latest)',
      token: 'required - bearer token',
      path: 'required - API path to call, without beginning forward slash'
    )

    #{self}.authors
  "
end

.manual_call(opts = {}) ⇒ Object

Supported Method Parameters

jira_resp = PWN::Plugins::JiraServer.manual_call(

base_api_uri: 'required - base URI for Jira (e.g. https:/corp.jira.com/rest/api/latest)',
token: 'required - bearer token',
path: 'required - API path to call, without beginning forward slash'

)



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/pwn/plugins/jira_server.rb', line 123

public_class_method def self.manual_call(opts = {})
  base_api_uri = opts[:base_api_uri]

  token = opts[:token]
  token ||= PWN::Plugins::AuthenticationHelper.mask_password(
    prompt: 'Personal Access Token'
  )

  path = opts[:path]

  raise 'ERROR: path cannot be nil.' if path.nil?

  rest_call(
    base_api_uri: base_api_uri,
    token: token,
    rest_call: path
  )
rescue StandardError => e
  raise e
end