Module: PWN::Plugins::HackerOne

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

Overview

This plugin is used for interacting w/ HackerOne's Hacker REST API using the 'rest' browser type of PWN::Plugins::TransparentBrowser.

Spec: https://api.hackerone.com/getting-started-hacker-api/#getting-started-hacker-api

Auth: HTTP Basic on every request (username + API token). Base: https://api.hackerone.com/v1/hackers/

Credentials are sourced from PWN::Env[:hackerone]:

plugins:
hackerone:
  username: your-h1-username
  api_key:  your-h1-api-token

Constant Summary collapse

BASE_H1_API_URI =
'https://api.hackerone.com/v1/hackers'
@@logger =
PWN::Plugins::PWNLogger.create

Class Method Summary collapse

Class Method Details

.api(opts = {}) ⇒ Object

Supported Method Parameters

response = PWN::Plugins::HackerOne.api( path: 'required - path relative to /v1/hackers (e.g. "me/reports")', method: 'optional - :get|:post|:put|:patch|:delete (default :get)', params: 'optional - query params Hash', body: 'optional - request body Hash/Array/String', username: 'optional', api_key: 'optional', h1_obj: 'optional - session from #login (supplies username/api_key)', raw: 'optional - return raw response (default false)' )



161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/pwn/plugins/hacker_one.rb', line 161

public_class_method def self.api(opts = {})
  creds = creds_from(opts)
  h1_rest_call(
    http_method: opts[:method] || opts[:http_method] || :get,
    rest_call: opts[:path].to_s.delete_prefix('/'),
    params: opts[:params],
    http_body: opts[:body] || opts[:http_body],
    username: creds[:username],
    api_key: creds[:api_key],
    raw: opts[:raw]
  )
rescue StandardError => e
  raise e
end

.authorsObject

Author(s)

0day Inc. [email protected]



651
652
653
654
655
# File 'lib/pwn/plugins/hacker_one.rb', line 651

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

.create_report(opts = {}) ⇒ Object

Supported Method Parameters

