virus_total 0.0.3 → 0.2.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/README.md +16 -12
- data/lib/virus_total.rb +2 -1
- data/lib/virus_total/base.rb +2 -1
- data/lib/virus_total/comment.rb +7 -0
- data/lib/virus_total/domain.rb +1 -1
- data/lib/virus_total/file.rb +1 -1
- data/lib/virus_total/{parser.rb → response.rb} +1 -1
- data/lib/virus_total/version.rb +1 -1
- data/solano.yml +12 -0
- data/spec/shared_examples_spec.rb +2 -2
- data/spec/virus_total/comment_spec.rb +13 -0
- data/spec/virus_total/domain_spec.rb +1 -1
- data/spec/virus_total/ip_spec.rb +1 -1
- data/spec/virus_total/{parser_spec.rb → response_spec.rb} +7 -7
- data/spec/virus_total/url_spec.rb +1 -1
- metadata +21 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bce4c85fc1ba3ddd93b273d188bd4fb496f80741
|
|
4
|
+
data.tar.gz: dbfdef518da67d37ac217f41a94f9f55862f5a82
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 116a92dfe662d13cb56588012545c2d2f6531fb99c68d54256c92ea8ded6e656350f77482d67b19cf0948320f0ac310445ce747a045bb72543ab6f2b067fce8d
|
|
7
|
+
data.tar.gz: a150d306705ef3cf4f61eb0695b7f6004d7f8f084ae5e2a5abb22cff69caa7d3ded64ab8f504fc854079ec8c4c3b3b95cb83ddcf3cb90720edceb66ec3a4f6b7
|
data/README.md
CHANGED
|
@@ -41,34 +41,33 @@ file.report # response from POST "file/report"
|
|
|
41
41
|
file.rescan # response from POST "file/rescan"
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
####
|
|
44
|
+
#### Using response
|
|
45
45
|
```ruby
|
|
46
46
|
# for example url.report
|
|
47
47
|
response = url.report
|
|
48
|
-
|
|
49
|
-
# <VirusTotal::Parser:0x0000000252eac0 @json_resp={
|
|
48
|
+
# <VirusTotal::Response:0x0000000252eac0 @response={
|
|
50
49
|
# "permalink"=>"https://www.virustotal.com/url/.../",
|
|
51
50
|
# "resource"=>"https://www.example.com",...,
|
|
52
51
|
# "scans"=>{"CLEAN MX"=>{"detected"=>true, "result"=>"clean site"},...}}>
|
|
53
52
|
|
|
54
|
-
|
|
53
|
+
response.response_code #=> 1: OK, 0: result doesn't exist, -2: still queued
|
|
55
54
|
|
|
56
55
|
# general info from response
|
|
57
|
-
|
|
56
|
+
response.info #=> {"permalink"=>"https://www.virustotal.com/url/.../", "resource"=>"..."}
|
|
58
57
|
|
|
59
58
|
# scanning info
|
|
60
|
-
|
|
59
|
+
response.scans #=> {"CLEAN MX"=>{"detected"=>true, "result"=>"clean site"},...}
|
|
61
60
|
|
|
62
61
|
# information about positive threats
|
|
63
|
-
|
|
62
|
+
response.dangers #=> {"CLEAN MX"=>{"detected"=>true, "result"=>"clean site"}}
|
|
64
63
|
|
|
65
64
|
# antiviruses which found positive threats
|
|
66
|
-
|
|
65
|
+
response.danger_brands #=> ["CLEAN MX"]
|
|
67
66
|
```
|
|
68
67
|
Also we can get any key/value pair from response hash. If key (it is a string) from response has a whitespaces use underscore between words.
|
|
69
68
|
```ruby
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
response.scans.CLEAN_MX #=> {"detected"=>true, "result"=>"clean site"}
|
|
70
|
+
response.scans.CLEAN_MX.detected #=> true
|
|
72
71
|
```
|
|
73
72
|
### Implemented but not testing yet (needs a private apikey)
|
|
74
73
|
#### Scanning IP-Address
|
|
@@ -85,8 +84,13 @@ domain = VirusTotal::Domain.new("example.com", "-- PRIVATE API KEY--")
|
|
|
85
84
|
|
|
86
85
|
domain.report # response from GET "domain/report"
|
|
87
86
|
```
|
|
88
|
-
###
|
|
89
|
-
|
|
87
|
+
### Commenting
|
|
88
|
+
```ruby
|
|
89
|
+
# initialize
|
|
90
|
+
comment = VirusTotal::Comment.new("-- Hash of file --", "-- PUBLIC API KEY --")
|
|
91
|
+
|
|
92
|
+
comment.put "-- Comment text here --" # post a comment on the resource
|
|
93
|
+
```
|
|
90
94
|
|
|
91
95
|
## Contributing
|
|
92
96
|
|
data/lib/virus_total.rb
CHANGED
|
@@ -4,6 +4,7 @@ require "virus_total/url"
|
|
|
4
4
|
require "virus_total/file"
|
|
5
5
|
require "virus_total/ip"
|
|
6
6
|
require "virus_total/domain"
|
|
7
|
-
require "virus_total/
|
|
7
|
+
require "virus_total/comment"
|
|
8
|
+
require "virus_total/response"
|
|
8
9
|
require "virus_total/exception"
|
|
9
10
|
require "virus_total/version"
|
data/lib/virus_total/base.rb
CHANGED
data/lib/virus_total/domain.rb
CHANGED
data/lib/virus_total/file.rb
CHANGED
data/lib/virus_total/version.rb
CHANGED
data/solano.yml
ADDED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
shared_examples_for 'single resource' do
|
|
2
|
-
let(:response) {
|
|
2
|
+
let(:response) { subject.instance_variable_get("@response") }
|
|
3
3
|
|
|
4
4
|
it 'should returns correct response' do
|
|
5
5
|
response.should be_a_kind_of(Hash)
|
|
@@ -7,7 +7,7 @@ shared_examples_for 'single resource' do
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
shared_examples_for 'multiply resources' do
|
|
10
|
-
let(:response) {
|
|
10
|
+
let(:response) { subject.instance_variable_get("@response") }
|
|
11
11
|
|
|
12
12
|
it 'should returns correct response' do
|
|
13
13
|
response.should be_a_kind_of(Array)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require "virus_total"
|
|
2
|
+
|
|
3
|
+
describe VirusTotal::Comment do
|
|
4
|
+
let(:api_key) { "b9f4c087d347d244685fa1ba067b3863"\
|
|
5
|
+
"59dd9f46e88558a3f95061e5d4673d5e" }
|
|
6
|
+
let(:resource) { "da39a3ee5e6b4b0d3255bfef95601890afd80709" }
|
|
7
|
+
let(:comment) { VirusTotal::Comment.new(resource, api_key) }
|
|
8
|
+
|
|
9
|
+
context "for 'comments/put'" do
|
|
10
|
+
subject { comment.put "This is a test comment" }
|
|
11
|
+
it_should_behave_like 'single resource'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -5,7 +5,7 @@ describe VirusTotal::Domain do
|
|
|
5
5
|
let(:api_key) { "--YOUR_PRIVATE_KEY--" }
|
|
6
6
|
let(:domain) { VirusTotal::Domain.new("heroku.com", api_key) }
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
pending "for single domain" do
|
|
9
9
|
context "for 'domain/report'" do
|
|
10
10
|
subject { domain.report }
|
|
11
11
|
it_should_behave_like 'single resource'
|
data/spec/virus_total/ip_spec.rb
CHANGED
|
@@ -5,7 +5,7 @@ describe VirusTotal::Ip do
|
|
|
5
5
|
let(:api_key) { "--YOUR_PRIVATE_KEY--" }
|
|
6
6
|
let(:ip) { VirusTotal::Ip.new("128.0.0.1", api_key) }
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
pending "for single ip address" do
|
|
9
9
|
context "for 'ip-address/report'" do
|
|
10
10
|
subject { ip.report }
|
|
11
11
|
it_should_behave_like 'single resource'
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
require "virus_total"
|
|
2
2
|
|
|
3
|
-
describe VirusTotal::
|
|
3
|
+
describe VirusTotal::Response do
|
|
4
4
|
let(:response) {
|
|
5
5
|
"{\"permalink\":\"https://www.virustotal.com/url\","\
|
|
6
6
|
"\"resource\":\"https://www.example.com\","\
|
|
7
7
|
"\"response_code\":1,"\
|
|
8
8
|
"\"scans\":{\"CLEAN MX\":{\"detected\":true}}}"
|
|
9
9
|
}
|
|
10
|
-
let(:
|
|
10
|
+
let(:response_str) { VirusTotal::Response.new(response) }
|
|
11
11
|
|
|
12
12
|
it "parse response correctly" do
|
|
13
|
-
|
|
13
|
+
response_str.instance_variable_get("@response").should_not be_nil
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
it "returns info correctly" do
|
|
17
|
-
|
|
17
|
+
response_str.info.should_not match(/scans/)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it "returns dangers correctly" do
|
|
21
|
-
|
|
21
|
+
response_str.dangers.should == {"CLEAN MX"=>{"detected"=>true}}
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
it "returns danger brands correctly" do
|
|
25
|
-
|
|
25
|
+
response_str.danger_brands.should == ["CLEAN MX"]
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it "returns hash value correctly" do
|
|
29
|
-
|
|
29
|
+
response_str.response_code.should == 1
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
metadata
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: virus_total
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rubycop
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-03-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- -
|
|
17
|
+
- - ~>
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '1.7'
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- -
|
|
24
|
+
- - ~>
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '1.7'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rake
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- -
|
|
31
|
+
- - ~>
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
33
|
version: '10.0'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- -
|
|
38
|
+
- - ~>
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '10.0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rspec
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- -
|
|
45
|
+
- - ~>
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
47
|
version: '2.6'
|
|
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
54
|
version: '2.6'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: rest-client
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- -
|
|
59
|
+
- - ~>
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
61
|
version: 1.6.7
|
|
62
62
|
type: :runtime
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- -
|
|
66
|
+
- - ~>
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: 1.6.7
|
|
69
69
|
description: gem for VirusTotal API version 2.0.
|
|
@@ -73,7 +73,7 @@ executables: []
|
|
|
73
73
|
extensions: []
|
|
74
74
|
extra_rdoc_files: []
|
|
75
75
|
files:
|
|
76
|
-
-
|
|
76
|
+
- .gitignore
|
|
77
77
|
- Gemfile
|
|
78
78
|
- LICENSE.txt
|
|
79
79
|
- README.md
|
|
@@ -81,19 +81,22 @@ files:
|
|
|
81
81
|
- lib/core_extentions.rb
|
|
82
82
|
- lib/virus_total.rb
|
|
83
83
|
- lib/virus_total/base.rb
|
|
84
|
+
- lib/virus_total/comment.rb
|
|
84
85
|
- lib/virus_total/domain.rb
|
|
85
86
|
- lib/virus_total/exception.rb
|
|
86
87
|
- lib/virus_total/file.rb
|
|
87
88
|
- lib/virus_total/ip.rb
|
|
88
|
-
- lib/virus_total/
|
|
89
|
+
- lib/virus_total/response.rb
|
|
89
90
|
- lib/virus_total/url.rb
|
|
90
91
|
- lib/virus_total/version.rb
|
|
92
|
+
- solano.yml
|
|
91
93
|
- spec/shared_examples_spec.rb
|
|
92
94
|
- spec/virus_total/base_spec.rb
|
|
95
|
+
- spec/virus_total/comment_spec.rb
|
|
93
96
|
- spec/virus_total/domain_spec.rb
|
|
94
97
|
- spec/virus_total/file_spec.rb
|
|
95
98
|
- spec/virus_total/ip_spec.rb
|
|
96
|
-
- spec/virus_total/
|
|
99
|
+
- spec/virus_total/response_spec.rb
|
|
97
100
|
- spec/virus_total/url_spec.rb
|
|
98
101
|
- virus_total.gemspec
|
|
99
102
|
homepage: https://github.com/rubycop/virus_total
|
|
@@ -106,25 +109,26 @@ require_paths:
|
|
|
106
109
|
- lib
|
|
107
110
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
111
|
requirements:
|
|
109
|
-
- -
|
|
112
|
+
- - '>='
|
|
110
113
|
- !ruby/object:Gem::Version
|
|
111
114
|
version: '0'
|
|
112
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
116
|
requirements:
|
|
114
|
-
- -
|
|
117
|
+
- - '>='
|
|
115
118
|
- !ruby/object:Gem::Version
|
|
116
119
|
version: '0'
|
|
117
120
|
requirements: []
|
|
118
121
|
rubyforge_project:
|
|
119
|
-
rubygems_version: 2.
|
|
122
|
+
rubygems_version: 2.0.3
|
|
120
123
|
signing_key:
|
|
121
124
|
specification_version: 4
|
|
122
125
|
summary: gem for VirusTotal API version 2.0.
|
|
123
126
|
test_files:
|
|
124
127
|
- spec/shared_examples_spec.rb
|
|
125
128
|
- spec/virus_total/base_spec.rb
|
|
129
|
+
- spec/virus_total/comment_spec.rb
|
|
126
130
|
- spec/virus_total/domain_spec.rb
|
|
127
131
|
- spec/virus_total/file_spec.rb
|
|
128
132
|
- spec/virus_total/ip_spec.rb
|
|
129
|
-
- spec/virus_total/
|
|
133
|
+
- spec/virus_total/response_spec.rb
|
|
130
134
|
- spec/virus_total/url_spec.rb
|