Class: Falconz::Client
- Inherits:
-
Object
- Object
- Falconz::Client
- Includes:
- APIs::Feed, APIs::Key, APIs::Report, APIs::Search, APIs::Submission, APIs::System, REST::GET, REST::POST
- Defined in:
- lib/falconz/client.rb
Instance Attribute Summary collapse
-
#header ⇒ Object
Client HTTP header information.
-
#url ⇒ Object
Client HTTP base URL.
Instance Method Summary collapse
- #api_key ⇒ Object
- #api_key=(k) ⇒ Object
- #api_key? ⇒ Boolean
-
#initialize(url: "https://www.hybrid-analysis.com/api/v2", key: ENV["HYBRID_ANALYSIS_API_KEY"]) ⇒ Client
constructor
When initializing a Client, you can optionally specify the base API (v2) URL and the API key to be used for communication.
- #valid_user_agent? ⇒ Boolean
Methods included from APIs::Report
#report_droppedfiles, #report_file, #report_sreenshots, #report_state, #report_summary
Methods included from APIs::Feed
#latest_feed, #latest_feed_count
Methods included from APIs::Submission
#hash_for_url, #submit_dropped_file, #submit_file, #submit_file_by_url, #submit_url
Methods included from APIs::System
#backend, #environment_ids, #environment_linux?, #environment_windows?, #environments, #environments_busy_percentages, #find_environment_by_id, #in_progress, #in_progress_count, #number_of_environments, #number_of_seconds_since_last_update, #system_heartbeat, #system_queue_size, #system_state, #system_version, #total_submissions_in_system
Methods included from APIs::Search
#search_hash, #search_hashes, #search_terms
Methods included from APIs::Key
Methods included from REST::POST
Methods included from REST::GET
Constructor Details
#initialize(url: "https://www.hybrid-analysis.com/api/v2", key: ENV["HYBRID_ANALYSIS_API_KEY"]) ⇒ Client
When initializing a Client, you can optionally specify the base API (v2) URL and the API key to be used for communication. These can both be changed later on.
Note: If not specified, the HYBRID_ANALYSIS_API_KEY environment variable is used.
35 36 37 38 39 40 41 42 |
# File 'lib/falconz/client.rb', line 35 def initialize(url: "https://www.hybrid-analysis.com/api/v2", key: ENV["HYBRID_ANALYSIS_API_KEY"]) @url = url @header = { "User-Agent" => "Falcon Sandbox", "api-key" => key } end |
Instance Attribute Details
#header ⇒ Object
Client HTTP header information.
26 27 28 |
# File 'lib/falconz/client.rb', line 26 def header @header end |
#url ⇒ Object
Client HTTP base URL.
29 30 31 |
# File 'lib/falconz/client.rb', line 29 def url @url end |
Instance Method Details
#api_key ⇒ Object
54 55 56 |
# File 'lib/falconz/client.rb', line 54 def api_key @header["api-key"] end |
#api_key=(k) ⇒ Object
58 59 60 |
# File 'lib/falconz/client.rb', line 58 def api_key=(k) @header["api-key"] = k end |
#api_key? ⇒ Boolean
49 50 51 52 |
# File 'lib/falconz/client.rb', line 49 def api_key? return true if @header["api-key"] false end |
#valid_user_agent? ⇒ Boolean
44 45 46 47 |
# File 'lib/falconz/client.rb', line 44 def valid_user_agent? return true if @header["api-key"] && @header["User-Agent"] == "Falcon Sandbox" false end |