Skip to content

Commit

Permalink
Added ScanDB support.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Apr 21, 2009
1 parent 450877c commit c5ebd38
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
20 changes: 19 additions & 1 deletion app.rb
Expand Up @@ -5,10 +5,13 @@
require 'helpers/templates'

require 'namaste'
require 'scandb'

include Namaste
include ScanDB

Database.setup
Namaste::Database.setup
ScanDB::Database.setup

register_template :layout

Expand Down Expand Up @@ -54,3 +57,18 @@

redirect @comment.note.url
end

get '/hosts/' do
@hosts = Host.all

erb :hosts
end

get '/hosts/:id' do
@host = Host.first(:id => params[:id])

erb :hosts_show
end

post '/hosts/upload' do
end
6 changes: 6 additions & 0 deletions views/hosts.erb
@@ -0,0 +1,6 @@
<h2>Hosts:</h2>
<% @hosts.each do |host| %>
<p>
<a href="/hosts/<%= host.id %>"><%= escape_html host.ip %></a>
</p>
<% end %>
29 changes: 29 additions & 0 deletions views/hosts_show.erb
@@ -0,0 +1,29 @@
<h2><%= escape_html @host.ip %></h2>

<h3>Host names:</h3>
<ul>
<% @host.names.each do |host_name| %>
<li><%= escape_html host_name.name %></li>
<% end %>
</ul>

<h3>Scanned Ports:</h3>
<table>
<thead>
<th>Protocol</th>
<th>Status</th>
<th>Port</th>
<th>Service</th>
</thead>

<tbody>
<% @host.scanned_ports.each do |scanned_port| %>
<tr>
<td><%= scanned_port.port.protocol %></td>
<td><%= scanned_port.status %></td>
<td><%= scanned_port.port.number %></td>
<td><%= escape_html scanned_port.service.name %></td>
</tr>
<% end %>
</tbody>
</table>

0 comments on commit c5ebd38

Please sign in to comment.