clamby 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/CHANGELOG.md +45 -0
- data/clamby.gemspec +1 -0
- data/lib/clamby.rb +1 -1
- data/lib/clamby/version.rb +1 -1
- data/spec/clamby_spec.rb +34 -0
- data/spec/spec_helper.rb +8 -0
- metadata +23 -4
- data/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54d701d8ec2b45e261d3dbefe597ab895b9bce15
|
4
|
+
data.tar.gz: 8e8525b5ab0d48afc23481b784ae27b806aca770
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adddc3d8c9b27140905c7dedcfc4cf2f372e88afc8baa1da876b72ed65fbff929b66c85afda0fbd6eedf0be0ccf3edd93f2c6fd939c8050c8daf8368238c9213
|
7
|
+
data.tar.gz: cf9f421d3303f4eef88b3a5538bd732c603cd1f9cba08fc9f8c46e68e8a12357811acac4ec2aaceceaaf1cd4553d4e5963a18525834de6134d636f32f85f2ff5
|
data/.rspec
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#v1.0.4
|
2
|
+
- Added tests. This WILL download a file with a virus signature. It is a safe file, but is used for the purposes of testing the detection of a virus. Regardless, use caution when running rspec as this could be potentially harmful (doubtful, but be warned).
|
3
|
+
|
4
|
+
```ruby
|
5
|
+
.ClamAV 0.98.1/18563/Sun Mar 9 17:39:31 2014
|
6
|
+
.FILE NOT FOUND on 2014-03-10 21:35:44 -0400: BAD_FILE.md
|
7
|
+
.ClamAV 0.98.1/18563/Sun Mar 9 17:39:31 2014
|
8
|
+
README.md: OK
|
9
|
+
.--2014-03-10 21:35:50-- http://www.eicar.org/download/eicar.com
|
10
|
+
Resolving www.eicar.org... 188.40.238.250
|
11
|
+
Connecting to www.eicar.org|188.40.238.250|:80... connected.
|
12
|
+
HTTP request sent, awaiting response... 200 OK
|
13
|
+
Length: 68 [application/octet-stream]
|
14
|
+
Saving to: 'eicar.com'
|
15
|
+
|
16
|
+
100%[=================>] 68 --.-K/s in 0s
|
17
|
+
|
18
|
+
2014-03-10 21:35:50 (13.0 MB/s) - 'eicar.com' saved [68/68]
|
19
|
+
|
20
|
+
ClamAV 0.98.1/18563/Sun Mar 9 17:39:31 2014
|
21
|
+
eicar.com: Eicar-Test-Signature FOUND
|
22
|
+
ClamAV 0.98.1/18563/Sun Mar 9 17:39:31 2014
|
23
|
+
eicar.com: Eicar-Test-Signature FOUND
|
24
|
+
VIRUS DETECTED on 2014-03-10 21:36:02 -0400: eicar.com
|
25
|
+
.
|
26
|
+
|
27
|
+
Finished in 17.79 seconds
|
28
|
+
5 examples, 0 failures
|
29
|
+
````
|
30
|
+
|
31
|
+
- Changed `scanner_exists?` method to check `clamscan -V` for version instead of just `clamscan` which was causing a virus scan on the local folder. This ended up throwing false checks since I had a virus test file in the root of the directory.
|
32
|
+
|
33
|
+
#v1.0.3
|
34
|
+
- Added exceptions
|
35
|
+
- New configuration options
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
Clamby.configure({
|
39
|
+
:check => false,
|
40
|
+
:error_clamscan_missing => false,
|
41
|
+
:error_file_missing => false,
|
42
|
+
:error_file_virus => false
|
43
|
+
})
|
44
|
+
|
45
|
+
```
|
data/clamby.gemspec
CHANGED
data/lib/clamby.rb
CHANGED
@@ -35,7 +35,7 @@ module Clamby
|
|
35
35
|
|
36
36
|
def self.scanner_exists?
|
37
37
|
if @config[:check]
|
38
|
-
scanner = system('clamscan')
|
38
|
+
scanner = system('clamscan -V')
|
39
39
|
if not scanner
|
40
40
|
if @config[:error_clamscan_missing]
|
41
41
|
raise Exceptions::ClamscanMissing.new("Clamscan application not found. Check your installation and path.")
|
data/lib/clamby/version.rb
CHANGED
data/spec/clamby_spec.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
good_path = 'README.md'
|
4
|
+
bad_path = 'BAD_FILE.md'
|
5
|
+
|
6
|
+
describe Clamby do
|
7
|
+
it "should find files." do
|
8
|
+
expect(Clamby.file_exists?(good_path)).to be true
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should find clamscan" do
|
12
|
+
expect(Clamby.scanner_exists?).to be true
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should not find files." do
|
16
|
+
Clamby.configure({:error_file_missing => true})
|
17
|
+
expect{Clamby.file_exists?(bad_path)}.to raise_exception(Exceptions::FileNotFound)
|
18
|
+
Clamby.configure({:error_file_missing => false})
|
19
|
+
expect(Clamby.file_exists?(bad_path)).to be false
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should scan file as safe" do
|
23
|
+
expect(Clamby.scan(good_path)).to be true
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should scan file as dangerous" do
|
27
|
+
`wget http://www.eicar.org/download/eicar.com`
|
28
|
+
Clamby.configure({:error_file_virus => true})
|
29
|
+
expect{Clamby.scan('eicar.com')}.to raise_exception(Exceptions::VirusDetected)
|
30
|
+
Clamby.configure({:error_file_virus => false})
|
31
|
+
expect(Clamby.scan('eicar.com')).to be false
|
32
|
+
File.delete('eicar.com')
|
33
|
+
end
|
34
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clamby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kobaltz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Clamby allows users to scan files uploaded with Paperclip or Carrierwave.
|
42
56
|
If a file has a virus, then you can delete this file and discard it without causing
|
43
57
|
harm to other users.
|
@@ -47,8 +61,9 @@ executables: []
|
|
47
61
|
extensions: []
|
48
62
|
extra_rdoc_files: []
|
49
63
|
files:
|
50
|
-
- ".DS_Store"
|
51
64
|
- ".gitignore"
|
65
|
+
- ".rspec"
|
66
|
+
- CHANGELOG.md
|
52
67
|
- Gemfile
|
53
68
|
- LICENSE.txt
|
54
69
|
- README.md
|
@@ -57,6 +72,8 @@ files:
|
|
57
72
|
- lib/clamby.rb
|
58
73
|
- lib/clamby/exception.rb
|
59
74
|
- lib/clamby/version.rb
|
75
|
+
- spec/clamby_spec.rb
|
76
|
+
- spec/spec_helper.rb
|
60
77
|
homepage: ''
|
61
78
|
licenses:
|
62
79
|
- MIT
|
@@ -81,4 +98,6 @@ rubygems_version: 2.2.2
|
|
81
98
|
signing_key:
|
82
99
|
specification_version: 4
|
83
100
|
summary: Scan file uploads with ClamAV
|
84
|
-
test_files:
|
101
|
+
test_files:
|
102
|
+
- spec/clamby_spec.rb
|
103
|
+
- spec/spec_helper.rb
|
data/.DS_Store
DELETED
Binary file
|