Sha256: 2879fb6e9fe1d78e12437ca17f6c61e6ab6885ed4549f04eb3a2e856b18b2097

Contents?: true

Size: 933 Bytes

Versions: 5

Compression:

Stored size: 933 Bytes

Contents

require 'spec_helper'
require 'helpers/xml'

require 'nmap/xml'
require 'nmap/port'

describe Port do
  include Helpers

  before(:all) do
    @xml = XML.new(Helpers::SCAN_FILE)
    @nse_xml = XML.new(Helpers::NSE_FILE)

    @port = @xml.hosts.first.ports.first
    @nse_port = @nse_xml.hosts.first.ports.first
  end

  it "should parse the protocol" do
    @port.protocol.should == :tcp
  end

  it "should parse the port number" do
    @port.number.should == 21
  end

  it "should parse the state" do
    @port.state.should == :closed
  end

  it "should parse the reason" do
    @port.reason.should == 'reset'
  end

  it "should parse the detected service" do
    @port.service.should == 'ftp'
  end

  it "should parse the output of NSE scripts ran against the port" do
    @nse_port.scripts.should_not be_empty

    @nse_port.scripts.keys.should_not include(nil)
    @nse_port.scripts.values.should_not include(nil)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby-nmap-0.5.1 spec/port_spec.rb
ruby-nmap-0.5.0 spec/port_spec.rb
ruby-nmap-0.4.1 spec/port_spec.rb
ruby-nmap-0.4.0 spec/port_spec.rb
ruby-nmap-0.3.0 spec/port_spec.rb