Class: ScopesExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/scopes_extractor.rb,
lib/scopes_extractor/utilities.rb

Overview

Class entrypoint to start the extractions and initializes all the objects

Defined Under Namespace

Classes: Utilities

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ScopesExtractor

Returns a new instance of ScopesExtractor.



24
25
26
27
# File 'lib/scopes_extractor.rb', line 24

def initialize(options = {})
  @options = options
  @results = {}
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



21
22
23
# File 'lib/scopes_extractor.rb', line 21

def options
  @options
end

#resultsObject

Returns the value of attribute results.



22
23
24
# File 'lib/scopes_extractor.rb', line 22

def results
  @results
end

Instance Method Details

#extractObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/scopes_extractor.rb', line 29

def extract
  Utilities.log_fatal('[-] The file containing the credentials is mandatory') unless options[:credz_file]
  Dotenv.load(options[:credz_file])

  if options[:yeswehack]
    jwt = YesWeHack::Auth.jwt
    results['YesWeHack'] = {}

    YesWeHack::Programs.sync(results['YesWeHack'], options, jwt)
  end

  if options[:intigriti]
    token = Intigriti::Auth.token
    results['Intigriti'] = {}

    Intigriti::Programs.sync(results['Intigriti'], options, token)
  end

  if options[:bugcrowd]
    cookie = Bugcrowd::Auth.cookie
    results['Bugcrowd'] = {}

    Bugcrowd::Programs.sync(results['Bugcrowd'], options, cookie)
  end

  if options[:hackerone]
    results['Hackerone'] = {}

    Hackerone::Programs.sync(results['Hackerone'], options)
  end

  File.open('extract.json', 'w') { |f| f.write(JSON.pretty_generate(results)) } if options[:save]

  results
end