clamby 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -1
- data/lib/clamby.rb +30 -13
- data/lib/clamby/exception.rb +6 -0
- data/lib/clamby/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de1411f20e529bdebaaa6f32b34863c06abc38f0
|
4
|
+
data.tar.gz: d6e542a17e3dcec0939d5fd94017b9892613b581
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64d0b0e23f7a8dd5fd42c839e6f1854d73e55fbb72d4a7d22a31ed5db1a63ce3f95d760e7dcc506a49238a51acebae7ba54de65a4b9cce18378922bf45aeaf84
|
7
|
+
data.tar.gz: 58a13ecdbd9068dd7052b4ba1f806592234c2c751b6e8e93702d4a7b851980fc5f5e515f30c563b3508d1185e68d0e310eaf57f8925f0993de4bcce787a9dce6
|
data/README.md
CHANGED
@@ -50,8 +50,15 @@ It's good to note that Clamby will not by default delete files which had a virus
|
|
50
50
|
|
51
51
|
Configuration is rather limited right now. You can exclude the check if `clamscan` exists which will save a bunch of time for scanning your files. However, for development purposes, your machine may not have `clamscan` installed and you may wonder why it's not working properly. This is just to give you a reminder to install `clamscan` on your development machine and production machine. You can add the following to a config file, `clamby_setup.rb` to your initializers directory.
|
52
52
|
|
53
|
+
There has been added additional functionality where you can override exceptions. If you set the exceptions below to false, then there will not be a hard exception generated. Instead, it will post to your log that an error had occured. By default each one of these configuration options are set to true. You may want to set these to false in your production environment.
|
54
|
+
|
53
55
|
```ruby
|
54
|
-
Clamby.configure({
|
56
|
+
Clamby.configure({
|
57
|
+
:check => false,
|
58
|
+
:error_clamscan_missing => false,
|
59
|
+
:error_file_missing => false,
|
60
|
+
:error_file_virus => false
|
61
|
+
})
|
55
62
|
```
|
56
63
|
|
57
64
|
#Dependencies
|
data/lib/clamby.rb
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
require "clamby/version"
|
2
|
-
|
2
|
+
require "clamby/exception"
|
3
3
|
module Clamby
|
4
4
|
|
5
|
-
@config = {
|
5
|
+
@config = {
|
6
|
+
:check => true,
|
7
|
+
:error_clamscan_missing => true,
|
8
|
+
:error_file_missing => true,
|
9
|
+
:error_file_virus => true
|
10
|
+
}
|
6
11
|
|
7
12
|
@valid_config_keys = @config.keys
|
8
13
|
|
@@ -17,8 +22,12 @@ module Clamby
|
|
17
22
|
if scanner
|
18
23
|
return true
|
19
24
|
elsif not scanner
|
20
|
-
|
21
|
-
|
25
|
+
if @config[:error_file_virus]
|
26
|
+
raise Exceptions::VirusDetected.new("VIRUS DETECTED on #{Time.now}: #{path}")
|
27
|
+
else
|
28
|
+
puts "VIRUS DETECTED on #{Time.now}: #{path}"
|
29
|
+
return false
|
30
|
+
end
|
22
31
|
end
|
23
32
|
end
|
24
33
|
end
|
@@ -28,23 +37,31 @@ module Clamby
|
|
28
37
|
if @config[:check]
|
29
38
|
scanner = system('clamscan')
|
30
39
|
if not scanner
|
31
|
-
|
32
|
-
|
40
|
+
if @config[:error_clamscan_missing]
|
41
|
+
raise Exceptions::ClamscanMissing.new("Clamscan application not found. Check your installation and path.")
|
42
|
+
else
|
43
|
+
puts "CLAMSCAN NOT FOUND"
|
44
|
+
return false
|
45
|
+
end
|
33
46
|
else
|
34
47
|
return true
|
35
48
|
end
|
36
|
-
|
37
|
-
|
38
|
-
|
49
|
+
else
|
50
|
+
return true
|
51
|
+
end
|
39
52
|
end
|
40
53
|
|
41
54
|
def self.file_exists?(path)
|
42
55
|
if File.file?(path)
|
43
56
|
return true
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
57
|
+
else
|
58
|
+
if @config[:error_file_missing]
|
59
|
+
raise Exceptions::FileNotFound.new("File not found: #{path}")
|
60
|
+
else
|
61
|
+
puts "FILE NOT FOUND on #{Time.now}: #{path}"
|
62
|
+
return false
|
63
|
+
end
|
64
|
+
end
|
48
65
|
end
|
49
66
|
|
50
67
|
def self.update
|
data/lib/clamby/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kobaltz
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- Rakefile
|
56
56
|
- clamby.gemspec
|
57
57
|
- lib/clamby.rb
|
58
|
+
- lib/clamby/exception.rb
|
58
59
|
- lib/clamby/version.rb
|
59
60
|
homepage: ''
|
60
61
|
licenses:
|