virustotal_api 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +19 -0
- data/.rubocop.yml +0 -3
- data/CHANGELOG.md +6 -0
- data/Gemfile +2 -0
- data/README.md +62 -2
- data/Rakefile +2 -1
- data/lib/virustotal_api.rb +3 -0
- data/lib/virustotal_api/base.rb +2 -0
- data/lib/virustotal_api/domain_report.rb +4 -3
- data/lib/virustotal_api/exceptions.rb +2 -0
- data/lib/virustotal_api/file_report.rb +3 -2
- data/lib/virustotal_api/file_rescan.rb +35 -0
- data/lib/virustotal_api/file_scan.rb +4 -3
- data/lib/virustotal_api/ip_report.rb +4 -3
- data/lib/virustotal_api/uri.rb +2 -1
- data/lib/virustotal_api/url_report.rb +6 -5
- data/lib/virustotal_api/url_scan.rb +35 -0
- data/lib/virustotal_api/version.rb +2 -1
- data/test/base_test.rb +1 -0
- data/test/domain_report_test.rb +1 -0
- data/test/exceptions_test.rb +1 -0
- data/test/file_report_test.rb +2 -0
- data/test/file_rescan_test.rb +32 -0
- data/test/file_scan_test.rb +1 -0
- data/test/fixtures/rescan.yml +47 -0
- data/test/fixtures/url_scan.yml +48 -0
- data/test/ip_report_test.rb +1 -0
- data/test/test_helper.rb +1 -0
- data/test/uri_test.rb +1 -0
- data/test/url_report_test.rb +1 -0
- data/test/url_scan_test.rb +30 -0
- data/test/version_test.rb +1 -0
- data/virustotal_api.gemspec +3 -2
- metadata +20 -11
- data/.travis.yml +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5cb4002cc7336dab43ad9cad54f42f646428c80b80bdd9c21c54d16dfa971a4
|
4
|
+
data.tar.gz: 2e4091e0944e2ae0e4038574964035690e43eaf5aab0f69e26cb51ce1f6d36aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3635ade214ad1a803a85a7169c84eedc085a5793bc3973aebe73e30f9f7b54cb4f6d46b79d66403441f02729f9f74ea52b70e147cdcee4a1181539c8a393a47d
|
7
|
+
data.tar.gz: 27ae5dffc0d0fbbaa379b9dd96daab5a4fe513c406a5234d4d481bcd25016084c2a589e3fa01ad0792d2ee2eda71d9e5884144b9198bb305e5c80f5e6a22c3cf
|
@@ -0,0 +1,19 @@
|
|
1
|
+
version: 2
|
2
|
+
jobs:
|
3
|
+
build:
|
4
|
+
docker:
|
5
|
+
- image: circleci/ruby:2.5.3-stretch
|
6
|
+
steps:
|
7
|
+
- checkout
|
8
|
+
- run:
|
9
|
+
name: Setup
|
10
|
+
command: |
|
11
|
+
gem update bundler
|
12
|
+
bundle install
|
13
|
+
- run:
|
14
|
+
name: Rubocop
|
15
|
+
command: bundle exec rake rubocop
|
16
|
+
- run:
|
17
|
+
name: Run Tests
|
18
|
+
command: bundle exec rake test
|
19
|
+
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# VirusTotal API Changelog
|
2
2
|
|
3
|
+
## 0.4.0
|
4
|
+
|
5
|
+
* Add ReScan [#15](https://github.com/pwelch/virustotal_api/pull/15)
|
6
|
+
* Add URL Scan [#16](https://github.com/pwelch/virustotal_api/pull/16)
|
7
|
+
* [@jonnynux](https://github.com/jonnynux)
|
8
|
+
|
3
9
|
## 0.3.0
|
4
10
|
|
5
11
|
* Add optional scan param for url report API [#5](https://github.com/pwelch/virustotal_api/pull/5)
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Ruby Gem for [VirusTotal](https://www.virustotal.com) [V2 API](https://www.virustotal.com/en/documentation/public-api/)
|
4
4
|
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/virustotal_api.svg)](http://badge.fury.io/rb/virustotal_api)
|
6
|
-
[![
|
6
|
+
[![CircleCI](https://circleci.com/gh/pwelch/virustotal_api.svg?style=svg)](https://circleci.com/gh/pwelch/virustotal_api)
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
@@ -65,7 +65,7 @@ vtscan.scan_id
|
|
65
65
|
# => "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b-1419454668"
|
66
66
|
|
67
67
|
# Response results are available via #response
|
68
|
-
|
68
|
+
vtscan.response
|
69
69
|
# =>
|
70
70
|
{
|
71
71
|
"scan_id"=>"01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b-1419454668",
|
@@ -79,6 +79,32 @@ vtreport.response
|
|
79
79
|
}
|
80
80
|
```
|
81
81
|
|
82
|
+
### File Rescan
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
require 'virustotal_api'
|
86
|
+
|
87
|
+
sha256 = '01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b'
|
88
|
+
api_key = 'MY_API_KEY'
|
89
|
+
|
90
|
+
vtrescan = VirustotalAPI::FileRescan.rescan(sha256, api_key)
|
91
|
+
|
92
|
+
# Rescan ID of file
|
93
|
+
vtrescan.rescan_id
|
94
|
+
# => "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b-1562684247"
|
95
|
+
|
96
|
+
# Response results are available via #response
|
97
|
+
vtrescan.response
|
98
|
+
# =>
|
99
|
+
{
|
100
|
+
"permalink": "https://www.virustotal.com/file/01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b/analysis/1562684247/",
|
101
|
+
"response_code": 1,
|
102
|
+
"sha256": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
|
103
|
+
"resource": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
|
104
|
+
"scan_id": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b-1562684247"
|
105
|
+
}
|
106
|
+
```
|
107
|
+
|
82
108
|
### URL Report
|
83
109
|
|
84
110
|
```ruby
|
@@ -102,6 +128,34 @@ vturl_report.report["scans"]["Opera"]
|
|
102
128
|
# => {"detected"=>false, "result"=>"clean site"}
|
103
129
|
```
|
104
130
|
|
131
|
+
### URL Scan
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
require 'virustotal_api'
|
135
|
+
|
136
|
+
url = 'http://www.google.com'
|
137
|
+
api_key = 'MY_API_KEY'
|
138
|
+
|
139
|
+
vturl_scan = VirustotalAPI::URLScan.scan(url, api_key)
|
140
|
+
|
141
|
+
# Scan ID of file
|
142
|
+
vturl_scan.scan_id
|
143
|
+
# => "dd014af5ed6b38d9130e3f466f850e46d21b951199d53a18ef29ee9341614eaf-1562751553"
|
144
|
+
|
145
|
+
# Response results are available via #response
|
146
|
+
vturl_scan.response
|
147
|
+
# =>
|
148
|
+
{
|
149
|
+
"permalink": "https://www.virustotal.com/url/dd014af5ed6b38d9130e3f466f850e46d21b951199d53a18ef29ee9341614eaf/analysis/1562751553/",
|
150
|
+
"resource": "http://www.google.com/",
|
151
|
+
"url": "http://www.google.com/",
|
152
|
+
"response_code": 1,
|
153
|
+
"scan_date": "2019-07-10 09:39:13",
|
154
|
+
"scan_id": "dd014af5ed6b38d9130e3f466f850e46d21b951199d53a18ef29ee9341614eaf-1562751553",
|
155
|
+
"verbose_msg": "Scan request successfully queued, come back later for the report"
|
156
|
+
}
|
157
|
+
```
|
158
|
+
|
105
159
|
### IP Report
|
106
160
|
|
107
161
|
```ruby
|
@@ -140,6 +194,12 @@ vtdomain_report.report
|
|
140
194
|
# => Hash of report results
|
141
195
|
```
|
142
196
|
|
197
|
+
## Contributors
|
198
|
+
|
199
|
+
- [@postmodern](https://github.com/postmodern)
|
200
|
+
- [@mkunkel](https://github.com/mkunkel)
|
201
|
+
- [@jonnynux](https://github.com/jonnynux)
|
202
|
+
|
143
203
|
## Contributing
|
144
204
|
|
145
205
|
1. Fork it ( https://github.com/pwelch/virustotal_api/fork )
|
data/Rakefile
CHANGED
data/lib/virustotal_api.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
require 'virustotal_api/domain_report'
|
3
4
|
require 'virustotal_api/file_report'
|
5
|
+
require 'virustotal_api/file_rescan'
|
4
6
|
require 'virustotal_api/file_scan'
|
5
7
|
require 'virustotal_api/ip_report'
|
6
8
|
require 'virustotal_api/url_report'
|
9
|
+
require 'virustotal_api/url_scan'
|
7
10
|
require 'virustotal_api/uri'
|
8
11
|
require 'virustotal_api/version'
|
data/lib/virustotal_api/base.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
require_relative 'base'
|
3
4
|
|
@@ -15,7 +16,7 @@ module VirustotalAPI
|
|
15
16
|
def self.find(domain, api_key)
|
16
17
|
response = RestClient.get(
|
17
18
|
api_uri + '/domain/report',
|
18
|
-
{ :
|
19
|
+
{ params: params(domain, api_key) }
|
19
20
|
)
|
20
21
|
report = parse(response)
|
21
22
|
|
@@ -27,8 +28,8 @@ module VirustotalAPI
|
|
27
28
|
# @return [Hash] params for GET Request
|
28
29
|
def self.params(domain, api_key)
|
29
30
|
{
|
30
|
-
:
|
31
|
-
:
|
31
|
+
domain: domain,
|
32
|
+
apikey: api_key
|
32
33
|
}
|
33
34
|
end
|
34
35
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
require_relative 'base'
|
3
4
|
|
@@ -28,8 +29,8 @@ module VirustotalAPI
|
|
28
29
|
# @return [Hash] params for POST Request
|
29
30
|
def self.params(resource, api_key)
|
30
31
|
{
|
31
|
-
:
|
32
|
-
:
|
32
|
+
resource: resource,
|
33
|
+
apikey: api_key
|
33
34
|
}
|
34
35
|
end
|
35
36
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
|
5
|
+
module VirustotalAPI
|
6
|
+
class FileRescan < Base
|
7
|
+
attr_reader :response, :rescan_id
|
8
|
+
|
9
|
+
def initialize(response)
|
10
|
+
@response = JSON.parse(response)
|
11
|
+
@rescan_id = @response.fetch('scan_id') { nil }
|
12
|
+
end
|
13
|
+
|
14
|
+
# @param [String] resource file as a md5/sha1/sha256 hash
|
15
|
+
# @param [String] api_key for virustotal
|
16
|
+
# @return [VirustotalAPI::FileRescan] Reponse
|
17
|
+
def self.rescan(resource, api_key)
|
18
|
+
response = RestClient.post(
|
19
|
+
api_uri + '/file/rescan',
|
20
|
+
apikey: api_key,
|
21
|
+
resource: resource
|
22
|
+
)
|
23
|
+
|
24
|
+
new(response)
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [Boolean] if file was queued
|
28
|
+
# 0 => not_present, 1 => exists, -2 => queued_for_analysis
|
29
|
+
def queued_for_analysis?
|
30
|
+
response_code = report.fetch('response_code') { nil }
|
31
|
+
|
32
|
+
response_code == -2
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
require_relative 'base'
|
3
4
|
|
@@ -17,9 +18,9 @@ module VirustotalAPI
|
|
17
18
|
def self.scan(file_path, api_key, opts = {})
|
18
19
|
response = RestClient.post(
|
19
20
|
api_uri + '/file/scan',
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
21
|
+
apikey: api_key,
|
22
|
+
filename: opts.fetch('filename') { File.basename(file_path) },
|
23
|
+
file: File.open(file_path, 'r')
|
23
24
|
)
|
24
25
|
|
25
26
|
new(response)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
require_relative 'base'
|
3
4
|
|
@@ -15,7 +16,7 @@ module VirustotalAPI
|
|
15
16
|
def self.find(ip, api_key)
|
16
17
|
response = RestClient.get(
|
17
18
|
api_uri + '/ip-address/report',
|
18
|
-
{ :
|
19
|
+
{ params: params(ip, api_key) }
|
19
20
|
)
|
20
21
|
report = parse(response)
|
21
22
|
|
@@ -27,8 +28,8 @@ module VirustotalAPI
|
|
27
28
|
# @return [Hash] params for GET Request
|
28
29
|
def self.params(ip, api_key)
|
29
30
|
{
|
30
|
-
:
|
31
|
-
:
|
31
|
+
ip: ip,
|
32
|
+
apikey: api_key
|
32
33
|
}
|
33
34
|
end
|
34
35
|
end
|
data/lib/virustotal_api/uri.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
require_relative 'base'
|
3
4
|
|
@@ -11,7 +12,7 @@ module VirustotalAPI
|
|
11
12
|
@scan_id = report.fetch('scan_id') { nil }
|
12
13
|
end
|
13
14
|
|
14
|
-
# @param [String] resource
|
15
|
+
# @param [String] resource as an ip/domain/url
|
15
16
|
# @param [String] api_key for virustotal
|
16
17
|
# @param [Integer] optional param to start scan if not found. 1 for true
|
17
18
|
# @return [VirustotalAPI::URLReport] Report Search Result
|
@@ -25,15 +26,15 @@ module VirustotalAPI
|
|
25
26
|
new(report)
|
26
27
|
end
|
27
28
|
|
28
|
-
# @param [String] resource
|
29
|
+
# @param [String] resource as an ip/domain/url
|
29
30
|
# @param [String] api_key for virustotal
|
30
31
|
# @param [Integer] optional param to start scan if not found. 1 for true
|
31
32
|
# @return [Hash] params for POST Request
|
32
33
|
def self.params(resource, api_key, scan = 0)
|
33
34
|
{
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
35
|
+
resource: resource,
|
36
|
+
apikey: api_key,
|
37
|
+
scan: scan.to_s
|
37
38
|
}
|
38
39
|
end
|
39
40
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'base'
|
4
|
+
|
5
|
+
module VirustotalAPI
|
6
|
+
class URLScan < Base
|
7
|
+
attr_reader :response, :scan_id
|
8
|
+
|
9
|
+
def initialize(response)
|
10
|
+
@response = JSON.parse(response)
|
11
|
+
@scan_id = @response.fetch('scan_id') { nil }
|
12
|
+
end
|
13
|
+
|
14
|
+
# @param [String] url
|
15
|
+
# @param [String] api_key for virustotal
|
16
|
+
# @return [VirustotalAPI::URLScan] Reponse
|
17
|
+
def self.scan(url, api_key)
|
18
|
+
response = RestClient.post(
|
19
|
+
api_uri + '/url/scan',
|
20
|
+
apikey: api_key,
|
21
|
+
url: url
|
22
|
+
)
|
23
|
+
|
24
|
+
new(response)
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [Boolean] if file was queued
|
28
|
+
# 0 => not_present, 1 => exists, -2 => queued_for_analysis
|
29
|
+
def queued_for_analysis?
|
30
|
+
response_code = report.fetch('response_code') { nil }
|
31
|
+
|
32
|
+
response_code == -2
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/test/base_test.rb
CHANGED
data/test/domain_report_test.rb
CHANGED
data/test/exceptions_test.rb
CHANGED
data/test/file_report_test.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require './test/test_helper'
|
4
|
+
|
5
|
+
class VirustotalAPIFileRescanTest < Minitest::Test
|
6
|
+
# rubocop:disable LineLength
|
7
|
+
def setup
|
8
|
+
@sha256 = '01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b'
|
9
|
+
@api_key = 'testapikey'
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_class_exists
|
13
|
+
assert VirustotalAPI::FileRescan
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_rescan_response
|
17
|
+
VCR.use_cassette('rescan') do
|
18
|
+
virustotal_rescan = VirustotalAPI::FileRescan.rescan(@sha256, @api_key)
|
19
|
+
|
20
|
+
assert virustotal_rescan.response.is_a?(Hash)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_rescan_id
|
25
|
+
VCR.use_cassette('rescan') do
|
26
|
+
virustotal_rescan = VirustotalAPI::FileRescan.rescan(@sha256, @api_key)
|
27
|
+
|
28
|
+
assert virustotal_rescan.rescan_id.is_a?(String)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
# rubocop:enable LineLength
|
32
|
+
end
|
data/test/file_scan_test.rb
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://www.virustotal.com/vtapi/v2/file/rescan
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: apikey=testapikey&resource=01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- rest-client/2.0.2 (linux-gnu x86_64) ruby/2.5.1p57
|
16
|
+
Content-Length:
|
17
|
+
- '145'
|
18
|
+
Content-Type:
|
19
|
+
- application/x-www-form-urlencoded
|
20
|
+
Host:
|
21
|
+
- www.virustotal.com
|
22
|
+
response:
|
23
|
+
status:
|
24
|
+
code: 200
|
25
|
+
message: OK
|
26
|
+
headers:
|
27
|
+
Cache-Control:
|
28
|
+
- no-cache
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
X-Cloud-Trace-Context:
|
32
|
+
- 642602c25c3eda6df338b27d506a65e3
|
33
|
+
Date:
|
34
|
+
- Tue, 09 Jul 2019 15:04:57 GMT
|
35
|
+
Server:
|
36
|
+
- Google Frontend
|
37
|
+
Content-Length:
|
38
|
+
- '402'
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"permalink": "https://www.virustotal.com/file/01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b/analysis/1562684247/",
|
42
|
+
"response_code": 1, "sha256": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
|
43
|
+
"resource": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
|
44
|
+
"scan_id": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b-1562684247"}'
|
45
|
+
http_version:
|
46
|
+
recorded_at: Tue, 09 Jul 2019 15:04:34 GMT
|
47
|
+
recorded_with: VCR 5.0.0
|
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://www.virustotal.com/vtapi/v2/url/scan
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: apikey=testapikey&url=http%3A%2F%2Fwww.google.com
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- rest-client/2.0.2 (linux-gnu x86_64) ruby/2.5.1p57
|
16
|
+
Content-Length:
|
17
|
+
- '103'
|
18
|
+
Content-Type:
|
19
|
+
- application/x-www-form-urlencoded
|
20
|
+
Host:
|
21
|
+
- www.virustotal.com
|
22
|
+
response:
|
23
|
+
status:
|
24
|
+
code: 200
|
25
|
+
message: OK
|
26
|
+
headers:
|
27
|
+
Cache-Control:
|
28
|
+
- no-cache
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
X-Cloud-Trace-Context:
|
32
|
+
- 3e75d46007d403e053ab2dea60a4aa71
|
33
|
+
Date:
|
34
|
+
- Wed, 10 Jul 2019 09:49:10 GMT
|
35
|
+
Server:
|
36
|
+
- Google Frontend
|
37
|
+
Content-Length:
|
38
|
+
- '433'
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"permalink": "https://www.virustotal.com/url/dd014af5ed6b38d9130e3f466f850e46d21b951199d53a18ef29ee9341614eaf/analysis/1562751553/",
|
42
|
+
"resource": "http://www.google.com/", "url": "http://www.google.com/", "response_code":
|
43
|
+
1, "scan_date": "2019-07-10 09:39:13", "scan_id": "dd014af5ed6b38d9130e3f466f850e46d21b951199d53a18ef29ee9341614eaf-1562751553",
|
44
|
+
"verbose_msg": "Scan request successfully queued, come back later for the
|
45
|
+
report"}'
|
46
|
+
http_version:
|
47
|
+
recorded_at: Wed, 10 Jul 2019 09:48:46 GMT
|
48
|
+
recorded_with: VCR 5.0.0
|
data/test/ip_report_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
data/test/uri_test.rb
CHANGED
data/test/url_report_test.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require './test/test_helper'
|
4
|
+
|
5
|
+
class VirustotalAPIURLScanTest < Minitest::Test
|
6
|
+
def setup
|
7
|
+
@url = 'http://www.google.com'
|
8
|
+
@api_key = 'testapikey'
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_class_exists
|
12
|
+
assert VirustotalAPI::URLScan
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_scan_response
|
16
|
+
VCR.use_cassette('url_scan') do
|
17
|
+
vturl_scan = VirustotalAPI::URLScan.scan(@url, @api_key)
|
18
|
+
|
19
|
+
assert vturl_scan.response.is_a?(Hash)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_scan_url
|
24
|
+
VCR.use_cassette('url_scan') do
|
25
|
+
vturl_scan = VirustotalAPI::URLScan.scan(@url, @api_key)
|
26
|
+
|
27
|
+
assert vturl_scan.scan_id.is_a?(String)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/test/version_test.rb
CHANGED
data/virustotal_api.gemspec
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
@@ -21,11 +22,11 @@ Gem::Specification.new do |spec|
|
|
21
22
|
spec.add_dependency 'json'
|
22
23
|
spec.add_dependency 'rest-client'
|
23
24
|
|
24
|
-
spec.add_development_dependency 'bundler', '~>
|
25
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
25
26
|
spec.add_development_dependency 'minitest'
|
26
27
|
spec.add_development_dependency 'pry'
|
27
28
|
spec.add_development_dependency 'rake', '~> 12.3'
|
28
|
-
spec.add_development_dependency 'rubocop'
|
29
|
+
spec.add_development_dependency 'rubocop', '~> 0.71'
|
29
30
|
spec.add_development_dependency 'vcr'
|
30
31
|
spec.add_development_dependency 'webmock'
|
31
32
|
spec.add_development_dependency 'yard', '~> 0.9'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: virustotal_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pwelch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,16 +98,16 @@ dependencies:
|
|
98
98
|
name: rubocop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
103
|
+
version: '0.71'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
110
|
+
version: '0.71'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: vcr
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,12 +157,12 @@ executables: []
|
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
|
+
- ".circleci/config.yml"
|
160
161
|
- ".github/CODE_OF_CONDUCT.md"
|
161
162
|
- ".github/CONTRIBUTING.md"
|
162
163
|
- ".github/ISSUE_TEMPLATE.md"
|
163
164
|
- ".gitignore"
|
164
165
|
- ".rubocop.yml"
|
165
|
-
- ".travis.yml"
|
166
166
|
- CHANGELOG.md
|
167
167
|
- Gemfile
|
168
168
|
- LICENSE.txt
|
@@ -173,15 +173,18 @@ files:
|
|
173
173
|
- lib/virustotal_api/domain_report.rb
|
174
174
|
- lib/virustotal_api/exceptions.rb
|
175
175
|
- lib/virustotal_api/file_report.rb
|
176
|
+
- lib/virustotal_api/file_rescan.rb
|
176
177
|
- lib/virustotal_api/file_scan.rb
|
177
178
|
- lib/virustotal_api/ip_report.rb
|
178
179
|
- lib/virustotal_api/uri.rb
|
179
180
|
- lib/virustotal_api/url_report.rb
|
181
|
+
- lib/virustotal_api/url_scan.rb
|
180
182
|
- lib/virustotal_api/version.rb
|
181
183
|
- test/base_test.rb
|
182
184
|
- test/domain_report_test.rb
|
183
185
|
- test/exceptions_test.rb
|
184
186
|
- test/file_report_test.rb
|
187
|
+
- test/file_rescan_test.rb
|
185
188
|
- test/file_scan_test.rb
|
186
189
|
- test/fixtures/domain_report.yml
|
187
190
|
- test/fixtures/ip_report.yml
|
@@ -190,13 +193,16 @@ files:
|
|
190
193
|
- test/fixtures/report.yml
|
191
194
|
- test/fixtures/report_not_found.yml
|
192
195
|
- test/fixtures/request_forbidden.yml
|
196
|
+
- test/fixtures/rescan.yml
|
193
197
|
- test/fixtures/scan.yml
|
194
198
|
- test/fixtures/unscanned_url_report.yml
|
195
199
|
- test/fixtures/url_report.yml
|
200
|
+
- test/fixtures/url_scan.yml
|
196
201
|
- test/ip_report_test.rb
|
197
202
|
- test/test_helper.rb
|
198
203
|
- test/uri_test.rb
|
199
204
|
- test/url_report_test.rb
|
205
|
+
- test/url_scan_test.rb
|
200
206
|
- test/version_test.rb
|
201
207
|
- virustotal_api.gemspec
|
202
208
|
homepage: https://github.com/pwelch/virustotal_api
|
@@ -218,8 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
224
|
- !ruby/object:Gem::Version
|
219
225
|
version: '0'
|
220
226
|
requirements: []
|
221
|
-
|
222
|
-
rubygems_version: 2.7.6
|
227
|
+
rubygems_version: 3.0.3
|
223
228
|
signing_key:
|
224
229
|
specification_version: 4
|
225
230
|
summary: Gem for VirusTotal.com API
|
@@ -228,6 +233,7 @@ test_files:
|
|
228
233
|
- test/domain_report_test.rb
|
229
234
|
- test/exceptions_test.rb
|
230
235
|
- test/file_report_test.rb
|
236
|
+
- test/file_rescan_test.rb
|
231
237
|
- test/file_scan_test.rb
|
232
238
|
- test/fixtures/domain_report.yml
|
233
239
|
- test/fixtures/ip_report.yml
|
@@ -236,11 +242,14 @@ test_files:
|
|
236
242
|
- test/fixtures/report.yml
|
237
243
|
- test/fixtures/report_not_found.yml
|
238
244
|
- test/fixtures/request_forbidden.yml
|
245
|
+
- test/fixtures/rescan.yml
|
239
246
|
- test/fixtures/scan.yml
|
240
247
|
- test/fixtures/unscanned_url_report.yml
|
241
248
|
- test/fixtures/url_report.yml
|
249
|
+
- test/fixtures/url_scan.yml
|
242
250
|
- test/ip_report_test.rb
|
243
251
|
- test/test_helper.rb
|
244
252
|
- test/uri_test.rb
|
245
253
|
- test/url_report_test.rb
|
254
|
+
- test/url_scan_test.rb
|
246
255
|
- test/version_test.rb
|
data/.travis.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
sudo: false
|
3
|
-
branches:
|
4
|
-
except:
|
5
|
-
- gh-pages
|
6
|
-
cache: bundler
|
7
|
-
language: ruby
|
8
|
-
rvm:
|
9
|
-
- 2.1
|
10
|
-
before_install: gem update --remote bundler
|
11
|
-
install:
|
12
|
-
- bundle install --retry=3
|
13
|
-
script:
|
14
|
-
- bundle exec rake test
|
15
|
-
- bundle exec rake rubocop
|