report = PWN::Plugins::HackerOne.create_report( team_handle: 'required - program handle', title: 'required - report title', vulnerability_information: 'required - detailed description', impact: 'optional - impact text', severity_rating: 'optional - none|low|medium|high|critical', weakness_id: 'optional - weakness id integer', structured_scope_id: 'optional - structured scope id', body: 'optional - full JSON:API body Hash (overrides attribute kwargs)', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/pwn/plugins/hacker_one.rb', line 239

public_class_method def self.create_report(opts = {})
  creds = creds_from(opts)
  http_body = opts[:body]
  if http_body.nil?
    attrs = {
      team_handle: opts[:team_handle],
      title: opts[:title],
      vulnerability_information: opts[:vulnerability_information]
    }
    attrs[:impact] = opts[:impact] if opts.key?(:impact)
    attrs[:severity_rating] = opts[:severity_rating] if opts.key?(:severity_rating)
    attrs[:weakness_id] = opts[:weakness_id] if opts.key?(:weakness_id)
    attrs[:structured_scope_id] = opts[:structured_scope_id] if opts.key?(:structured_scope_id)

    raise 'ERROR: team_handle required' if attrs[:team_handle].to_s.empty?
    raise 'ERROR: title required' if attrs[:title].to_s.empty?
    raise 'ERROR: vulnerability_information required' if attrs[:vulnerability_information].to_s.empty?

    http_body = {
      data: {
        type: 'report',
        attributes: attrs
      }
    }
  end

  h1_rest_call(
    http_method: :post,
    rest_call: 'reports',
    http_body: http_body,
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.create_report_intent(opts = {}) ⇒ Object

Supported Method Parameters

intent = PWN::Plugins::HackerOne.create_report_intent( body: 'required - full JSON:API body Hash', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
# File 'lib/pwn/plugins/hacker_one.rb', line 504

public_class_method def self.create_report_intent(opts = {})
  body = opts[:body]
  raise 'ERROR: body required for create_report_intent' if body.nil?

  creds = creds_from(opts)
  h1_rest_call(
    http_method: :post,
    rest_call: 'report_intents',
    http_body: body,
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.delete_report_intent(opts = {}) ⇒ Object

Supported Method Parameters

result = PWN::Plugins::HackerOne.delete_report_intent( id: 'required - report intent id', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



551
552
553
554
555
556
557
558
559
560
561
562
563
564
# File 'lib/pwn/plugins/hacker_one.rb', line 551

public_class_method def self.delete_report_intent(opts = {})
  id = opts[:id]
  raise 'ERROR: report intent id required' if id.nil? || id.to_s.empty?

  creds = creds_from(opts)
  h1_rest_call(
    http_method: :delete,
    rest_call: "report_intents/#{id}",
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.delete_report_intent_attachment(opts = {}) ⇒ Object

Supported Method Parameters

result = PWN::Plugins::HackerOne.delete_report_intent_attachment( report_intent_id: 'required - report intent id', id: 'required - attachment id', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
# File 'lib/pwn/plugins/hacker_one.rb', line 617

public_class_method def self.delete_report_intent_attachment(opts = {})
  rid = opts[:report_intent_id]
  id = opts[:id]
  raise 'ERROR: report_intent_id required' if rid.nil? || rid.to_s.empty?
  raise 'ERROR: attachment id required' if id.nil? || id.to_s.empty?

  creds = creds_from(opts)
  h1_rest_call(
    http_method: :delete,
    rest_call: "report_intents/#{rid}/attachments/#{id}",
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.get_balance(opts = {}) ⇒ Object

Supported Method Parameters

balance = PWN::Plugins::HackerOne.get_balance( username: 'optional', api_key: 'optional', h1_obj: 'optional' )



283
284
285
286
287
288
289
290
291
292
# File 'lib/pwn/plugins/hacker_one.rb', line 283

public_class_method def self.get_balance(opts = {})
  creds = creds_from(opts)
  h1_rest_call(
    rest_call: 'payments/balance',
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.get_earnings(opts = {}) ⇒ Object

Supported Method Parameters

earnings = PWN::Plugins::HackerOne.get_earnings( params: 'optional - query params Hash', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



300
301
302
303
304
305
306
307
308
309
310
# File 'lib/pwn/plugins/hacker_one.rb', line 300

public_class_method def self.get_earnings(opts = {})
  creds = creds_from(opts)
  h1_rest_call(
    rest_call: 'payments/earnings',
    params: opts[:params],
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.get_hacktivity(opts = {}) ⇒ Object

Supported Method Parameters

items = PWN::Plugins::HackerOne.get_hacktivity( params: 'optional - query params Hash', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



445
446
447
448
449
450
451
452
453
454
455
# File 'lib/pwn/plugins/hacker_one.rb', line 445

public_class_method def self.get_hacktivity(opts = {})
  creds = creds_from(opts)
  h1_rest_call(
    rest_call: 'hacktivity',
    params: opts[:params],
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.get_me_reports(opts = {}) ⇒ Object

Supported Method Parameters

reports = PWN::Plugins::HackerOne.get_me_reports( params: 'optional - query params Hash (e.g. page/filter)', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



193
194
195
196
197
198
199
200
201
202
203
# File 'lib/pwn/plugins/hacker_one.rb', line 193

public_class_method def self.get_me_reports(opts = {})
  creds = creds_from(opts)
  h1_rest_call(
    rest_call: 'me/reports',
    params: opts[:params],
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.get_payouts(opts = {}) ⇒ Object

Supported Method Parameters

payouts = PWN::Plugins::HackerOne.get_payouts( params: 'optional - query params Hash', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



318
319
320
321
322
323
324
325
326
327
328
# File 'lib/pwn/plugins/hacker_one.rb', line 318

public_class_method def self.get_payouts(opts = {})
  creds = creds_from(opts)
  h1_rest_call(
    rest_call: 'payments/payouts',
    params: opts[:params],
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.get_program(opts = {}) ⇒ Object

Supported Method Parameters

program = PWN::Plugins::HackerOne.get_program( handle: 'required - program handle', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



356
357
358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/pwn/plugins/hacker_one.rb', line 356

public_class_method def self.get_program(opts = {})
  handle = opts[:handle].to_s.scrub
  raise 'ERROR: program handle required' if handle.empty?

  creds = creds_from(opts)
  h1_rest_call(
    rest_call: "programs/#{handle}",
    params: opts[:params],
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.get_programs(opts = {}) ⇒ Object

Supported Method Parameters

programs = PWN::Plugins::HackerOne.get_programs( params: 'optional - query params Hash', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



338
339
340
341
342
343
344
345
346
347
348
# File 'lib/pwn/plugins/hacker_one.rb', line 338

public_class_method def self.get_programs(opts = {})
  creds = creds_from(opts)
  h1_rest_call(
    rest_call: 'programs',
    params: opts[:params],
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.get_report(opts = {}) ⇒ Object

Supported Method Parameters

report = PWN::Plugins::HackerOne.get_report( id: 'required - report id', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/pwn/plugins/hacker_one.rb', line 211

public_class_method def self.get_report(opts = {})
  id = opts[:id]
  raise 'ERROR: report id required' if id.nil? || id.to_s.empty?

  creds = creds_from(opts)
  h1_rest_call(
    rest_call: "reports/#{id}",
    params: opts[:params],
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.get_report_intent(opts = {}) ⇒ Object

Supported Method Parameters

intent = PWN::Plugins::HackerOne.get_report_intent( id: 'required - report intent id', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



483
484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/pwn/plugins/hacker_one.rb', line 483

public_class_method def self.get_report_intent(opts = {})
  id = opts[:id]
  raise 'ERROR: report intent id required' if id.nil? || id.to_s.empty?

  creds = creds_from(opts)
  h1_rest_call(
    rest_call: "report_intents/#{id}",
    params: opts[:params],
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.get_report_intent_attachments(opts = {}) ⇒ Object

Supported Method Parameters

attachments = PWN::Plugins::HackerOne.get_report_intent_attachments( report_intent_id: 'required - report intent id', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



595
596
597
598
599
600
601
602
603
604
605
606
607
608
# File 'lib/pwn/plugins/hacker_one.rb', line 595

public_class_method def self.get_report_intent_attachments(opts = {})
  rid = opts[:report_intent_id] || opts[:id]
  raise 'ERROR: report_intent_id required' if rid.nil? || rid.to_s.empty?

  creds = creds_from(opts)
  h1_rest_call(
    rest_call: "report_intents/#{rid}/attachments",
    params: opts[:params],
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.get_report_intents(opts = {}) ⇒ Object

Supported Method Parameters

intents = PWN::Plugins::HackerOne.get_report_intents( params: 'optional', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



465
466
467
468
469
470
471
472
473
474
475
# File 'lib/pwn/plugins/hacker_one.rb', line 465

public_class_method def self.get_report_intents(opts = {})
  creds = creds_from(opts)
  h1_rest_call(
    rest_call: 'report_intents',
    params: opts[:params],
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.get_scope_exclusions(opts = {}) ⇒ Object

Supported Method Parameters

exclusions = PWN::Plugins::HackerOne.get_scope_exclusions( handle: 'required - program handle', params: 'optional', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/pwn/plugins/hacker_one.rb', line 400

public_class_method def self.get_scope_exclusions(opts = {})
  handle = opts[:handle].to_s.scrub
  raise 'ERROR: program handle required' if handle.empty?

  creds = creds_from(opts)
  h1_rest_call(
    rest_call: "programs/#{handle}/scope_exclusions",
    params: opts[:params],
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.get_structured_scopes(opts = {}) ⇒ Object

Supported Method Parameters

scopes = PWN::Plugins::HackerOne.get_structured_scopes( handle: 'required - program handle', params: 'optional', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/pwn/plugins/hacker_one.rb', line 378

public_class_method def self.get_structured_scopes(opts = {})
  handle = opts[:handle].to_s.scrub
  raise 'ERROR: program handle required' if handle.empty?

  creds = creds_from(opts)
  h1_rest_call(
    rest_call: "programs/#{handle}/structured_scopes",
    params: opts[:params],
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.get_weaknesses(opts = {}) ⇒ Object

Supported Method Parameters

weaknesses = PWN::Plugins::HackerOne.get_weaknesses( handle: 'required - program handle', params: 'optional', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/pwn/plugins/hacker_one.rb', line 422

public_class_method def self.get_weaknesses(opts = {})
  handle = opts[:handle].to_s.scrub
  raise 'ERROR: program handle required' if handle.empty?

  creds = creds_from(opts)
  h1_rest_call(
    rest_call: "programs/#{handle}/weaknesses",
    params: opts[:params],
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.helpObject

Display Usage for this Module



659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
# File 'lib/pwn/plugins/hacker_one.rb', line 659

public_class_method def self.help
  puts "USAGE:
    # Run login and return its result
    #{self}.login(
      username: 'optional - username (default PWN::Env[:plugins][:hackerone][:username])',
      api_key: 'optional - api token (default PWN::Env; will prompt if still nil)',
      token: 'optional - alias for api_key'
    )

    # Run api and return its result
    #{self}.api(
      path: 'required - path relative to /v1/hackers (e.g. me/reports)',
      method: 'optional - :get|:post|:put|:patch|:delete (default :get)',
      params: 'optional - query params Hash',
      body: 'optional - request body Hash/Array/String (defaults to opts[:http_body])',
      username: 'optional - username value consumed by #api',
      api_key: 'optional - api key value consumed by #api',
      h1_obj: 'optional - session from #login (supplies username/api_key)',
      raw: 'optional - return raw response (default false)',
      http_method: 'optional - http method value consumed by #api (defaults to :get)',
      http_body: 'optional - http body value consumed by #api'
    )

    # ---- Reports -------------------------------------------------------
    #{self}.get_me_reports(
      params: 'optional - query params Hash (e.g. page/filter)',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # Run get report and return its result
    #{self}.get_report(
      id: 'required - report id',
      username: 'optional - optional, api_key: optional, h1_obj: optional',
      params: 'optional - params value consumed by #get_report'
    )

    # Run create report and return its result
    #{self}.create_report(
      team_handle: 'required - program handle',
      title: 'required - report title',
      vulnerability_information: 'required - detailed description',
      impact: 'optional - impact text',
      severity_rating: 'optional - none|low|medium|high|critical',
      weakness_id: 'optional - weakness id integer',
      structured_scope_id: 'optional - structured scope id value consumed by #create_report',
      body: 'optional - full JSON:API body Hash (overrides attribute kwargs)',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # ---- Payments ------------------------------------------------------
    #{self}.get_balance(
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # Run get earnings and return its result
    #{self}.get_earnings(
      params: 'optional - query params Hash',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # Run get payouts and return its result
    #{self}.get_payouts(
      params: 'optional - query params Hash',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # ---- Programs -------------------------------------------------------
    #{self}.get_programs(
      params: 'optional - query params Hash',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # Run get program and return its result
    #{self}.get_program(
      handle: 'required - program handle',
      username: 'optional - optional, api_key: optional, h1_obj: optional',
      params: 'optional - params value consumed by #get_program'
    )

    # Run get structured scopes and return its result
    #{self}.get_structured_scopes(
      handle: 'required - program handle',
      params: 'optional - params value consumed by #get_structured_scopes',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # Run get scope exclusions and return its result
    #{self}.get_scope_exclusions(
      handle: 'required - program handle',
      params: 'optional - params value consumed by #get_scope_exclusions',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # Run get weaknesses and return its result
    #{self}.get_weaknesses(
      handle: 'required - program handle',
      params: 'optional - params value consumed by #get_weaknesses',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # ---- Hacktivity -----------------------------------------------------
    #{self}.get_hacktivity(
      params: 'optional - query params Hash',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # ---- Report Intents ------------------------------------------------
    #{self}.get_report_intents(
      params: 'optional - params value consumed by #get_report_intents',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # Run get report intent and return its result
    #{self}.get_report_intent(
      id: 'required - report intent id',
      username: 'optional - optional, api_key: optional, h1_obj: optional',
      params: 'optional - params value consumed by #get_report_intent'
    )

    # Run create report intent and return its result
    #{self}.create_report_intent(
      body: 'required - full JSON:API body Hash',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # Run update report intent and return its result
    #{self}.update_report_intent(
      id: 'required - report intent id',
      body: 'required - full JSON:API body Hash',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # Run delete report intent and return its result
    #{self}.delete_report_intent(
      id: 'required - report intent id',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # Run submit report intent and return its result
    #{self}.submit_report_intent(
      id: 'required - report intent id',
      body: 'optional - JSON:API body Hash',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # Run get report intent attachments and return its result
    #{self}.get_report_intent_attachments(
      report_intent_id: 'required - report intent id value consumed by #get_report_intent_attachments (defaults to opts[:id])',
      username: 'optional - optional, api_key: optional, h1_obj: optional',
      id: 'required - id value consumed by #get_report_intent_attachments',
      params: 'optional - params value consumed by #get_report_intent_attachments'
    )

    # Run delete report intent attachment and return its result
    #{self}.delete_report_intent_attachment(
      report_intent_id: 'required - report intent id value consumed by #delete_report_intent_attachment',
      id: 'required - attachment id',
      username: 'optional - optional, api_key: optional, h1_obj: optional'
    )

    # Clears the session hash in-place (no server-side session to destroy)
    #{self}.logout(
      h1_obj: 'required - required h1_obj returned from #login method'
    )

    # Print the AUTHOR(S) string for this module.
    #{self}.authors
  "
  constants.sort
end

.login(opts = {}) ⇒ Object

Supported Method Parameters

h1_obj = PWN::Plugins::HackerOne.login( username: 'optional - username (default PWN::Env[:hackerone][:username])', api_key: 'optional - api token (default PWN::Env; will prompt if still nil)', token: 'optional - alias for api_key' ) Backward-compatible session object. Auth is HTTP Basic on every subsequent call; login simply resolves + validates credentials against me/reports.



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/pwn/plugins/hacker_one.rb', line 121

public_class_method def self.(opts = {})
  username = resolve_username(opts)
  api_key = resolve_api_key(opts)

  api_key = PWN::Plugins::AuthenticationHelper.mask_password if api_key.nil? || api_key.to_s.empty?

  username = username.to_s.scrub
  api_key = api_key.to_s.scrub
  raise 'ERROR: HackerOne username required' if username.empty?
  raise 'ERROR: HackerOne api_key required' if api_key.empty?

  @@logger.info("Validating HackerOne Hacker API credentials for #{username}")
  # Prefer a cheap authenticated endpoint (balance is small; me/reports is list)
  h1_rest_call(
    rest_call: 'payments/balance',
    username: username,
    api_key: api_key
  )

  {
    username: username,
    api_key: api_key,
    base_h1_api_uri: BASE_H1_API_URI
  }
rescue StandardError => e
  raise e
end

.logout(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::HackerOne.logout( h1_obj: 'required h1_obj returned from #login method' ) Clears the session hash in-place (no server-side session to destroy).



640
641
642
643
644
645
646
647
# File 'lib/pwn/plugins/hacker_one.rb', line 640

public_class_method def self.logout(opts = {})
  h1_obj = opts[:h1_obj]
  @@logger.info('Clearing HackerOne session object...')
  h1_obj.clear if h1_obj.respond_to?(:clear)
  nil
rescue StandardError => e
  raise e
end

.submit_report_intent(opts = {}) ⇒ Object

Supported Method Parameters

result = PWN::Plugins::HackerOne.submit_report_intent( id: 'required - report intent id', body: 'optional - JSON:API body Hash', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
# File 'lib/pwn/plugins/hacker_one.rb', line 573

public_class_method def self.submit_report_intent(opts = {})
  id = opts[:id]
  raise 'ERROR: report intent id required' if id.nil? || id.to_s.empty?

  creds = creds_from(opts)
  h1_rest_call(
    http_method: :post,
    rest_call: "report_intents/#{id}/submit",
    http_body: opts[:body],
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end

.update_report_intent(opts = {}) ⇒ Object

Supported Method Parameters

intent = PWN::Plugins::HackerOne.update_report_intent( id: 'required - report intent id', body: 'required - full JSON:API body Hash', username: 'optional', api_key: 'optional', h1_obj: 'optional' )



527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
# File 'lib/pwn/plugins/hacker_one.rb', line 527

public_class_method def self.update_report_intent(opts = {})
  id = opts[:id]
  body = opts[:body]
  raise 'ERROR: report intent id required' if id.nil? || id.to_s.empty?
  raise 'ERROR: body required for update_report_intent' if body.nil?

  creds = creds_from(opts)
  h1_rest_call(
    http_method: :put,
    rest_call: "report_intents/#{id}",
    http_body: body,
    username: creds[:username],
    api_key: creds[:api_key]
  )
rescue StandardError => e
  raise e
end