clamd 1.0.0 → 1.0.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 +7 -0
- data/README.md +1 -0
- data/lib/clamd/client.rb +10 -10
- data/lib/clamd/socket_manager.rb +2 -2
- data/lib/clamd/version.rb +1 -1
- data/spec/lib/clamd/client_spec.rb +16 -0
- metadata +6 -8
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 117e70c295cc03ba67cb0d8cf289a5a742fb3a04
|
4
|
+
data.tar.gz: 3bc06602bf18f9d0764951e6fe401fd753481117
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 850d19e1ebb1be26cd7fd8ec5340879393e24af45c8ecae4b72c6ba28e1a6fce77863c96b706165d84944e74f477e25cc87cade334f05137efc351a7b277d50c
|
7
|
+
data.tar.gz: 14934ebc0979162602aa443c75d5c3500f5db8af8b3b540bb1a0f7763004987b638e13634dce674a8c10153cd97382badae3649445b11759c890d76dfd610a1e
|
data/README.md
CHANGED
@@ -99,6 +99,7 @@ Clamd is released under the [MIT License](http://www.opensource.org/licenses/MIT
|
|
99
99
|
|
100
100
|
## Code Status
|
101
101
|
|
102
|
+
[](http://badge.fury.io/rb/clamd)
|
102
103
|
[](https://codeclimate.com/github/soundarapandian/clamd)
|
103
104
|
|
104
105
|
## Test
|
data/lib/clamd/client.rb
CHANGED
@@ -15,7 +15,7 @@ module Clamd
|
|
15
15
|
# In the above example the ClamdAV daemon details will be get from the
|
16
16
|
# Clamd::Configuration
|
17
17
|
#
|
18
|
-
# You can also override the
|
18
|
+
# You can also override the global Clamd::Configuration as given below
|
19
19
|
#
|
20
20
|
# clamd = Clamd::Client.new(host: '172.15.20.11', port: 8321)
|
21
21
|
# clamd.ping
|
@@ -27,15 +27,15 @@ module Clamd
|
|
27
27
|
# Supported ClamdAV daemon commands
|
28
28
|
|
29
29
|
COMMAND = {
|
30
|
-
ping:
|
31
|
-
version:
|
32
|
-
reload:
|
33
|
-
shutdown:
|
34
|
-
scan:
|
35
|
-
contscan:
|
36
|
-
multiscan:
|
37
|
-
instream:
|
38
|
-
stats:
|
30
|
+
ping: "PING",
|
31
|
+
version: "VERSION",
|
32
|
+
reload: "RELOAD",
|
33
|
+
shutdown: "SHUTDOWN",
|
34
|
+
scan: "SCAN",
|
35
|
+
contscan: "CONTSCAN",
|
36
|
+
multiscan: "MULTISCAN",
|
37
|
+
instream: "zINSTREAM\0",
|
38
|
+
stats: "zSTATS\0"
|
39
39
|
}.freeze
|
40
40
|
|
41
41
|
include SocketManager
|
data/lib/clamd/socket_manager.rb
CHANGED
@@ -27,12 +27,12 @@ module Clamd
|
|
27
27
|
# Writes the command to the given sicket
|
28
28
|
|
29
29
|
def write_socket(socket, command, path)
|
30
|
-
if path && command !=
|
30
|
+
if path && command != "zINSTREAM\0"
|
31
31
|
socket.write("#{command} #{path}")
|
32
32
|
else
|
33
33
|
socket.write(command)
|
34
34
|
end
|
35
|
-
stream_to_clamd(socket, path) if command ==
|
35
|
+
stream_to_clamd(socket, path) if command == "zINSTREAM\0"
|
36
36
|
end
|
37
37
|
|
38
38
|
##
|
data/lib/clamd/version.rb
CHANGED
@@ -38,6 +38,12 @@ describe Clamd::Client do
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
+
describe '#stats' do
|
42
|
+
it 'displays ClamAV daemon scan queue status' do
|
43
|
+
expect(client.stats).to match(/^POOLS:.*$/)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
41
47
|
describe '#scan' do
|
42
48
|
include_examples 'virus scanner', 'scan'
|
43
49
|
end
|
@@ -50,6 +56,16 @@ describe Clamd::Client do
|
|
50
56
|
include_examples 'virus scanner', 'contscan'
|
51
57
|
end
|
52
58
|
|
59
|
+
describe '#instream' do
|
60
|
+
it 'scans the given stream' do
|
61
|
+
expect(client.instream file_path).to eq('stream: OK')
|
62
|
+
end
|
63
|
+
|
64
|
+
it "reports virus if found" do
|
65
|
+
expect(client.instream file_with_virus_path).to match(/^.*: (.+?) FOUND$/)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
53
69
|
it 'supports to connect multiple ClamAV daemon with different configuration' do
|
54
70
|
clamd1 = described_class.new(host: 'localhost')
|
55
71
|
clamd2 = described_class.new(host: '127.0.0.1')
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clamd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Soundarapandian Rathinasamy
|
@@ -38,27 +37,26 @@ files:
|
|
38
37
|
homepage: https://github.com/soundarapandian/clamd
|
39
38
|
licenses:
|
40
39
|
- MIT
|
40
|
+
metadata: {}
|
41
41
|
post_install_message:
|
42
42
|
rdoc_options: []
|
43
43
|
require_paths:
|
44
44
|
- lib
|
45
45
|
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
-
none: false
|
47
46
|
requirements:
|
48
|
-
- -
|
47
|
+
- - '>='
|
49
48
|
- !ruby/object:Gem::Version
|
50
49
|
version: '0'
|
51
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
51
|
requirements:
|
54
|
-
- -
|
52
|
+
- - '>='
|
55
53
|
- !ruby/object:Gem::Version
|
56
54
|
version: '0'
|
57
55
|
requirements: []
|
58
56
|
rubyforge_project:
|
59
|
-
rubygems_version:
|
57
|
+
rubygems_version: 2.0.3
|
60
58
|
signing_key:
|
61
|
-
specification_version:
|
59
|
+
specification_version: 4
|
62
60
|
summary: Clamd gem enables you to feed the simple VERSION command to complex INSTREAM
|
63
61
|
command to ClamAV antivirus daemon(Clamd)
|
64
62
|
test_files:
|