metascan 0.1.0 → 0.1.1
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/lib/scan.rb +7 -3
- data/metascan.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e7ce42d8d9d26760f48a2156c5e62cbbbe922bf
|
4
|
+
data.tar.gz: c696294c89fe68d24c77fd469478802e15a0dbd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76f78211a4fdb26981a2869bdb1ff3d3d37236d55ab5545a953b01afd210b149f7218d15b16d5465e3a1dd0cb4e049e61e0ffb7359fdd3648d28b8411ef8e2a7
|
7
|
+
data.tar.gz: 1fb2f6ed91db69ecc86e2cd211420527035a95acebc4f116142ea109d52a8c05ab8c22b33d25a015cb8fac0c2db1b0b4ce7743547c755bd557c35f655f7b8c26
|
data/lib/scan.rb
CHANGED
@@ -37,15 +37,19 @@ module Metascan
|
|
37
37
|
|
38
38
|
request.on_complete do |r|
|
39
39
|
@data_id = JSON.parse(r.body)["data_id"]
|
40
|
+
@rest_ip = JSON.parse(r.body)["rest_ip"].split(":")[0] + '/v2/file'
|
40
41
|
end
|
41
|
-
|
42
42
|
request
|
43
43
|
end
|
44
44
|
|
45
45
|
# Returns true iff the Metascan virus scan found no threats.
|
46
46
|
# If POLL is true (false by default) then retrieve_results first.
|
47
47
|
def clean?(poll: false)
|
48
|
-
self.results(poll: poll)["scan_results"]["
|
48
|
+
if self.results(poll: poll)["scan_results"]["progress_percentage"] < 100 then
|
49
|
+
nil
|
50
|
+
else
|
51
|
+
self.results(poll: poll)["scan_results"]["scan_all_result_i"] == 0
|
52
|
+
end
|
49
53
|
end
|
50
54
|
|
51
55
|
# Only useful for testing.
|
@@ -69,7 +73,7 @@ module Metascan
|
|
69
73
|
# my Batch runs me)
|
70
74
|
def retrieve_results
|
71
75
|
request = Typhoeus::Request.new(
|
72
|
-
|
76
|
+
@rest_ip + '/' + @data_id,
|
73
77
|
headers: {
|
74
78
|
'apikey' => @client.api_key
|
75
79
|
},
|
data/metascan.rb
CHANGED
@@ -5,9 +5,9 @@ module Metascan
|
|
5
5
|
|
6
6
|
# Paths to use for api calls.
|
7
7
|
PATHS = {
|
8
|
-
:scan_file => "https://
|
9
|
-
:results_by_data_id => "https://
|
10
|
-
:results_by_file_hash => "https://
|
8
|
+
:scan_file => "https://scan.metascan-online.com/v2/file",
|
9
|
+
:results_by_data_id => "https://scan.metascan-online.com/v2/file",
|
10
|
+
:results_by_file_hash => "https://hashlookup.metascan-online.com/v2/hash"
|
11
11
|
}
|
12
12
|
|
13
13
|
# a miserable pile of library classes!
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metascan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grayson Chao
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
84
|
rubyforge_project:
|
85
|
-
rubygems_version: 2.0.
|
85
|
+
rubygems_version: 2.0.14
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: Scan files for viruses using the Metascan public API.
|