Class: ListeningPortCommandResult

Inherits:
AbstractCommandResult show all
Defined in:
lib/audit/lib/parser/command/listening_port_command.rb

Instance Attribute Summary collapse

Attributes inherited from AbstractCommandResult

#check, #message, #severity, #type

Instance Method Summary collapse

Methods inherited from AbstractCommandResult

#visible?

Constructor Details

#initialize(check, severity, message, port, interface, process) ⇒ ListeningPortCommandResult

Returns a new instance of ListeningPortCommandResult.



13
14
15
16
17
18
# File 'lib/audit/lib/parser/command/listening_port_command.rb', line 13

def initialize(check, severity, message, port, interface, process)
  super(check, severity, message || "found open port", ResultType::LISTENING_PORT)
  @port = port
  @process = process
  @interface = interface
end

Instance Attribute Details

#interfaceObject (readonly)

Returns the value of attribute interface.



11
12
13
# File 'lib/audit/lib/parser/command/listening_port_command.rb', line 11

def interface
  @interface
end

#portObject (readonly)

Returns the value of attribute port.



9
10
11
# File 'lib/audit/lib/parser/command/listening_port_command.rb', line 9

def port
  @port
end

#processObject (readonly)

Returns the value of attribute process.



10
11
12
# File 'lib/audit/lib/parser/command/listening_port_command.rb', line 10

def process
  @process
end

Instance Method Details

#to_hashObject



24
25
26
27
28
# File 'lib/audit/lib/parser/command/listening_port_command.rb', line 24

def to_hash()
  return super.to_hash().merge({:port => @port,
      :process => @process,
      :interface => @interface})
end

#to_stringObject



20
21
22
# File 'lib/audit/lib/parser/command/listening_port_command.rb', line 20

def to_string()
  return "#{@message}: #{@port} on interface #{@interface} of process #{@process}"
end