virus_scan_service 0.1.0 → 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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daf6e55eaf62680d1be8e694764b1605bbaac01c
|
4
|
+
data.tar.gz: 460699cfe3f4ce7c704713e2040616da23bd9662
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1c3f1286168df5211767b88e439c2fdc5cfd345a22ae43deb48af8cc50eb760fe07082516e3dab69ccfd74bce75e50d41db48716f581a8841b47d493852d97e
|
7
|
+
data.tar.gz: 0d21601261ad671eae88513d8e5fd88d7945daba6faf3793c18bf7733650a92d72d60776c5db49070995b51eaa44ed1258cc2eec6005b3bcf8363ab23ab04b53
|
data/.travis.yml
CHANGED
@@ -89,7 +89,7 @@ module VirusScanService
|
|
89
89
|
|
90
90
|
def set_result
|
91
91
|
result = File.read(scan_log_path || raise(ScanLogPathNotSet))
|
92
|
-
result.scan(/Total detected:\s*(\d+)/) do |threat_count, *other|
|
92
|
+
result.scan(/(?:Total detected|Threats found):\s*(\d+)/) do |threat_count, *other|
|
93
93
|
if threat_count == ''
|
94
94
|
raise ScanLogParseError
|
95
95
|
elsif threat_count == '0'
|
@@ -1,14 +1,12 @@
|
|
1
|
+
require 'open3'
|
1
2
|
module VirusScanService
|
2
3
|
class KasperskyRunner
|
3
4
|
class LinuxExecutor
|
4
|
-
# not tested on real production as I'm using windows VM for virus scans
|
5
5
|
def scan(file_path, log_path)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
">>",
|
11
|
-
log_path.to_s
|
6
|
+
stdout, stderr, status = Open3.capture3(
|
7
|
+
"sudo /opt/kaspersky/kes4lwks/bin/kes4lwks-control --scan-file #{file_path.to_s}"
|
8
|
+
)
|
9
|
+
File.open(log_path.to_s, 'w') { |file| file.write(stdout) }
|
12
10
|
end
|
13
11
|
end
|
14
12
|
end
|
@@ -6,14 +6,14 @@ RSpec.describe VirusScanService::KasperskyRunner::LinuxExecutor do
|
|
6
6
|
let(:desired_cmd) {
|
7
7
|
'sudo ' +
|
8
8
|
'/opt/kaspersky/kes4lwks/bin/kes4lwks-control ' +
|
9
|
-
'--scan-file /tmp/scan_file
|
9
|
+
'--scan-file /tmp/scan_file'
|
10
10
|
}
|
11
11
|
|
12
12
|
describe '#scan' do
|
13
13
|
it 'should exectute correct command' do
|
14
|
-
expect(
|
15
|
-
.to receive(:
|
16
|
-
.with(
|
14
|
+
expect(Open3)
|
15
|
+
.to receive(:capture3)
|
16
|
+
.with(desired_cmd)
|
17
17
|
|
18
18
|
subject.scan(Pathname.new('/tmp').join('scan_file'), Pathname.new('/tmp').join('bar.log'))
|
19
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: virus_scan_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Valent
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
version: '0'
|
151
151
|
requirements: []
|
152
152
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.
|
153
|
+
rubygems_version: 2.4.8
|
154
154
|
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: Servce gem for triggering Virus checks
|
@@ -166,4 +166,3 @@ test_files:
|
|
166
166
|
- spec/support/dummy_viruscheck_runner.rb
|
167
167
|
- spec/support/null_logger.rb
|
168
168
|
- spec/support/request_response_mocks.rb
|
169
|
-
has_rdoc:
|