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



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

def self.analyze(cfg, path, args)
  begin
    contents = File.open(path, "rb").read
  rescue
    puts "Failed to read in the contents of the file."
    return
  end

  begin
    Parser.new.parse(contents, path)
  rescue Exception => e
    puts "Failed to parse the contents of the file."
    puts e.message
    puts e.backtrace
    return
  end

  puts "Successfully parsed the contents of the file."
end

.bindingObject



29
30
31
# File 'lib/nasl/commands/parse.rb', line 29

def self.binding
  'parse'
end