virustotal_api 0.2.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/CODE_OF_CONDUCT.md +46 -0
- data/.github/CONTRIBUTING.md +7 -0
- data/.github/ISSUE_TEMPLATE.md +15 -0
- data/.github/workflows/ruby.yml +26 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +17 -5
- data/CHANGELOG.md +33 -4
- data/Gemfile +1 -1
- data/README.md +83 -31
- data/Rakefile +3 -2
- data/lib/virustotal_api.rb +7 -6
- data/lib/virustotal_api/analysis.rb +24 -0
- data/lib/virustotal_api/base.rb +37 -10
- data/lib/virustotal_api/domain.rb +24 -0
- data/lib/virustotal_api/exceptions.rb +5 -0
- data/lib/virustotal_api/file.rb +56 -0
- data/lib/virustotal_api/ip.rb +24 -0
- data/lib/virustotal_api/uri.rb +4 -2
- data/lib/virustotal_api/url.rb +46 -0
- data/lib/virustotal_api/version.rb +4 -2
- data/test/analysis_test.rb +23 -0
- data/test/base_test.rb +10 -29
- data/test/domain_test.rb +32 -0
- data/test/exceptions_test.rb +16 -1
- data/test/file_test.rb +68 -0
- data/test/fixtures/analysis.yml +544 -0
- data/test/fixtures/domain.yml +830 -0
- data/test/fixtures/file_analyse.yml +52 -0
- data/test/fixtures/file_find.yml +1236 -0
- data/test/fixtures/file_unauthorized.yml +51 -0
- data/test/fixtures/file_upload.yml +54 -0
- data/test/fixtures/ip.yml +716 -0
- data/test/fixtures/unscanned_url_find.yml +44 -0
- data/test/fixtures/url_analyse.yml +52 -0
- data/test/fixtures/url_find.yml +599 -0
- data/test/{ip_report_test.rb → ip_test.rb} +6 -5
- data/test/test_helper.rb +2 -1
- data/test/uri_test.rb +3 -2
- data/test/url_test.rb +65 -0
- data/test/version_test.rb +3 -3
- data/virustotal_api.gemspec +16 -13
- metadata +108 -77
- data/.travis.yml +0 -15
- data/lib/virustotal_api/domain_report.rb +0 -35
- data/lib/virustotal_api/file_report.rb +0 -36
- data/lib/virustotal_api/file_scan.rb +0 -36
- data/lib/virustotal_api/ip_report.rb +0 -35
- data/lib/virustotal_api/url_report.rb +0 -37
- data/test/domain_report_test.rb +0 -31
- data/test/file_report_test.rb +0 -34
- data/test/file_scan_test.rb +0 -29
- data/test/fixtures/domain_report.yml +0 -311
- data/test/fixtures/ip_report.yml +0 -1323
- data/test/fixtures/report.yml +0 -110
- data/test/fixtures/report_not_found.yml +0 -42
- data/test/fixtures/request_forbidden.yml +0 -38
- data/test/fixtures/scan.yml +0 -49
- data/test/fixtures/url_report.yml +0 -95
- data/test/url_report_test.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: eea5809e6c6dc3ac2e0198339a9e010dca3032b2f7f92df35c1b373a93a222fb
|
4
|
+
data.tar.gz: c2246c22846665db2518b24180973ddfbb813d3e50f60d9104c86120a29ccc96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eac655bf5eb1b214b1799c4e6f1f9bd8476e1dd0e8f77206f1d06e8a1e0fffb30c6a4bb7720fc094760ec54f45fe450c37de5b1555ed1a5e5695ccfe86570e1f
|
7
|
+
data.tar.gz: 9932d3ca7ca249ed1e4b6f2dc16503fd28bf9d750c057ce4eacdb779841992e1455873118850ab0376711384dc6da9bba07188c70b5e3322e81577739d17e787
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
## Our Standards
|
8
|
+
|
9
|
+
Examples of behavior that contributes to creating a positive environment include:
|
10
|
+
|
11
|
+
* Using welcoming and inclusive language
|
12
|
+
* Being respectful of differing viewpoints and experiences
|
13
|
+
* Gracefully accepting constructive criticism
|
14
|
+
* Focusing on what is best for the community
|
15
|
+
* Showing empathy towards other community members
|
16
|
+
|
17
|
+
Examples of unacceptable behavior by participants include:
|
18
|
+
|
19
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
20
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
21
|
+
* Public or private harassment
|
22
|
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
23
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
24
|
+
|
25
|
+
## Our Responsibilities
|
26
|
+
|
27
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
28
|
+
|
29
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
30
|
+
|
31
|
+
## Scope
|
32
|
+
|
33
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
34
|
+
|
35
|
+
## Enforcement
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at git@pwelch.net. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
38
|
+
|
39
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
40
|
+
|
41
|
+
## Attribution
|
42
|
+
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
44
|
+
|
45
|
+
[homepage]: http://contributor-covenant.org
|
46
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
1. Fork it ( https://github.com/pwelch/virustotal_api/fork )
|
4
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
5
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
6
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
7
|
+
5. Create a new Pull Request
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
Test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- name: Set up Ruby
|
16
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
17
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
18
|
+
uses: ruby/setup-ruby@v1.46.0
|
19
|
+
with:
|
20
|
+
ruby-version: 2.5
|
21
|
+
- name: Install dependencies
|
22
|
+
run: bundle install
|
23
|
+
- name: Lint
|
24
|
+
run: bundle exec rake rubocop
|
25
|
+
- name: Run tests
|
26
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,18 +1,16 @@
|
|
1
1
|
# This is the configuration used to check the rubocop source code.
|
2
2
|
|
3
3
|
AllCops:
|
4
|
+
NewCops: enable
|
4
5
|
Exclude:
|
5
6
|
- 'test/fixtures/*'
|
6
7
|
|
7
8
|
Style/StringLiterals:
|
8
9
|
Enabled: true
|
9
10
|
|
10
|
-
Style/
|
11
|
+
Style/RedundantPercentQ:
|
11
12
|
Enabled: true
|
12
13
|
|
13
|
-
Style/HashSyntax:
|
14
|
-
EnforcedStyle: hash_rockets
|
15
|
-
|
16
14
|
# Disabled Checks
|
17
15
|
Style/Documentation:
|
18
16
|
Enabled: false
|
@@ -23,5 +21,19 @@ Style/PercentLiteralDelimiters:
|
|
23
21
|
Style/RegexpLiteral:
|
24
22
|
Enabled: false
|
25
23
|
|
26
|
-
|
24
|
+
Lint/MissingCopEnableDirective:
|
25
|
+
Exclude:
|
26
|
+
- 'test/base_test.rb'
|
27
|
+
|
28
|
+
Naming/MethodParameterName:
|
29
|
+
Exclude:
|
30
|
+
- 'lib/virustotal_api/ip_report.rb'
|
31
|
+
|
32
|
+
Layout/LineLength:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Metrics/MethodLength:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Gemspec/RequiredRubyVersion:
|
27
39
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,39 @@
|
|
1
1
|
# VirusTotal API Changelog
|
2
2
|
|
3
|
-
## 0.
|
3
|
+
## [0.5.1] - 2020-10-06
|
4
4
|
|
5
|
-
*
|
6
|
-
*
|
5
|
+
* Downgrade ruby requirement to 2.5.
|
6
|
+
* [@crondaemon](https://github.com/crondaemon)
|
7
7
|
|
8
|
-
## 0.
|
8
|
+
## [0.5.0] - 2020-09-02
|
9
|
+
|
10
|
+
* Full rework to support API V3.
|
11
|
+
* [@crondaemon](https://github.com/crondaemon) & [@jonnynux](https://github.com/jonnynux)
|
12
|
+
* Move to Ruby 2.6 for minimum Ruby version
|
13
|
+
|
14
|
+
## [0.4.1] - 2019-09-04
|
15
|
+
|
16
|
+
* Fixed Reponse Parsing
|
17
|
+
* [@jonnynux](https://github.com/jonnynux)
|
18
|
+
|
19
|
+
## [0.4.0] - 2019-07-23
|
20
|
+
|
21
|
+
* Added ReScan [#15](https://github.com/pwelch/virustotal_api/pull/15)
|
22
|
+
* Added URL Scan [#16](https://github.com/pwelch/virustotal_api/pull/16)
|
23
|
+
* [@jonnynux](https://github.com/jonnynux)
|
24
|
+
|
25
|
+
## [0.3.0] - 2018-03-31
|
26
|
+
|
27
|
+
* Added optional scan param for url report API [#5](https://github.com/pwelch/virustotal_api/pull/5)
|
28
|
+
* [@mkunkel ](https://github.com/mkunkel)
|
29
|
+
|
30
|
+
## [0.2.0] - 2015-12-19
|
31
|
+
|
32
|
+
* Added Check if the respone is 204 [#2](https://github.com/pwelch/virustotal_api/pull/2)
|
33
|
+
* [@postmodern](https://github.com/postmodern)
|
34
|
+
|
35
|
+
## [0.1.0] - 2014-12-26
|
9
36
|
|
10
37
|
* First Release
|
38
|
+
|
39
|
+
https://keepachangelog.com
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# VirustotalAPI
|
2
2
|
|
3
|
-
Ruby Gem for [VirusTotal](https://www.virustotal.com) [
|
3
|
+
Ruby Gem for [VirusTotal](https://www.virustotal.com) [V3 API](https://developers.virustotal.com/v3.0/reference).
|
4
|
+
If you want the version 2, check out the gem versions up to [0.4.0](https://github.com/crondaemon/virustotal_api/tree/v0.4.0).
|
5
|
+
|
6
|
+
![Ruby](https://github.com/pwelch/virustotal_api/workflows/Ruby/badge.svg)
|
4
7
|
|
5
8
|
[![Gem Version](https://badge.fury.io/rb/virustotal_api.svg)](http://badge.fury.io/rb/virustotal_api)
|
6
|
-
[![Build Status](https://secure.travis-ci.org/pwelch/virustotal_api.svg)](http://travis-ci.org/pwelch/virustotal_api)
|
7
9
|
|
8
10
|
## Installation
|
9
11
|
|
@@ -27,7 +29,7 @@ VirusTotal only allows 4 queries per minute for their Public API. https://www.vi
|
|
27
29
|
|
28
30
|
You will need a Private API Key if you require more queries per minute.
|
29
31
|
|
30
|
-
### File
|
32
|
+
### File Find
|
31
33
|
|
32
34
|
```ruby
|
33
35
|
require 'virustotal_api'
|
@@ -35,7 +37,7 @@ require 'virustotal_api'
|
|
35
37
|
sha256 = '01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b'
|
36
38
|
api_key = 'MY_API_KEY'
|
37
39
|
|
38
|
-
vtreport = VirustotalAPI::
|
40
|
+
vtreport = VirustotalAPI::File.find(sha256, api_key)
|
39
41
|
|
40
42
|
# Does the resource have any results?
|
41
43
|
vtreport.exists?
|
@@ -43,14 +45,19 @@ vtreport.exists?
|
|
43
45
|
|
44
46
|
# URL for File Report (if it exists)
|
45
47
|
vtreport.report_url
|
46
|
-
# => "https://www.virustotal.com/
|
48
|
+
# => "https://www.virustotal.com/api/v3/files/01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b"
|
47
49
|
|
48
50
|
# Report results (if they exist) are available via #report
|
49
|
-
vtreport.report[
|
50
|
-
# => {"
|
51
|
+
vtreport.report['data']['attributes']['last_analysis_results']['ClamAV']
|
52
|
+
# => {"category"=>"undetected", "engine_name"=>"ClamAV", "engine_update"=>"20200826",
|
53
|
+
# "engine_version"=>"0.102.4.0", "method"=>"blacklist", "result"=>nil}
|
54
|
+
|
55
|
+
# Check whether an Antivirus detected this sample or not
|
56
|
+
vtreport.detected_by('ClamAV')
|
57
|
+
# => false
|
51
58
|
```
|
52
59
|
|
53
|
-
### File
|
60
|
+
### File Upload
|
54
61
|
|
55
62
|
```ruby
|
56
63
|
require 'virustotal_api'
|
@@ -58,28 +65,43 @@ require 'virustotal_api'
|
|
58
65
|
file = '/path/to/file'
|
59
66
|
api_key = 'MY_API_KEY'
|
60
67
|
|
61
|
-
vtscan = VirustotalAPI::
|
68
|
+
vtscan = VirustotalAPI::File.upload(file, api_key)
|
62
69
|
|
63
|
-
#
|
64
|
-
vtscan.
|
70
|
+
# Virustotal ID of file
|
71
|
+
vtscan.id
|
65
72
|
# => "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b-1419454668"
|
66
73
|
|
67
74
|
# Response results are available via #response
|
68
|
-
|
75
|
+
vtscan.report
|
76
|
+
# =>
|
77
|
+
{"data"=>
|
78
|
+
{"id"=>"MTkxNDBmMjU4ZGY1OGZiYzZjNmU2ODcyMWNhYjhkZTM6MTU5ODUzMTE5OQ==",
|
79
|
+
"type"=>"analysis"}}
|
80
|
+
```
|
81
|
+
|
82
|
+
### File Analyse
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
require 'virustotal_api'
|
86
|
+
|
87
|
+
sha256 = '01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b'
|
88
|
+
api_key = 'MY_API_KEY'
|
89
|
+
|
90
|
+
vtrescan = VirustotalAPI::File.analyse(sha256, api_key)
|
91
|
+
|
92
|
+
# Virustotal ID of file
|
93
|
+
vtrescan.id
|
94
|
+
# => "MTkxNDBmMjU4ZGY1OGZiYzZjNmU2ODcyMWNhYjhkZTM6MTU5ODUzMTE5OQ=="
|
95
|
+
|
96
|
+
# Response results are available via #response
|
97
|
+
vtrescan.report
|
69
98
|
# =>
|
70
|
-
{
|
71
|
-
"
|
72
|
-
|
73
|
-
"resource"=>"01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
|
74
|
-
"response_code"=>1,
|
75
|
-
"sha256"=>"01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
|
76
|
-
"permalink"=>"https://www.virustotal.com/file/01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b/analysis/1419454668/",
|
77
|
-
"md5"=>"68b329da9893e34099c7d8ad5cb9c940",
|
78
|
-
"verbose_msg"=>"Scan request successfully queued, come back later for the report"
|
79
|
-
}
|
99
|
+
{"data"=>
|
100
|
+
{"id"=>"MTkxNDBmMjU4ZGY1OGZiYzZjNmU2ODcyMWNhYjhkZTM6MTU5ODUzMTE5OQ==",
|
101
|
+
"type"=>"analysis"}}
|
80
102
|
```
|
81
103
|
|
82
|
-
### URL
|
104
|
+
### URL find
|
83
105
|
|
84
106
|
```ruby
|
85
107
|
require 'virustotal_api'
|
@@ -87,7 +109,7 @@ require 'virustotal_api'
|
|
87
109
|
url = 'http://www.google.com'
|
88
110
|
api_key = 'MY_API_KEY'
|
89
111
|
|
90
|
-
vturl_report = VirustotalAPI::
|
112
|
+
vturl_report = VirustotalAPI::URL.find(url, api_key)
|
91
113
|
|
92
114
|
# Does the resource have any results?
|
93
115
|
vturl_report.exists?
|
@@ -95,14 +117,37 @@ vturl_report.exists?
|
|
95
117
|
|
96
118
|
# URL for Report (if it exists)
|
97
119
|
vturl_report.report_url
|
98
|
-
# => "https://www.virustotal.com/
|
120
|
+
# => "https://www.virustotal.com/api/v3/urls/dd014af5ed6b38d9130e3f466f850e46d21b951199d53a18ef29ee9341614eaf/"
|
99
121
|
|
100
122
|
# Report results (if they exist) are available via #report
|
101
|
-
vturl_report.report[
|
102
|
-
# => {"
|
123
|
+
vturl_report.report['data']['attributes']['last_analysis_results']['Avira']
|
124
|
+
# => {"category"=>"harmless", "engine_name"=>"Avira", "method"=>"blacklist", "result"=>"clean"}
|
103
125
|
```
|
104
126
|
|
105
|
-
###
|
127
|
+
### URL Upload
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
require 'virustotal_api'
|
131
|
+
|
132
|
+
url = 'http://www.google.com'
|
133
|
+
api_key = 'MY_API_KEY'
|
134
|
+
|
135
|
+
vturl_scan = VirustotalAPI::URL.upload(url, api_key)
|
136
|
+
|
137
|
+
# Virustotal ID of file
|
138
|
+
vturl_scan.id
|
139
|
+
# => "u-dd014af5ed6b38d9130e3f466f850e46d21b951199d53a18ef29ee9341614eaf-1598531929"
|
140
|
+
|
141
|
+
# Response results are available via #response
|
142
|
+
vturl_scan.report
|
143
|
+
# =>
|
144
|
+
{"data"=>
|
145
|
+
{"id"=>
|
146
|
+
"u-dd014af5ed6b38d9130e3f466f850e46d21b951199d53a18ef29ee9341614eaf-1598531929",
|
147
|
+
"type"=>"analysis"}}
|
148
|
+
```
|
149
|
+
|
150
|
+
### IP Find
|
106
151
|
|
107
152
|
```ruby
|
108
153
|
require 'virustotal_api'
|
@@ -110,7 +155,7 @@ require 'virustotal_api'
|
|
110
155
|
ip = '8.8.8.8'
|
111
156
|
api_key = 'MY_API_KEY'
|
112
157
|
|
113
|
-
vtip_report = VirustotalAPI::
|
158
|
+
vtip_report = VirustotalAPI::IP.find(ip, api_key)
|
114
159
|
|
115
160
|
# Does the resource have any results?
|
116
161
|
vtip_report.exists?
|
@@ -121,7 +166,7 @@ vtip_report.report
|
|
121
166
|
# => Hash of report results
|
122
167
|
```
|
123
168
|
|
124
|
-
### Domain
|
169
|
+
### Domain Find
|
125
170
|
|
126
171
|
```ruby
|
127
172
|
require 'virustotal_api'
|
@@ -129,7 +174,7 @@ require 'virustotal_api'
|
|
129
174
|
domain = 'virustotal.com'
|
130
175
|
api_key = 'MY_API_KEY'
|
131
176
|
|
132
|
-
vtdomain_report = VirustotalAPI::
|
177
|
+
vtdomain_report = VirustotalAPI::Domain.find(domain, api_key)
|
133
178
|
|
134
179
|
# Does the resource have any results?
|
135
180
|
vtdomain_report.exists?
|
@@ -140,6 +185,13 @@ vtdomain_report.report
|
|
140
185
|
# => Hash of report results
|
141
186
|
```
|
142
187
|
|
188
|
+
## Contributors
|
189
|
+
|
190
|
+
- [@postmodern](https://github.com/postmodern)
|
191
|
+
- [@mkunkel](https://github.com/mkunkel)
|
192
|
+
- [@jonnynux](https://github.com/jonnynux)
|
193
|
+
- [@crondaemon](https://github.com/crondaemon/)
|
194
|
+
|
143
195
|
## Contributing
|
144
196
|
|
145
197
|
1. Fork it ( https://github.com/pwelch/virustotal_api/fork )
|
data/Rakefile
CHANGED
data/lib/virustotal_api.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
require 'virustotal_api/
|
4
|
-
require 'virustotal_api/
|
5
|
-
require 'virustotal_api/
|
6
|
-
require 'virustotal_api/
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'virustotal_api/analysis'
|
4
|
+
require 'virustotal_api/domain'
|
5
|
+
require 'virustotal_api/file'
|
6
|
+
require 'virustotal_api/ip'
|
7
|
+
require 'virustotal_api/url'
|
7
8
|
require 'virustotal_api/uri'
|
8
9
|
require 'virustotal_api/version'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
|
5
|
+
module VirustotalAPI
|
6
|
+
# A class for '/analyses' API
|
7
|
+
class Analysis < Base
|
8
|
+
attr_reader :report
|
9
|
+
|
10
|
+
# rubocop:disable Lint/MissingSuper
|
11
|
+
def initialize(report)
|
12
|
+
@report = report
|
13
|
+
end
|
14
|
+
|
15
|
+
# @param [String] id The Virustotal ID to get the report for.
|
16
|
+
# @param [String] api_key The key for virustotal
|
17
|
+
# @return [VirustotalAPI::IP] Report
|
18
|
+
def self.find(id, api_key)
|
19
|
+
report = perform("/analyses/#{id}", api_key)
|
20
|
+
new(report)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
# rubocop:enable Lint/MissingSuper
|