-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added
Nmap::XML::PortUsed
for Nmap::XML::OS#ports_used
.
- Loading branch information
1 parent
dbaff0c
commit 56ed44b
Showing
4 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module Nmap | ||
class XML | ||
# | ||
# Represents a port used to perform OS fingerprinting. | ||
# | ||
# @since 1.1.0 | ||
# | ||
class PortUsed < Struct.new(:state,:protocol,:port) | ||
|
||
alias to_i port | ||
alias to_int port | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'spec_helper' | ||
require 'nmap/xml/port_used' | ||
|
||
describe Nmap::XML::PortUsed do | ||
let(:state) { :open } | ||
let(:protocol) { :tcp } | ||
let(:port) { 22 } | ||
|
||
subject { described_class.new(state,protocol,port) } | ||
|
||
describe "#to_i" do | ||
it "must return the port number" do | ||
expect(subject.to_i).to eq(port) | ||
end | ||
end | ||
|
||
describe "#to_int" do | ||
it "must return the port number" do | ||
expect(subject.to_int).to eq(port) | ||
end | ||
end | ||
end |