virustotal_api_compat 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.github/CODE_OF_CONDUCT.md +46 -0
  3. data/.github/CONTRIBUTING.md +7 -0
  4. data/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  6. data/.github/pull_request_template.md +11 -0
  7. data/.github/workflows/ruby.yml +46 -0
  8. data/.gitignore +18 -0
  9. data/.rubocop.yml +39 -0
  10. data/CHANGELOG.md +70 -0
  11. data/Gemfile +5 -0
  12. data/LICENSE.txt +22 -0
  13. data/README.md +253 -0
  14. data/Rakefile +25 -0
  15. data/lib/virustotal_api/analysis.rb +16 -0
  16. data/lib/virustotal_api/base.rb +78 -0
  17. data/lib/virustotal_api/domain.rb +18 -0
  18. data/lib/virustotal_api/exceptions.rb +9 -0
  19. data/lib/virustotal_api/file.rb +67 -0
  20. data/lib/virustotal_api/group.rb +18 -0
  21. data/lib/virustotal_api/ip.rb +18 -0
  22. data/lib/virustotal_api/uri.rb +6 -0
  23. data/lib/virustotal_api/url.rb +38 -0
  24. data/lib/virustotal_api/user.rb +18 -0
  25. data/lib/virustotal_api/version.rb +6 -0
  26. data/lib/virustotal_api.rb +11 -0
  27. data/test/analysis_test.rb +26 -0
  28. data/test/base_test.rb +63 -0
  29. data/test/domain_test.rb +27 -0
  30. data/test/exceptions_test.rb +31 -0
  31. data/test/file_test.rb +73 -0
  32. data/test/fixtures/analysis.yml +544 -0
  33. data/test/fixtures/domain.yml +830 -0
  34. data/test/fixtures/domain_bad_request.yml +52 -0
  35. data/test/fixtures/file_analyse.yml +52 -0
  36. data/test/fixtures/file_find.yml +853 -0
  37. data/test/fixtures/file_not_found.yml +52 -0
  38. data/test/fixtures/file_rate_limit.yml +52 -0
  39. data/test/fixtures/file_unauthorized.yml +51 -0
  40. data/test/fixtures/file_upload.yml +54 -0
  41. data/test/fixtures/group_find.yml +216 -0
  42. data/test/fixtures/ip.yml +716 -0
  43. data/test/fixtures/large_file_upload.yml +99 -0
  44. data/test/fixtures/null_file +1 -0
  45. data/test/fixtures/unscanned_url_find.yml +44 -0
  46. data/test/fixtures/url_analyse.yml +52 -0
  47. data/test/fixtures/url_encoding_find.yml +651 -0
  48. data/test/fixtures/url_find.yml +599 -0
  49. data/test/fixtures/user_find.yml +213 -0
  50. data/test/group_test.rb +27 -0
  51. data/test/ip_test.rb +26 -0
  52. data/test/test_helper.rb +11 -0
  53. data/test/uri_test.rb +10 -0
  54. data/test/url_test.rb +47 -0
  55. data/test/user_test.rb +26 -0
  56. data/test/version_test.rb +9 -0
  57. data/virustotal_api.gemspec +33 -0
  58. metadata +287 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 26974b4f566f04ab3d336ce1259c6f62579ddce0d590371594982fc2b5e1697f
