Class: Nasl::CommandParse

Inherits:
Command
  • Object
show all
Defined in:
lib/nasl/commands/parse.rb

Class Method Summary collapse

Methods inherited from Command

all, banner, find, inherited, initialize!, run

Class Method Details

.analyze(cfg, path, args) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/nasl/commands/parse.rb', line 35

def self.analyze(cfg, path, args)
  begin
    contents = File.open(path, "rb").read
  rescue
    puts '[' + 'VOID'.color(:magenta) + "] #{path}"
    return
  end

  begin
    Parser.new.parse(contents, path)
  rescue Exception => e
    puts '[' + 'FAIL'.color(:red) + "] #{path}"
    puts e.message
    puts e.backtrace
    return
  end

  puts '[' + 'PASS'.color(:green) + "] #{path}"
end

.bindingObject



31
32
33
# File 'lib/nasl/commands/parse.rb', line 31

def self.binding
  'parse'
end