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: c7812a4d3d7f5f6d41008eadba3e0adb2910ed9f
4
- data.tar.gz: 0f61de10f3e3f73a1a5bc6cacb48572351b77548
3
+ metadata.gz: daf6e55eaf62680d1be8e694764b1605bbaac01c
4
+ data.tar.gz: 460699cfe3f4ce7c704713e2040616da23bd9662
5
5
  SHA512:
6
- metadata.gz: 0635159920ccc7b052bcd0a4629d4ef2457e70d29f056cc34cbaf20a58e22402642be52ee1a4d8b5008848ebb9fa3b60873757ad7b1858bcda2da48bfba9c581
7
- data.tar.gz: b7a9cac97858a7ac03cc84929b13a753797bf4c7fcce4987d57d397018f3af738d931e1e54e1d0a1bbe430b9efa1e5c071199df521b5f87e79d163cf9baf127c
6
+ metadata.gz: a1c3f1286168df5211767b88e439c2fdc5cfd345a22ae43deb48af8cc50eb760fe07082516e3dab69ccfd74bce75e50d41db48716f581a8841b47d493852d97e
7
+ data.tar.gz: 0d21601261ad671eae88513d8e5fd88d7945daba6faf3793c18bf7733650a92d72d60776c5db49070995b51eaa44ed1258cc2eec6005b3bcf8363ab23ab04b53
data/.travis.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
3
  - 2.0.0
5
4
  - 2.1.0
6
5
  - 2.1.1
@@ -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
- system 'sudo',
7
- '/opt/kaspersky/kes4lwks/bin/kes4lwks-control',
8
- '--scan-file',
9
- file_path.to_s,
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
@@ -1,3 +1,3 @@
1
1
  module VirusScanService
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  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 >> /tmp/bar.log'
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(subject)
15
- .to receive(:system)
16
- .with(*desired_cmd.split(' '))
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.1.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: 2015-04-16 00:00:00.000000000 Z
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.2.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: