falconz 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Gemfile.lock +8 -2
- data/README.md +18 -2
- data/bin/console +4 -4
- data/examples/debug.rb +0 -1
- data/falconz.gemspec +1 -0
- data/lib/falconz/apis/feed.rb +42 -2
- data/lib/falconz/apis/key.rb +3 -2
- data/lib/falconz/apis/report.rb +82 -16
- data/lib/falconz/apis/submission.rb +13 -10
- data/lib/falconz/apis/system.rb +86 -29
- data/lib/falconz/client.rb +2 -0
- data/lib/falconz/rest/get.rb +7 -8
- data/lib/falconz/version.rb +1 -1
- data/lib/falconz.rb +7 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a0e967b3178e27809a9bb0c71c48fef2e6ff1e450f560b43a76ba3fc4caebef0
|
4
|
+
data.tar.gz: 05a4e019d926775d4c305bac4fc714156e5b1eaf68ca14a3edb83b7155256895
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2df07a457057f0a29d43e16d6fe3399014652862bf976d6fab3de337c010a634b571c44e27f4bafa282159ee7e4a98ee7d16143eb20522a1bb8a97114eb2c98a
|
7
|
+
data.tar.gz: e1f11b5808000e438b3cc1e403e12bee9fba06c122ce4cd66d22969a15c72cb1bc640d8d8937256c0fb477a0638224dcbed9638536a5e8f49f796ba37fed42c4
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
falconz (1.0.
|
4
|
+
falconz (1.0.1)
|
5
5
|
httparty (~> 0.16.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
coderay (1.1.2)
|
10
11
|
diff-lcs (1.3)
|
11
12
|
httparty (0.16.2)
|
12
13
|
multi_xml (>= 0.5.2)
|
14
|
+
method_source (0.9.0)
|
13
15
|
multi_xml (0.6.0)
|
16
|
+
pry (0.11.3)
|
17
|
+
coderay (~> 1.1.0)
|
18
|
+
method_source (~> 0.9.0)
|
14
19
|
rake (10.5.0)
|
15
20
|
rspec (3.7.0)
|
16
21
|
rspec-core (~> 3.7.0)
|
@@ -32,8 +37,9 @@ PLATFORMS
|
|
32
37
|
DEPENDENCIES
|
33
38
|
bundler (~> 1.16)
|
34
39
|
falconz!
|
40
|
+
pry
|
35
41
|
rake (~> 10.0)
|
36
42
|
rspec (~> 3.0)
|
37
43
|
|
38
44
|
BUNDLED WITH
|
39
|
-
1.16.
|
45
|
+
1.16.1
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
<img alt="i like birds" src="falcon.jpg"/>
|
6
6
|
<p>
|
7
7
|
|
8
|
-
Falcon Sandbox has a powerful and simple API that can be used to submit files/URLs for analysis, pull report data, but also perform advanced search queries. The API is open and free to the entire IT-security community.
|
8
|
+
[Falcon Sandbox](https://www.hybrid-analysis.com/docs/api/v2) has a powerful and simple API that can be used to submit files/URLs for analysis, pull report data, but also perform advanced search queries. The API is open and free to the entire IT-security community.
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
@@ -13,7 +13,7 @@ Falcon Sandbox has a powerful and simple API that can be used to submit files/UR
|
|
13
13
|
|
14
14
|
## Usage
|
15
15
|
|
16
|
-
Currently requires the `HYBRID_ANALYSIS_API_KEY`
|
16
|
+
Currently requires the `HYBRID_ANALYSIS_API_KEY` environment variable set to communicate with the API.
|
17
17
|
|
18
18
|
```ruby
|
19
19
|
require "falconz"
|
@@ -21,6 +21,16 @@ require "falconz"
|
|
21
21
|
client = Falconz.client.new
|
22
22
|
```
|
23
23
|
|
24
|
+
Get the current file hashes that are being processed along with their environment IDs.
|
25
|
+
```ruby
|
26
|
+
client.in_progress
|
27
|
+
# => [{:hash=>"b8560ce1bacb5515fdaef7cb3615a8172663da749b038687ab4a439cbf64f23b", :environment=>"100"},
|
28
|
+
# {:hash=>"4f456ae8d592a73be8e898384a6b78cf1406965bcb2cea38ffa976c1084acb74", :environment=>"120"},
|
29
|
+
# {:hash=>"6e206c74d4b9796264e5e2cb351e563806320e8d6d794fba38d3be93aa4b1bb5", :environment=>"100"},
|
30
|
+
# {:hash=>"8d5bd56a19d06d46c8e92552f0bf81fa38cbf3365ab022e97075810be18000d9", :environment=>"120"},
|
31
|
+
# {:hash=>"497f631d332b6b242528409778ecb7a778b1b50d6964139b549fdd71410381bc", :environment=>"120"}]
|
32
|
+
```
|
33
|
+
|
24
34
|
Upload a local file to the sandbox.
|
25
35
|
```ruby
|
26
36
|
client.submit_file(file: "malware.exe", environment_id: 100)
|
@@ -47,6 +57,12 @@ client.number_of_environments
|
|
47
57
|
# => 5
|
48
58
|
```
|
49
59
|
|
60
|
+
Get the available environments ID numbers.
|
61
|
+
```ruby
|
62
|
+
client.environment_ids
|
63
|
+
# => [100, 110, 120, 300, 200]
|
64
|
+
```
|
65
|
+
|
50
66
|
Get information about current API key being used.
|
51
67
|
```ruby
|
52
68
|
client.current_key
|
data/bin/console
CHANGED
@@ -7,8 +7,8 @@ require "falconz"
|
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
|
11
|
-
|
10
|
+
require "pry"
|
11
|
+
Pry.start
|
12
12
|
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
13
|
+
#require "irb"
|
14
|
+
#IRB.start(__FILE__)
|
data/examples/debug.rb
CHANGED
data/falconz.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.add_dependency "httparty", "~> 0.16.2"
|
25
25
|
|
26
|
+
spec.add_development_dependency "pry"
|
26
27
|
spec.add_development_dependency "bundler", "~> 1.16"
|
27
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
28
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
data/lib/falconz/apis/feed.rb
CHANGED
@@ -1,9 +1,49 @@
|
|
1
1
|
module Falconz
|
2
2
|
module APIs
|
3
|
+
# A module consisting of the method associted with the
|
4
|
+
# Feed section of the API.
|
5
|
+
#
|
6
|
+
# @author Kent 'picat' Gruber
|
3
7
|
module Feed
|
4
8
|
# access a feed of last 250 reports over 24h
|
5
|
-
|
6
|
-
|
9
|
+
#
|
10
|
+
# == Example
|
11
|
+
# client = Falconz.client.new
|
12
|
+
#
|
13
|
+
# client.latest_feed do |data|
|
14
|
+
# # do something with the data
|
15
|
+
# puts data.to_json
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/Feed/get_feed_latest
|
19
|
+
def latest_feed
|
20
|
+
# return response unless block was given ( like the in-line example )
|
21
|
+
return get_request('/feed/latest') unless block_given?
|
22
|
+
# capture response
|
23
|
+
response = get_request('/feed/latest')
|
24
|
+
# raise error (built out of the response) unless everything is ok
|
25
|
+
raise "response not ok: #{response}" unless Falconz.response_is_ok?(response)
|
26
|
+
# raise error unless there is any data
|
27
|
+
raise "no data to iterate through in response #{response}" unless response['data'] or !response['data'].zero?
|
28
|
+
response['data'].each do |data|
|
29
|
+
yield data
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# A little wrapper method to #latest_feed that returns the count
|
34
|
+
# of the ammount of data found in the feed.
|
35
|
+
#
|
36
|
+
# @return [void]
|
37
|
+
# @see #latest_feed
|
38
|
+
def latest_feed_count
|
39
|
+
# capture response
|
40
|
+
response = latest_feed
|
41
|
+
# raise error (built out of the response) unless everything is ok
|
42
|
+
raise response unless Falconz.response_is_ok?(response)
|
43
|
+
# raise error unless there is any count in the response
|
44
|
+
raise "no count found in response #{response}" unless response['count']
|
45
|
+
# return the count
|
46
|
+
response["count"]
|
7
47
|
end
|
8
48
|
end
|
9
49
|
end
|
data/lib/falconz/apis/key.rb
CHANGED
@@ -2,8 +2,9 @@ module Falconz
|
|
2
2
|
module APIs
|
3
3
|
module Key
|
4
4
|
# return information about the used API key
|
5
|
-
|
6
|
-
|
5
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/Key/get_key_current
|
6
|
+
def current_key
|
7
|
+
get_request("/key/current")
|
7
8
|
end
|
8
9
|
end
|
9
10
|
end
|
data/lib/falconz/apis/report.rb
CHANGED
@@ -1,30 +1,96 @@
|
|
1
1
|
module Falconz
|
2
2
|
module APIs
|
3
3
|
module Report
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
# return state of a submission
|
5
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/Report/get_report__id__state
|
6
|
+
def report_state(id)
|
7
|
+
raise_if_id_is_not_valid(id)
|
8
|
+
get_request("/report/#{id}/hash")
|
7
9
|
end
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
11
|
+
# return summary of a submission
|
12
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/Report/get_report__id__summary
|
13
|
+
def report_summary(id)
|
14
|
+
raise_if_id_is_not_valid(id)
|
15
|
+
get_request("/report/#{id}/hash")
|
12
16
|
end
|
13
17
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
+
# return summary of multiple submissions (bulk query)
|
19
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/Report/post_report_summary
|
20
|
+
def report_summary(**options)
|
21
|
+
post_request("/report/summary", options)
|
18
22
|
end
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
24
|
+
# downloading report data (e.g. JSON, XML, PCAP)
|
25
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/Report/get_report__id__file__type_
|
26
|
+
def report_file(id, type)
|
27
|
+
raise_if_id_is_not_valid(id)
|
28
|
+
raise_if_report_file_type_is_not_valid(type)
|
29
|
+
get_request("/report/#{id}/file/#{type}")
|
23
30
|
end
|
24
31
|
|
25
|
-
|
26
|
-
|
27
|
-
|
32
|
+
# retrieve an array of screenshots from a report in the Base64 format
|
33
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/Report/get_report__id__screenshots
|
34
|
+
def report_sreenshots(id)
|
35
|
+
raise_if_id_is_not_valid(id)
|
36
|
+
get_request("/report/#{id}/screenshots")
|
37
|
+
end
|
38
|
+
|
39
|
+
# retrieve all extracted/dropped binaries files for a report, as zip
|
40
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/Report/get_report__id__dropped_files
|
41
|
+
def report_droppedfiles(id)
|
42
|
+
raise_if_id_is_not_valid(id)
|
43
|
+
get_request("/report/#{id}/dropped-files")
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
# raise an error if the given ID isn't (probably) valid
|
49
|
+
def raise_if_id_is_not_valid(id)
|
50
|
+
unless id_is_in_probably_valid_format?(id)
|
51
|
+
raise "need if in format: ‘jobId’ or ‘sha256:environmentId’"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# check if a given ID is probably valid or not
|
56
|
+
# @see #report_file
|
57
|
+
def id_is_in_probably_valid_format?(id)
|
58
|
+
return false if id.nil?
|
59
|
+
return false unless id.is_a? String
|
60
|
+
return true
|
61
|
+
end
|
62
|
+
|
63
|
+
# valid report file types for #report_file
|
64
|
+
# @see #report_file
|
65
|
+
VALID_REPORT_FILE_TYPES = {
|
66
|
+
"xml": "The XML report as application/xml content and *.gz compressed.",
|
67
|
+
"json": "The JSON report as application/json content",
|
68
|
+
"html": "The HTML report as text/html content and *.gz compressed",
|
69
|
+
"pdf": "The PDF report as application/pdf content",
|
70
|
+
"maec": "The MAEC (4.1) report as application/xml content",
|
71
|
+
"stix": "The STIX report as application/xml content",
|
72
|
+
"misp": "The MISP XML report as application/xml content",
|
73
|
+
"misp-json": "The MISP JSON report as application/json content",
|
74
|
+
"openioc": "The OpenIOC (1.1) report as application/xml content",
|
75
|
+
"bin": "The binary sample as application/octet-stream and *.gz compressed. Note: if the file was uploaded with ‘no_share_vt’ (i.e. not shared), this might fail.",
|
76
|
+
"crt": "The binary sample certificate file (is available) as application/octet-stream content",
|
77
|
+
"memory": "The process memory dump files as application/octet-stream and zip compressed.",
|
78
|
+
"pcap": "The PCAP network traffic capture file as application/octet-stream and *.gz compressed."
|
79
|
+
}
|
80
|
+
|
81
|
+
# check if a report file type argument is valid
|
82
|
+
# @see #report_file
|
83
|
+
def report_file_type_is_valid?(type)
|
84
|
+
return true if VALID_REPORT_FILE_TYPES.keys.include? type.to_s.downcase
|
85
|
+
false
|
86
|
+
end
|
87
|
+
|
88
|
+
# raise an error if the report file type argument isn't valid
|
89
|
+
# @see #report_file
|
90
|
+
def raise_if_report_file_type_is_not_valid(type)
|
91
|
+
unless report_file_type_is_valid?(id)
|
92
|
+
raise "Type requires https://www.reverse.it/docs/api/v2#/Report/get_report__id__file__type:\n#{VALID_REPORT_FILE_TYPES}"
|
93
|
+
end
|
28
94
|
end
|
29
95
|
end
|
30
96
|
end
|
@@ -2,6 +2,7 @@ module Falconz
|
|
2
2
|
module APIs
|
3
3
|
module Submission
|
4
4
|
# submit a local file for analysis
|
5
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/Submission/post_submit_file
|
5
6
|
def submit_file(**options)
|
6
7
|
options[:file] = File.open(options[:file], "r")
|
7
8
|
response = post_request("/submit/file", options)
|
@@ -10,27 +11,29 @@ module Falconz
|
|
10
11
|
end
|
11
12
|
|
12
13
|
# submit a file by url for analysis
|
14
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/Submission/post_submit_url_to_file
|
13
15
|
def submit_file_by_url(**options)
|
14
16
|
post_request("/submit/url-to-file", options)
|
15
17
|
end
|
16
18
|
|
17
|
-
# submit a url for analysis
|
19
|
+
# submit a url for analysis
|
20
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/Submission/post_submit_url_for_analysis
|
18
21
|
def submit_url(**options)
|
19
22
|
post_request("/submit/url-for-analysis", options)
|
20
23
|
end
|
24
|
+
|
25
|
+
# determine a SHA256 that an online file or URL submission will
|
26
|
+
# have when being processed by the system. Note: this is useful when looking up URL analysis
|
27
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/Submission/post_submit_hash_for_url
|
28
|
+
def hash_for_url(url)
|
29
|
+
post_request("/submit/hash-for-url", url: url)
|
30
|
+
end
|
21
31
|
|
22
|
-
# submit dropped file for analysis
|
32
|
+
# submit dropped file for analysis
|
33
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/Submission/post_submit_dropped_file
|
23
34
|
def submit_dropped_file(**options)
|
24
35
|
post_request("/submit/dropped-file", options)
|
25
36
|
end
|
26
|
-
|
27
|
-
# determine a SHA256 that an online file or URL
|
28
|
-
# submission will have when being processed by
|
29
|
-
# the system. Note: this is useful when looking
|
30
|
-
# up URL analysis
|
31
|
-
def hash_from_url(**options)
|
32
|
-
post_request("/submit/hash-for-url", options)
|
33
|
-
end
|
34
37
|
end
|
35
38
|
end
|
36
39
|
end
|
data/lib/falconz/apis/system.rb
CHANGED
@@ -1,45 +1,83 @@
|
|
1
1
|
module Falconz
|
2
2
|
module APIs
|
3
3
|
module System
|
4
|
-
|
5
|
-
|
4
|
+
# return heartbeat
|
5
|
+
#
|
6
|
+
# == Example
|
7
|
+
# client = Falconz.client.new
|
8
|
+
#
|
9
|
+
# client.system_heartbeat do |response|
|
10
|
+
# # do something with the response
|
11
|
+
# puts response.to_json
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
# == Example without Block Syntax
|
15
|
+
# client = Falconz.client.new
|
16
|
+
#
|
17
|
+
# response = client.system_heartbeat
|
18
|
+
#
|
19
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/System/get_system_heartbeat
|
20
|
+
def system_heartbeat(wait = 15)
|
21
|
+
return get_request("/system/heartbeat") unless block_given?
|
6
22
|
while true
|
7
|
-
yield get_request("/system/heartbeat"
|
23
|
+
yield get_request("/system/heartbeat")
|
8
24
|
sleep wait
|
9
25
|
end
|
10
26
|
end
|
11
27
|
|
28
|
+
# check the number of seconds since last update
|
29
|
+
# @see #system_heartbeat
|
12
30
|
def number_of_seconds_since_last_update
|
13
31
|
system_heartbeat["number_of_seconds_since_last_update"]
|
14
32
|
end
|
15
33
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
34
|
+
# check the total submissions in the system
|
35
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/System/get_system_total_submissions
|
36
|
+
def total_submissions_in_system
|
37
|
+
get_request("/system/total-submissions")["value"]
|
38
|
+
end
|
39
|
+
|
40
|
+
# get the in progress jobs
|
41
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/System/get_system_in_progress
|
42
|
+
def in_progress
|
43
|
+
jobs = get_request("/system/in-progress")["values"].map do |job|
|
44
|
+
kv = {}
|
45
|
+
kv[:hash], kv[:environment] = job.split(":")
|
46
|
+
kv
|
47
|
+
end
|
48
|
+
return jobs unless block_given?
|
49
|
+
jobs.each do |job|
|
50
|
+
yield job
|
25
51
|
end
|
26
52
|
end
|
27
|
-
|
28
|
-
|
29
|
-
|
53
|
+
|
54
|
+
# number of jobs currently being processed
|
55
|
+
# @see #in_progress
|
56
|
+
def in_progress_count
|
57
|
+
get_request("/system/in-progress")["values"].count
|
58
|
+
end
|
59
|
+
|
60
|
+
# return information about configured backend nodes
|
61
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/System/get_system_backend
|
62
|
+
def backend
|
63
|
+
get_request("/system/backend")
|
30
64
|
end
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
65
|
+
|
66
|
+
# return information about available execution environments
|
67
|
+
# https://www.hybrid-analysis.com/docs/api/v2#/System/get_system_environments
|
68
|
+
def environments
|
69
|
+
return get_request("/system/environments") unless block_given?
|
70
|
+
get_request("/system/environments").each do |environment|
|
71
|
+
yield environment
|
36
72
|
end
|
37
73
|
end
|
38
74
|
|
75
|
+
# return the number of environments in the system
|
39
76
|
def number_of_environments
|
40
77
|
environments.count
|
41
78
|
end
|
42
79
|
|
80
|
+
# find an environment by an ID
|
43
81
|
def find_environment_by_id(id)
|
44
82
|
id = id.to_i
|
45
83
|
environments do |env|
|
@@ -47,7 +85,17 @@ module Falconz
|
|
47
85
|
end
|
48
86
|
end
|
49
87
|
|
50
|
-
|
88
|
+
# list available environment IDs
|
89
|
+
def environment_ids(refresh: false)
|
90
|
+
if refresh or @environment_ids.nil?
|
91
|
+
@environment_ids = environments.map { |env| env["id"] }
|
92
|
+
end
|
93
|
+
return @environment_ids unless block_given?
|
94
|
+
@environment_ids.each { |env| yield id }
|
95
|
+
end
|
96
|
+
|
97
|
+
# return environments
|
98
|
+
def environments_busy_percentages
|
51
99
|
envs = {}
|
52
100
|
environments do |env|
|
53
101
|
if env["busy_virtual_machines"] == 0 || env["total_virtual_machines"] == 0
|
@@ -62,13 +110,15 @@ module Falconz
|
|
62
110
|
end
|
63
111
|
end
|
64
112
|
|
113
|
+
# check if a given environment ID is a windows system
|
65
114
|
def environment_windows?(id)
|
66
115
|
env = find_environment_by_id(id)
|
67
116
|
return nil if env.nil?
|
68
117
|
return true if env["architecture"] == "WINDOWS"
|
69
118
|
false
|
70
119
|
end
|
71
|
-
|
120
|
+
|
121
|
+
# check if a given environment ID is a linux system
|
72
122
|
def environment_linux?(id)
|
73
123
|
env = find_environment_by_id(id)
|
74
124
|
return nil if env.nil?
|
@@ -76,16 +126,23 @@ module Falconz
|
|
76
126
|
false
|
77
127
|
end
|
78
128
|
|
79
|
-
|
80
|
-
|
129
|
+
# a full system state query, including all available
|
130
|
+
# action scripts, environments, files in progress, etc.
|
131
|
+
# https://www.reverse.it/docs/api/v2#/System/get_system_state
|
132
|
+
def system_state
|
133
|
+
get_request("/system/state")
|
81
134
|
end
|
82
135
|
|
83
|
-
|
84
|
-
|
136
|
+
# return information about the instance version
|
137
|
+
# https://www.reverse.it/docs/api/v2#/System/get_system_version
|
138
|
+
def system_version
|
139
|
+
get_request("/system/version")
|
85
140
|
end
|
86
|
-
|
87
|
-
|
88
|
-
|
141
|
+
|
142
|
+
# return information about queue size
|
143
|
+
# https://www.reverse.it/docs/api/v2#/System/get_system_queue_size
|
144
|
+
def queue_size
|
145
|
+
get_request("/system/queue-size")["value"]
|
89
146
|
end
|
90
147
|
end
|
91
148
|
end
|
data/lib/falconz/client.rb
CHANGED
@@ -5,6 +5,7 @@ require_relative "apis/key.rb"
|
|
5
5
|
require_relative "apis/system.rb"
|
6
6
|
require_relative "apis/submission.rb"
|
7
7
|
require_relative "apis/feed.rb"
|
8
|
+
require_relative "apis/report.rb"
|
8
9
|
|
9
10
|
module Falconz
|
10
11
|
class Client
|
@@ -15,6 +16,7 @@ module Falconz
|
|
15
16
|
include APIs::System
|
16
17
|
include APIs::Submission
|
17
18
|
include APIs::Feed
|
19
|
+
include APIs::Report
|
18
20
|
|
19
21
|
def initialize
|
20
22
|
@url = "https://www.hybrid-analysis.com/api/v2"
|
data/lib/falconz/rest/get.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
module Falconz
|
2
2
|
module REST
|
3
|
+
# HTTP 1.1 GET request method to make on the API endpoint.
|
4
|
+
#
|
5
|
+
# This is a module that is used in pretty much all the API
|
6
|
+
# modules in order to talk to the API endpoint.
|
3
7
|
module GET
|
4
|
-
def get_request(path
|
8
|
+
def get_request(path)
|
5
9
|
response = HTTParty.get(url + path, headers: header)
|
6
|
-
if response.success?
|
7
|
-
|
8
|
-
return response
|
9
|
-
else
|
10
|
-
binding.pry
|
11
|
-
raise response.to_h
|
12
|
-
end
|
10
|
+
return response if response.success?
|
11
|
+
raise response
|
13
12
|
end
|
14
13
|
end
|
15
14
|
end
|
data/lib/falconz/version.rb
CHANGED
data/lib/falconz.rb
CHANGED
@@ -11,4 +11,11 @@ module Falconz
|
|
11
11
|
def self.client
|
12
12
|
Client
|
13
13
|
end
|
14
|
+
|
15
|
+
def self.response_is_ok?(resp)
|
16
|
+
return false unless resp.respond_to?(:has_key?)
|
17
|
+
return false unless resp.has_key? "status"
|
18
|
+
return true if resp["status"].match?("ok")
|
19
|
+
return false
|
20
|
+
end
|
14
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: falconz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kent 'picat' Gruber
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.16.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
133
|
version: '0'
|
120
134
|
requirements: []
|
121
135
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.6
|
136
|
+
rubygems_version: 2.7.6
|
123
137
|
signing_key:
|
124
138
|
specification_version: 4
|
125
139
|
summary: Falcon Malware Sandbox APIv2 Connector
|