Class: Pipeline::AV

Inherits:
BaseTask show all
Defined in:
lib/pipeline/tasks/av.rb

Instance Attribute Summary

Attributes inherited from BaseTask

#appname, #description, #findings, #labels, #name, #stage, #trigger, #warnings

Instance Method Summary collapse

Methods inherited from BaseTask

#directories_with?, #report, #severity, #warn

Constructor Details

#initialize(trigger, tracker) ⇒ AV

Returns a new instance of AV.



9
10
11
12
13
14
15
# File 'lib/pipeline/tasks/av.rb', line 9

def initialize(trigger, tracker)
  super(trigger,tracker)
  @name = "AV"
  @description = "Test for virus/malware"
  @stage = :file
  @labels << "filesystem"
end

Instance Method Details

#analyzeObject



27
28
29
30
31
32
33
34
# File 'lib/pipeline/tasks/av.rb', line 27

def analyze
 list = @result.split(/\n/)
 list.each do |v|
    # v.slice! installdir
    Pipeline.notify v
     report "Malicious file identified.", v, @name, :medium
  end
end

#runObject



17
18
19
20
21
22
23
24
25
# File 'lib/pipeline/tasks/av.rb', line 17

def run
  # Update AV
  `freshclam`
  # Run AV
  # TODO:  Circle back and use runsystem.
  Pipeline.notify "Malware/Virus Check"
	rootpath = @trigger.path
 @result=`clamscan --no-summary -i -r "#{rootpath}"`
end

#supported?Boolean

Returns:

  • (Boolean)


36
37
38
39
40
# File 'lib/pipeline/tasks/av.rb', line 36

def supported?
      # TODO verify.
	# In future, verify tool is available.
	return true
end