4
+ data.tar.gz: ec88e2eb3da372f3626d287c3472ed2847ae084548fae814561573b9cbe4d717
5
+ SHA512:
6
+ metadata.gz: dd66311620efe41b40febf3d41c2efe995844244584801750bd2e2ceccb8e635f9b46b351fbcc588840bed296036ddf3f2caf89ca7d0b6ca516f18764df4df9a
7
+ data.tar.gz: 452582322d9f5afa696745f02ef588d0bf74eaeaa2db1e8274edd2473c7d521c03bcf1f4337a7c66398770e8822995284bb15715bb387da90518c72f59dea3be
@@ -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,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,11 @@
1
+ CHANGELOG: no-impact/Added/Changed/Deprecated/Removed/Fixed/Security
2
+
3
+ ## Summary
4
+
5
+ ## Testing
6
+
7
+ 1. _Describe how to test this change_
8
+
9
+ ## Other Information
10
+
11
+ _Include screenshots, GIFs, and/or API responses as appropriate._
@@ -0,0 +1,46 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ Test-Ruby-2-7:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Set up Ruby
15
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
16
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
17
+ uses: ruby/setup-ruby@v1.70.1
18
+ with:
19
+ ruby-version: 2.7
20
+ - name: Show Ruby Version
21
+ run: ruby --version
22
+ - name: Install dependencies
23
+ run: bundle install
24
+ - name: Lint
25
+ run: bundle exec rake rubocop
26
+ - name: Run tests
27
+ run: bundle exec rake
28
+
29
+ Test-Ruby-3-0:
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - uses: actions/checkout@v2
33
+ - name: Set up Ruby
34
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
35
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
36
+ uses: ruby/setup-ruby@v1.70.1
37
+ with:
38
+ ruby-version: 3.0
39
+ - name: Show Ruby Version
40
+ run: ruby --version
41
+ - name: Install dependencies
42
+ run: bundle install
43
+ - name: Lint
44
+ run: bundle exec rake rubocop
45
+ - name: Run tests
46
+ run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ .rake_tasks~
16
+ .tool-versions
17
+ *.gem
18
+ .idea
data/.rubocop.yml ADDED
@@ -0,0 +1,39 @@
1
+ # This is the configuration used to check the rubocop source code.
2
+
3
+ AllCops:
4
+ NewCops: enable
5
+ Exclude:
6
+ - 'test/fixtures/*'
7
+
8
+ Style/StringLiterals:
9
+ Enabled: true
10
+
11
+ Style/RedundantPercentQ:
12
+ Enabled: true
13
+
14
+ # Disabled Checks
15
+ Style/Documentation:
16
+ Enabled: false
17
+
18
+ Style/PercentLiteralDelimiters:
19
+ Enabled: false
20
+
21
+ Style/RegexpLiteral:
22
+ Enabled: false
23
+
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:
39
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,70 @@
1
+ # VirusTotal API Changelog
2
+
3
+ ## [0.5.7] - 2021-09-20
4
+
5
+ * Remove EOL Ruby 2.5
6
+
7
+ ## [0.5.6] - 2021-09-20
8
+
9
+ * Use urlsafe base64 encoding
10
+ * Fix changelog
11
+ * [@jonnynux](https://github.com/jonnynux)
12
+
13
+ ## [0.5.5] - 2021-05-10
14
+
15
+ * Add support for larger files
16
+ * [@Grandman](https://github.com/Grandman)
17
+
18
+ ## [0.5.4] - 2020-12-10
19
+
20
+ * Manage bad requests like not found
21
+ * Use strict base64 encoding
22
+ * [@crondaemon](https://github.com/crondaemon)
23
+
24
+ ## [0.5.3] = 2020-10-12
25
+
26
+ ## [0.5.2] - 2020-10-06
27
+
28
+ * Fix Fix exists? check
29
+ * Fix detected_by for File
30
+ * Fix RateLimitError
31
+ * Added User and Group API
32
+ * [@jonnynux](https://github.com/jonnynux)
33
+
34
+ ## [0.5.1] - 2020-10-06
35
+
36
+ * Downgrade ruby requirement to 2.5.
37
+ * [@crondaemon](https://github.com/crondaemon)
38
+
39
+ ## [0.5.0] - 2020-09-02
40
+
41
+ * Full rework to support API V3 [#30](https://github.com/pwelch/virustotal_api/pull/30)
42
+ * [@crondaemon](https://github.com/crondaemon) & [@jonnynux](https://github.com/jonnynux)
43
+ * Move to Ruby 2.6 for minimum Ruby version
44
+
45
+ ## [0.4.1] - 2019-09-04
46
+
47
+ * Fixed Reponse Parsing
48
+ * [@jonnynux](https://github.com/jonnynux)
49
+
50
+ ## [0.4.0] - 2019-07-23
51
+
52
+ * Added ReScan [#15](https://github.com/pwelch/virustotal_api/pull/15)
53
+ * Added URL Scan [#16](https://github.com/pwelch/virustotal_api/pull/16)
54
+ * [@jonnynux](https://github.com/jonnynux)
55
+
56
+ ## [0.3.0] - 2018-03-31
57
+
58
+ * Added optional scan param for url report API [#5](https://github.com/pwelch/virustotal_api/pull/5)
59
+ * [@mkunkel ](https://github.com/mkunkel)
60
+
61
+ ## [0.2.0] - 2015-12-19
62
+
63
+ * Added Check if the respone is 204 [#2](https://github.com/pwelch/virustotal_api/pull/2)
64
+ * [@postmodern](https://github.com/postmodern)
65
+
66
+ ## [0.1.0] - 2014-12-26
67
+
68
+ * First Release
69
+
70
+ https://keepachangelog.com
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 pwelch
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,253 @@
1
+ # VirustotalAPI
2
+
3
+ This is a copy of virustotal_api to be made compatible with logstash dependencies and gemfile. (old json 1.8.6)
4
+
5
+ Ruby Gem for [VirusTotal](https://www.virustotal.com) [V3 API](https://developers.virustotal.com/v3.0/reference).
6
+ 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).
7
+
8
+ ![Ruby](https://github.com/pwelch/virustotal_api/workflows/Ruby/badge.svg)
9
+
10
+ [![Gem Version](https://badge.fury.io/rb/virustotal_api.svg)](http://badge.fury.io/rb/virustotal_api)
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'virustotal_api'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install virustotal_api
27
+
28
+ ## Usage
29
+
30
+ VirusTotal only allows 4 queries per minute for their Public API. https://www.virustotal.com/en/faq/
31
+
32
+ You will need a Private API Key if you require more queries per minute.
33
+
34
+ ### File Find
35
+
36
+ ```ruby
37
+ require 'virustotal_api'
38
+
39
+ sha256 = '01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b'
40
+ api_key = 'MY_API_KEY'
41
+
42
+ vtreport = VirustotalAPI::File.find(sha256, api_key)
43
+
44
+ # Does the resource have any results?
45
+ vtreport.exists?
46
+ # => true
47
+
48
+ # URL for File Report (if it exists)
49
+ vtreport.report_url
50
+ # => "https://www.virustotal.com/api/v3/files/01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b"
51
+
52
+ # Report results (if they exist) are available via #report
53
+ vtreport.report['data']['attributes']['last_analysis_results']['ClamAV']
54
+ # => {"category"=>"undetected", "engine_name"=>"ClamAV", "engine_update"=>"20200826",
55
+ # "engine_version"=>"0.102.4.0", "method"=>"blacklist", "result"=>nil}
56
+
57
+ # Check whether an Antivirus detected this sample or not
58
+ vtreport.detected_by('ClamAV')
59
+ # => false
60
+ ```
61
+
62
+ ### File Upload
63
+
64
+ ```ruby
65
+ require 'virustotal_api'
66
+
67
+ file = '/path/to/file'
68
+ api_key = 'MY_API_KEY'
69
+
70
+ # for upload file
71
+ vtscan = VirustotalAPI::File.upload(file, api_key)
72
+ # or large file (more than 32MB)
73
+ vtscan = VirustotalAPI::File.upload_large(file, api_key)
74
+
75
+ # Virustotal ID of file
76
+ vtscan.id
77
+ # => "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b-1419454668"
78
+
79
+ # Response results are available via #response
80
+ vtscan.report
81
+ # =>
82
+ {"data"=>
83
+ {"id"=>"MTkxNDBmMjU4ZGY1OGZiYzZjNmU2ODcyMWNhYjhkZTM6MTU5ODUzMTE5OQ==",
84
+ "type"=>"analysis"}}
85
+ ```
86
+
87
+ ### File Analyse
88
+
89
+ ```ruby
90
+ require 'virustotal_api'
91
+
92
+ sha256 = '01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b'
93
+ api_key = 'MY_API_KEY'
94
+
95
+ vtrescan = VirustotalAPI::File.analyse(sha256, api_key)
96
+
97
+ # Virustotal ID of file
98
+ vtrescan.id
99
+ # => "MTkxNDBmMjU4ZGY1OGZiYzZjNmU2ODcyMWNhYjhkZTM6MTU5ODUzMTE5OQ=="
100
+
101
+ # Response results are available via #response
102
+ vtrescan.report
103
+ # =>
104
+ {"data"=>
105
+ {"id"=>"MTkxNDBmMjU4ZGY1OGZiYzZjNmU2ODcyMWNhYjhkZTM6MTU5ODUzMTE5OQ==",
106
+ "type"=>"analysis"}}
107
+ ```
108
+
109
+ ### URL find
110
+
111
+ ```ruby
112
+ require 'virustotal_api'
113
+
114
+ url = 'http://www.google.com'
115
+ api_key = 'MY_API_KEY'
116
+
117
+ vturl_report = VirustotalAPI::URL.find(url, api_key)
118
+
119
+ # Does the resource have any results?
120
+ vturl_report.exists?
121
+ # => true
122
+
123
+ # URL for Report (if it exists)
124
+ vturl_report.report_url
125
+ # => "https://www.virustotal.com/api/v3/urls/dd014af5ed6b38d9130e3f466f850e46d21b951199d53a18ef29ee9341614eaf"
126
+
127
+ # Report results (if they exist) are available via #report
128
+ vturl_report.report['data']['attributes']['last_analysis_results']['Avira']
129
+ # => {"category"=>"harmless", "engine_name"=>"Avira", "method"=>"blacklist", "result"=>"clean"}
130
+ ```
131
+
132
+ ### URL Upload
133
+
134
+ ```ruby
135
+ require 'virustotal_api'
136
+
137
+ url = 'http://www.google.com'
138
+ api_key = 'MY_API_KEY'
139
+
140
+ vturl_scan = VirustotalAPI::URL.upload(url, api_key)
141
+
142
+ # Virustotal ID of file
143
+ vturl_scan.id
144
+ # => "u-dd014af5ed6b38d9130e3f466f850e46d21b951199d53a18ef29ee9341614eaf-1598531929"
145
+
146
+ # Response results are available via #response
147
+ vturl_scan.report
148
+ # =>
149
+ {"data"=>
150
+ {"id"=>
151
+ "u-dd014af5ed6b38d9130e3f466f850e46d21b951199d53a18ef29ee9341614eaf-1598531929",
152
+ "type"=>"analysis"}}
153
+ ```
154
+
155
+ ### IP Find
156
+
157
+ ```ruby
158
+ require 'virustotal_api'
159
+
160
+ ip = '8.8.8.8'
161
+ api_key = 'MY_API_KEY'
162
+
163
+ vtip_report = VirustotalAPI::IP.find(ip, api_key)
164
+
165
+ # Does the resource have any results?
166
+ vtip_report.exists?
167
+ # => true
168
+
169
+ # URL for Report (if it exists)
170
+ vtip_report.report_url
171
+ # => "https://www.virustotal.com/api/v3/ip_addresses/8.8.8.8"
172
+
173
+ # Report results (if they exist) are available via #report
174
+ vtip_report.report
175
+ # => Hash of report results
176
+ ```
177
+
178
+ ### Domain Find
179
+
180
+ ```ruby
181
+ require 'virustotal_api'
182
+
183
+ domain = 'virustotal.com'
184
+ api_key = 'MY_API_KEY'
185
+
186
+ vtdomain_report = VirustotalAPI::Domain.find(domain, api_key)
187
+
188
+ # Does the resource have any results?
189
+ vtdomain_report.exists?
190
+ # => true
191
+
192
+ # URL for Report (if it exists)
193
+ vtdomain_report.report_url
194
+ # => "https://www.virustotal.com/api/v3/domains/virustotal.com"
195
+
196
+ # Report results (if they exist) are available via #report
197
+ vtdomain_report.report
198
+ # => Hash of report results
199
+ ```
200
+
201
+ ### User Find
202
+
203
+ ```ruby
204
+ require 'virustotal_api'
205
+
206
+ user_key = 'user_key' # user_id or api_key
207
+ api_key = 'MY_API_KEY'
208
+
209
+ vtuser_report = VirustotalAPI::User.find(user_key, api_key)
210
+
211
+ # Does the resource have any results?
212
+ vtuser_report.exists?
213
+ # => true
214
+
215
+ # Report results (if they exist) are available via #report
216
+ vtuser_report.report
217
+ # => Hash of report results
218
+ ```
219
+
220
+ ### Group Find
221
+
222
+ ```ruby
223
+ require 'virustotal_api'
224
+
225
+ group_id = 'GROUP_id'
226
+ api_key = 'MY_API_KEY'
227
+
228
+ vtgroup_report = VirustotalAPI::Group.find(group_id, api_key)
229
+
230
+ # Does the resource have any results?
231
+ vtgroup_report.exists?
232
+ # => true
233
+
234
+ # Report results (if they exist) are available via #report
235
+ vtgroup_report.report
236
+ # => Hash of report results
237
+ ```
238
+
239
+ ## Contributors
240
+
241
+ - [@jonnynux](https://github.com/jonnynux)
242
+ - [@crondaemon](https://github.com/crondaemon/)
243
+ - [@postmodern](https://github.com/postmodern)
244
+ - [@mkunkel](https://github.com/mkunkel)
245
+ - [@Grandman](https://github.com/Grandman)
246
+
247
+ ## Contributing
248
+
249
+ 1. Fork it ( https://github.com/pwelch/virustotal_api/fork )
250
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
251
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
252
+ 4. Push to the branch (`git push origin my-new-feature`)
253
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+ require 'rubocop/rake_task'
6
+
7
+ Rake::TestTask.new do |t|
8
+ t.libs = ['lib']
9
+ t.warning = true
10
+ t.verbose = true
11
+ t.test_files = FileList['test/*_test.rb']
12
+ end
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ require 'yard'
17
+ YARD::Rake::YardocTask.new
18
+ namespace :yard do
19
+ desc 'Run the YARD server'
20
+ task :start do
21
+ sh 'bundle exec yard server --reload'
22
+ end
23
+ end
24
+
25
+ task default: :test
@@ -0,0 +1,16 @@
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
+ # @param [String] id The Virustotal ID to get the report for.
9
+ # @param [String] api_key The key for virustotal
10
+ # @return [VirustotalAPI::IP] Report
11
+ def self.find(id, api_key)
12
+ report = perform("/analyses/#{id}", api_key)
13
+ new(report)
14
+ end
15
+ end
16
+ end