virustotal_api 0.4.1 → 0.5.0
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 +4 -4
- data/.github/workflows/ruby.yml +26 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +12 -5
- data/CHANGELOG.md +7 -2
- data/README.md +48 -56
- data/lib/virustotal_api.rb +5 -7
- data/lib/virustotal_api/analysis.rb +24 -0
- data/lib/virustotal_api/base.rb +35 -10
- data/lib/virustotal_api/domain.rb +24 -0
- data/lib/virustotal_api/exceptions.rb +3 -0
- data/lib/virustotal_api/file.rb +56 -0
- data/lib/virustotal_api/ip.rb +24 -0
- data/lib/virustotal_api/uri.rb +2 -1
- data/lib/virustotal_api/url.rb +46 -0
- data/lib/virustotal_api/version.rb +2 -1
- data/test/analysis_test.rb +23 -0
- data/test/base_test.rb +8 -28
- data/test/domain_test.rb +32 -0
- data/test/exceptions_test.rb +14 -0
- 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} +4 -4
- data/test/uri_test.rb +1 -1
- data/test/url_test.rb +65 -0
- data/test/version_test.rb +1 -1
- data/virustotal_api.gemspec +10 -8
- metadata +86 -70
- data/.github/workflows/gem_publish.yml +0 -38
- data/lib/virustotal_api/domain_report.rb +0 -36
- data/lib/virustotal_api/file_report.rb +0 -37
- data/lib/virustotal_api/file_rescan.rb +0 -36
- data/lib/virustotal_api/file_scan.rb +0 -38
- data/lib/virustotal_api/ip_report.rb +0 -36
- data/lib/virustotal_api/url_report.rb +0 -41
- data/lib/virustotal_api/url_scan.rb +0 -36
- data/test/domain_report_test.rb +0 -32
- data/test/file_report_test.rb +0 -36
- data/test/file_rescan_test.rb +0 -32
- data/test/file_scan_test.rb +0 -30
- data/test/fixtures/domain_report.yml +0 -311
- data/test/fixtures/ip_report.yml +0 -1323
- data/test/fixtures/queue_unscanned_url_report.yml +0 -46
- 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/rescan.yml +0 -47
- data/test/fixtures/scan.yml +0 -49
- data/test/fixtures/unscanned_url_report.yml +0 -43
- data/test/fixtures/url_report.yml +0 -95
- data/test/fixtures/url_scan.yml +0 -48
- data/test/url_report_test.rb +0 -57
- data/test/url_scan_test.rb +0 -30
data/test/fixtures/url_scan.yml
DELETED
@@ -1,48 +0,0 @@
|
|
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/url_report_test.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require './test/test_helper'
|
4
|
-
|
5
|
-
class VirustotalAPIURLReportTest < Minitest::Test
|
6
|
-
def setup
|
7
|
-
@unscanned_url = 'http://www.unscanned.com'
|
8
|
-
@url = 'http://www.google.com'
|
9
|
-
@api_key = 'testapikey'
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_class_exists
|
13
|
-
assert VirustotalAPI::URLReport
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_report_response
|
17
|
-
VCR.use_cassette('url_report') do
|
18
|
-
vturl_report = VirustotalAPI::URLReport.find(@url, @api_key)
|
19
|
-
|
20
|
-
# Make sure that the JSON was parsed
|
21
|
-
assert vturl_report.is_a?(VirustotalAPI::URLReport)
|
22
|
-
assert vturl_report.report.is_a?(Hash)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_report_url
|
27
|
-
VCR.use_cassette('url_report') do
|
28
|
-
vturl_report = VirustotalAPI::URLReport.find(@url, @api_key)
|
29
|
-
|
30
|
-
assert vturl_report.report_url.is_a?(String)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_scan_url
|
35
|
-
VCR.use_cassette('url_report') do
|
36
|
-
vturl_report = VirustotalAPI::URLReport.find(@url, @api_key)
|
37
|
-
|
38
|
-
assert vturl_report.scan_id.is_a?(String)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_scan_unscanned_url
|
43
|
-
VCR.use_cassette('unscanned_url_report') do
|
44
|
-
vturl_report = VirustotalAPI::URLReport.find(@unscanned_url, @api_key)
|
45
|
-
|
46
|
-
assert vturl_report.report['response_code'].zero?
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_queue_unscanned_url
|
51
|
-
VCR.use_cassette('queue_unscanned_url_report') do
|
52
|
-
vturl_report = VirustotalAPI::URLReport.find(@unscanned_url, @api_key, 1)
|
53
|
-
|
54
|
-
assert vturl_report.report['response_code'] == 1
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
data/test/url_scan_test.rb
DELETED
@@ -1,30 +0,0 @@
|
|
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.report.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
|