Class: Mihari::Config
- Inherits:
-
Object
- Object
- Mihari::Config
- Defined in:
- lib/mihari/config.rb
Instance Attribute Summary collapse
-
#binaryedge_api_key ⇒ Object
Returns the value of attribute binaryedge_api_key.
-
#censys_id ⇒ Object
Returns the value of attribute censys_id.
-
#censys_secret ⇒ Object
Returns the value of attribute censys_secret.
-
#circl_passive_password ⇒ Object
Returns the value of attribute circl_passive_password.
-
#circl_passive_username ⇒ Object
Returns the value of attribute circl_passive_username.
-
#database ⇒ Object
Returns the value of attribute database.
-
#misp_api_endpoint ⇒ Object
Returns the value of attribute misp_api_endpoint.
-
#misp_api_key ⇒ Object
Returns the value of attribute misp_api_key.
-
#onyphe_api_key ⇒ Object
Returns the value of attribute onyphe_api_key.
-
#otx_api_key ⇒ Object
Returns the value of attribute otx_api_key.
-
#passivetotal_api_key ⇒ Object
Returns the value of attribute passivetotal_api_key.
-
#passivetotal_username ⇒ Object
Returns the value of attribute passivetotal_username.
-
#pulsedive_api_key ⇒ Object
Returns the value of attribute pulsedive_api_key.
-
#securitytrails_api_key ⇒ Object
Returns the value of attribute securitytrails_api_key.
-
#shodan_api_key ⇒ Object
Returns the value of attribute shodan_api_key.
-
#slack_channel ⇒ Object
Returns the value of attribute slack_channel.
-
#slack_webhook_url ⇒ Object
Returns the value of attribute slack_webhook_url.
-
#thehive_api_endpoint ⇒ Object
Returns the value of attribute thehive_api_endpoint.
-
#thehive_api_key ⇒ Object
Returns the value of attribute thehive_api_key.
-
#virustotal_api_key ⇒ Object
Returns the value of attribute virustotal_api_key.
-
#zoomeye_password ⇒ Object
Returns the value of attribute zoomeye_password.
-
#zoomeye_username ⇒ Object
Returns the value of attribute zoomeye_username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #load_from_env ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
31 32 33 |
# File 'lib/mihari/config.rb', line 31 def initialize load_from_env end |
Instance Attribute Details
#binaryedge_api_key ⇒ Object
Returns the value of attribute binaryedge_api_key.
7 8 9 |
# File 'lib/mihari/config.rb', line 7 def binaryedge_api_key @binaryedge_api_key end |
#censys_id ⇒ Object
Returns the value of attribute censys_id.
8 9 10 |
# File 'lib/mihari/config.rb', line 8 def censys_id @censys_id end |
#censys_secret ⇒ Object
Returns the value of attribute censys_secret.
9 10 11 |
# File 'lib/mihari/config.rb', line 9 def censys_secret @censys_secret end |
#circl_passive_password ⇒ Object
Returns the value of attribute circl_passive_password.
10 11 12 |
# File 'lib/mihari/config.rb', line 10 def circl_passive_password @circl_passive_password end |
#circl_passive_username ⇒ Object
Returns the value of attribute circl_passive_username.
11 12 13 |
# File 'lib/mihari/config.rb', line 11 def circl_passive_username @circl_passive_username end |
#database ⇒ Object
Returns the value of attribute database.
29 30 31 |
# File 'lib/mihari/config.rb', line 29 def database @database end |
#misp_api_endpoint ⇒ Object
Returns the value of attribute misp_api_endpoint.
12 13 14 |
# File 'lib/mihari/config.rb', line 12 def misp_api_endpoint @misp_api_endpoint end |
#misp_api_key ⇒ Object
Returns the value of attribute misp_api_key.
13 14 15 |
# File 'lib/mihari/config.rb', line 13 def misp_api_key @misp_api_key end |
#onyphe_api_key ⇒ Object
Returns the value of attribute onyphe_api_key.
14 15 16 |
# File 'lib/mihari/config.rb', line 14 def onyphe_api_key @onyphe_api_key end |
#otx_api_key ⇒ Object
Returns the value of attribute otx_api_key.
15 16 17 |
# File 'lib/mihari/config.rb', line 15 def otx_api_key @otx_api_key end |
#passivetotal_api_key ⇒ Object
Returns the value of attribute passivetotal_api_key.
16 17 18 |
# File 'lib/mihari/config.rb', line 16 def passivetotal_api_key @passivetotal_api_key end |
#passivetotal_username ⇒ Object
Returns the value of attribute passivetotal_username.
17 18 19 |
# File 'lib/mihari/config.rb', line 17 def passivetotal_username @passivetotal_username end |
#pulsedive_api_key ⇒ Object
Returns the value of attribute pulsedive_api_key.
18 19 20 |
# File 'lib/mihari/config.rb', line 18 def pulsedive_api_key @pulsedive_api_key end |
#securitytrails_api_key ⇒ Object
Returns the value of attribute securitytrails_api_key.
19 20 21 |
# File 'lib/mihari/config.rb', line 19 def securitytrails_api_key @securitytrails_api_key end |
#shodan_api_key ⇒ Object
Returns the value of attribute shodan_api_key.
20 21 22 |
# File 'lib/mihari/config.rb', line 20 def shodan_api_key @shodan_api_key end |
#slack_channel ⇒ Object
Returns the value of attribute slack_channel.
21 22 23 |
# File 'lib/mihari/config.rb', line 21 def slack_channel @slack_channel end |
#slack_webhook_url ⇒ Object
Returns the value of attribute slack_webhook_url.
22 23 24 |
# File 'lib/mihari/config.rb', line 22 def slack_webhook_url @slack_webhook_url end |
#thehive_api_endpoint ⇒ Object
Returns the value of attribute thehive_api_endpoint.
23 24 25 |
# File 'lib/mihari/config.rb', line 23 def thehive_api_endpoint @thehive_api_endpoint end |
#thehive_api_key ⇒ Object
Returns the value of attribute thehive_api_key.
24 25 26 |
# File 'lib/mihari/config.rb', line 24 def thehive_api_key @thehive_api_key end |
#virustotal_api_key ⇒ Object
Returns the value of attribute virustotal_api_key.
25 26 27 |
# File 'lib/mihari/config.rb', line 25 def virustotal_api_key @virustotal_api_key end |
#zoomeye_password ⇒ Object
Returns the value of attribute zoomeye_password.
26 27 28 |
# File 'lib/mihari/config.rb', line 26 def zoomeye_password @zoomeye_password end |
#zoomeye_username ⇒ Object
Returns the value of attribute zoomeye_username.
27 28 29 |
# File 'lib/mihari/config.rb', line 27 def zoomeye_username @zoomeye_username end |
Class Method Details
.load_from_yaml(path) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/mihari/config.rb', line 62 def load_from_yaml(path) raise ArgumentError, "#{path} does not exist." unless File.exist?(path) data = File.read(path) begin yaml = YAML.safe_load(data) rescue TypeError => _e return end Mihari.configure do |config| yaml.each do |key, value| config.send("#{key.downcase}=".to_sym, value) end end end |
Instance Method Details
#load_from_env ⇒ Object
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 |
# File 'lib/mihari/config.rb', line 35 def load_from_env @binaryedge_api_key = ENV["BINARYEDGE_API_KEY"] @censys_id = ENV["CENSYS_ID"] @censys_secret = ENV["CENSYS_SECRET"] @circl_passive_password = ENV["CIRCL_PASSIVE_PASSWORD"] @circl_passive_username = ENV["CIRCL_PASSIVE_USERNAME"] @misp_api_endpoint = ENV["MISP_API_ENDPOINT"] @misp_api_key = ENV["MISP_API_KEY"] @onyphe_api_key = ENV["ONYPHE_API_KEY"] @otx_api_key = ENV["OTX_API_KEY"] @passivetotal_api_key = ENV["PASSIVETOTAL_API_KEY"] @passivetotal_username = ENV["PASSIVETOTAL_USERNAME"] @pulsedive_api_key = ENV["PULSEDIVE_API_KEY"] @securitytrails_api_key = ENV["SECURITYTRAILS_API_KEY"] @shodan_api_key = ENV["SHODAN_API_KEY"] @slack_channel = ENV["SLACK_CHANNEL"] @slack_webhook_url = ENV["SLACK_WEBHOOK_URL"] @thehive_api_endpoint = ENV["THEHIVE_API_ENDPOINT"] @thehive_api_key = ENV["THEHIVE_API_KEY"] @virustotal_api_key = ENV["VIRUSTOTAL_API_KEY"] @zoomeye_password = ENV["ZOOMEYE_PASSWORD"] @zoomeye_username = ENV["ZOOMEYE_USERNAME"] @database = ENV["DATABASE"] || "mihari.db" end |