Skip to content

Instantly share code, notes, and snippets.

@actionjack
Forked from garethr/nmap-rspec.rb
Created November 2, 2013 17:11
Show Gist options
  • Save actionjack/7281168 to your computer and use it in GitHub Desktop.
Save actionjack/7281168 to your computer and use it in GitHub Desktop.
Starting Nmap 5.21 ( http://nmap.org ) at 2013-09-16 11:52 BST
Nmap scan report for monitorama.eu (141.101.116.49)
Host is up (0.021s latency).
Hostname monitorama.eu resolves to 2 IPs. Only scanned 141.101.116.49
PORT STATE SERVICE
20/tcp filtered ftp-data
21/tcp filtered ftp
22/tcp filtered ssh
23/tcp filtered telnet
25/tcp filtered smtp
80/tcp open http
110/tcp filtered pop3
443/tcp filtered https
512/tcp filtered exec
522/tcp filtered ulp
1080/tcp filtered socks
8080/tcp open http-proxy
Nmap done: 1 IP address (1 host up) scanned in 8.97 seconds
F
Failures:
1) the monitorama.eu website should have one port open
Failure/Error: @host.open_ports.should have(1).items
expected 1 items, got 2
# ./nmap-spec.rb:21:in `block (2 levels) in <top (required)>'
Finished in 8.99 seconds
1 example, 1 failure
Failed examples:
rspec ./nmap-spec.rb:20 # the monitorama.eu website should have one port open
require 'nmap/program'
require 'nmap/xml'
describe "the monitorama.eu website" do
before(:all) do
Nmap::Program.scan do |nmap|
nmap.xml = 'scan.xml'
nmap.ports = [20,21,22,23,25,80,110,443,512,522,8080,1080]
nmap.targets = 'monitorama.eu'
end
Nmap::XML.new('scan.xml') do |xml|
xml.each_host do |host|
@host = host
end
end
end
it "should have one port open" do
@host.open_ports.should have(1).items
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment