Class: Vcsmap::Plugin::FacebookClientSecrets

Inherits:
BasePlugin
  • Object
show all
Defined in:
lib/vcsmap/plugins/facebook_client_secrets.rb

Instance Attribute Summary

Attributes inherited from BasePlugin

#search_string

Instance Method Summary collapse

Methods inherited from BasePlugin

#capture_match

Constructor Details

#initializeFacebookClientSecrets

Returns a new instance of FacebookClientSecrets.



4
5
6
7
8
# File 'lib/vcsmap/plugins/facebook_client_secrets.rb', line 4

def initialize
  @search_string = 'filename:fb_client_secrets.json+app_secret'
  @app_id_regex = /(?:\"|')app_id(?:\"|')\:(?:\ |)(?:\"|')(.*?)(?:\"|')/i
  @app_secret_regex = /(?:\"|')app_secret(?:\"|')\:(?:\ |)(?:\"|')(.*?)(?:\"|')/i
end

Instance Method Details

#credentials(file) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/vcsmap/plugins/facebook_client_secrets.rb', line 10

def credentials(file)
  @app_id = capture_match(@app_id_regex, file)
  @app_secret = capture_match(@app_secret_regex, file)
  ['oAuth', @app_id, @app_secret]
rescue NoMethodError
  []
end

#table_headerObject



18
19
20
# File 'lib/vcsmap/plugins/facebook_client_secrets.rb', line 18

def table_header
  %w(Protocol app_id app_secret)
end