virustotal_api 0.5.3 → 0.5.4
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 +1 -1
- data/CHANGELOG.md +7 -0
- data/lib/virustotal_api/base.rb +2 -2
- data/lib/virustotal_api/version.rb +1 -1
- data/test/base_test.rb +7 -0
- data/test/fixtures/domain_bad_request.yml +52 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bf33b0c496e55c74969e71e323aa64c664a4e7090db4f849601829143ee976a
|
4
|
+
data.tar.gz: 13eed4b64f8923c637e2155c3ece40f9bf55378c3f3a4cc7a321e29f58d8a357
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 168c48232321aecaa6ad6bf5d34d07eb417cbf82f4bcd9a69ed678bb1c28c23a0121a859151662d0e810ea1ca4d8cda2dc50a771d98eaf85f5c98f424b9c4458
|
7
|
+
data.tar.gz: '021498bfce536a34eadc04c7b12766ff605b1f3ae61163be4c88e72aba5e05f2ce4be692aaa601420bdc480327d81e6e5496fd4c293c60f6fdb11f9537d68363'
|
data/.github/workflows/ruby.yml
CHANGED
@@ -15,7 +15,7 @@ jobs:
|
|
15
15
|
- name: Set up Ruby
|
16
16
|
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
17
17
|
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
18
|
-
uses: ruby/setup-ruby@v1
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
19
|
with:
|
20
20
|
ruby-version: 2.5
|
21
21
|
- name: Install dependencies
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# VirusTotal API Changelog
|
2
2
|
|
3
|
+
## [0.5.4] - 2020-12-10
|
4
|
+
* Manage bad requests like not found
|
5
|
+
* Use strict base64 encoding
|
6
|
+
* [@crondaemon](https://github.com/crondaemon)
|
7
|
+
|
8
|
+
## [0.5.3] = 2020-10-12
|
9
|
+
|
3
10
|
## [0.5.2] - 2020-10-06
|
4
11
|
|
5
12
|
* Fix Fix exists? check
|
data/lib/virustotal_api/base.rb
CHANGED
@@ -37,7 +37,7 @@ module VirustotalAPI
|
|
37
37
|
payload: options
|
38
38
|
)
|
39
39
|
JSON.parse(response.body)
|
40
|
-
rescue RestClient::NotFound
|
40
|
+
rescue RestClient::NotFound, RestClient::BadRequest
|
41
41
|
{}
|
42
42
|
rescue RestClient::Unauthorized
|
43
43
|
# Raise a custom exception not to expose the underlying
|
@@ -62,7 +62,7 @@ module VirustotalAPI
|
|
62
62
|
# Generate a URL identifier.
|
63
63
|
# @see https://developers.virustotal.com/v3.0/reference#url
|
64
64
|
def self.url_identifier(url)
|
65
|
-
Base64.
|
65
|
+
Base64.strict_encode64(url).strip.gsub('=', '')
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
data/test/base_test.rb
CHANGED
@@ -4,6 +4,7 @@ require './test/test_helper'
|
|
4
4
|
|
5
5
|
class VirustotalAPIBaseTest < Minitest::Test
|
6
6
|
def setup
|
7
|
+
@domain = 'xpressco.za'
|
7
8
|
@sha256 = '01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b'
|
8
9
|
@api_key = 'testapikey'
|
9
10
|
end
|
@@ -43,5 +44,11 @@ class VirustotalAPIBaseTest < Minitest::Test
|
|
43
44
|
|
44
45
|
assert !virustotal_report.exists?
|
45
46
|
end
|
47
|
+
|
48
|
+
VCR.use_cassette('domain_bad_request') do
|
49
|
+
virustotal_report = VirustotalAPI::Domain.find(@domain, @api_key)
|
50
|
+
|
51
|
+
assert !virustotal_report.exists?
|
52
|
+
end
|
46
53
|
end
|
47
54
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.virustotal.com/api/v3/domains/xpressco.za
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*"
|
12
|
+
User-Agent:
|
13
|
+
- rest-client/2.1.0 (linux-gnu x86_64) ruby/2.5.1p57
|
14
|
+
X-Apikey:
|
15
|
+
- testapikey
|
16
|
+
Content-Length:
|
17
|
+
- '0'
|
18
|
+
Content-Type:
|
19
|
+
- application/x-www-form-urlencoded
|
20
|
+
Accept-Encoding:
|
21
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
22
|
+
Host:
|
23
|
+
- www.virustotal.com
|
24
|
+
response:
|
25
|
+
status:
|
26
|
+
code: 400
|
27
|
+
message: Bad Request
|
28
|
+
headers:
|
29
|
+
Cache-Control:
|
30
|
+
- no-cache
|
31
|
+
Content-Type:
|
32
|
+
- application/json; charset=utf-8
|
33
|
+
X-Cloud-Trace-Context:
|
34
|
+
- f9f5f005efc95b0390a91fb6306201d6
|
35
|
+
Date:
|
36
|
+
- Mon, 28 Dec 2020 13:56:50 GMT
|
37
|
+
Server:
|
38
|
+
- Google Frontend
|
39
|
+
Content-Length:
|
40
|
+
- '138'
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: |-
|
44
|
+
{
|
45
|
+
"error": {
|
46
|
+
"code": "InvalidArgumentError",
|
47
|
+
"message": "Domain \"xpressco.za\" is not a valid domain pattern"
|
48
|
+
}
|
49
|
+
}
|
50
|
+
http_version:
|
51
|
+
recorded_at: Mon, 28 Dec 2020 13:56:50 GMT
|
52
|
+
recorded_with: VCR 5.0.0
|
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.5.
|
4
|
+
version: 0.5.4
|
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: 2021-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -211,6 +211,7 @@ files:
|
|
211
211
|
- test/file_test.rb
|
212
212
|
- test/fixtures/analysis.yml
|
213
213
|
- test/fixtures/domain.yml
|
214
|
+
- test/fixtures/domain_bad_request.yml
|
214
215
|
- test/fixtures/file_analyse.yml
|
215
216
|
- test/fixtures/file_find.yml
|
216
217
|
- test/fixtures/file_not_found.yml
|
@@ -263,6 +264,7 @@ test_files:
|
|
263
264
|
- test/file_test.rb
|
264
265
|
- test/fixtures/analysis.yml
|
265
266
|
- test/fixtures/domain.yml
|
267
|
+
- test/fixtures/domain_bad_request.yml
|
266
268
|
- test/fixtures/file_analyse.yml
|
267
269
|
- test/fixtures/file_find.yml
|
268
270
|
- test/fixtures/file_not_found.yml
|