Sha256: f35fdfc606bc634df3a41d5b009b2556dad77a795b101b4d27cafb7bffb34263

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require 'nmap/xml'

require 'spec_helper'
require 'helpers/xml'

describe XML do
  include Helpers

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

  it "should have a version" do
    @xml.version.should == '1.02'
  end

  it "should parse the scanner version" do
    @xml.scanner.version == '4.68'
  end

  it "should parse the scanner name" do
    @xml.scanner.name.should == 'nmap'
  end

  it "should parse the scanner arguments" do
    @xml.scanner.arguments.should == 'nmap -v -oX samples/backspace.xml -O -P0 -sS 192.168.5.*'
  end

  it "should parse the scan information" do
    scan_info = @xml.scan_info

    scan_info.length.should == 1
    scan_info.first.type.should == :syn
    scan_info.first.protocol.should == :tcp
  end

  it "should parse the verbose level" do
    @xml.verbose.should == 1
  end

  it "should parse the debugging level" do
    @xml.debugging.should == 0
  end

  it "should parse the hosts" do
    @xml.hosts.length.should == 10
  end

  it "should convert to a String" do
    @xml.to_s.should == Helpers::SCAN_FILE
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-nmap-0.1.1 spec/xml_spec.rb
ruby-nmap-0.1.0 spec/xml_spec.rb