DB Schema:Overview
From Matt's Network Monitor
[edit] Database Schema Overview
The diagram below is a visual representation of the application schema. Please note that all "id" primary keys are implied as auto-incrementing integers. Foreign keys do not exist in the SQL-representation of the schema, as they are handled by the Rails framework. These PK->FK relations are indicated in the diagram below, but are specified using Rails associations in the class models. Also note that every object model contains implied "created_at" and "updated_at" datetime fields, which is not represented in the diagram below.
[edit] Entity Relationship Diagram

[edit] Rails Schema Definition
ActiveRecord::Schema.define(:version => 13) do create_table "hosts", :force => true do |t| t.string "ipaddr" t.integer "ipaddr_int32" t.string "macaddr" t.string "macaddr_vendor" t.string "hostname" t.datetime "uptime_lastboot" t.integer "status" t.datetime "created_at" t.datetime "updated_at" end create_table "os_classes", :force => true do |t| t.string "ostype" t.string "vendor" t.string "family" t.string "gen" t.integer "accuracy" t.datetime "created_at" t.datetime "updated_at" t.integer "host_id" end add_index "os_classes", ["host_id"], :name => "index_os_classes_on_host_id" create_table "os_matches", :force => true do |t| t.string "name" t.integer "accuracy" t.datetime "created_at" t.datetime "updated_at" t.integer "host_id" end add_index "os_matches", ["host_id"], :name => "index_os_matches_on_host_id" create_table "port_vulnerabilities", :force => true do |t| t.integer "port_id" t.integer "vulnerability_id" t.datetime "created_at" t.datetime "updated_at" end add_index "port_vulnerabilities", ["port_id"], :name => "index_port_vulnerabilities_on_port_id" add_index "port_vulnerabilities", ["vulnerability_id"], :name => "index_port_vulnerabilities_on_vulnerability_id" create_table "ports", :force => true do |t| t.integer "port" t.integer "status" t.datetime "created_at" t.datetime "updated_at" t.integer "host_id" t.string "protocol" t.string "service" end add_index "ports", ["port"], :name => "index_ports_on_port" add_index "ports", ["host_id"], :name => "index_ports_on_host_id" create_table "reference_vulnerabilities", :force => true do |t| t.integer "reference_id" t.integer "vulnerability_id" t.datetime "created_at" t.datetime "updated_at" end add_index "reference_vulnerabilities", ["reference_id"], :name => "index_reference_vulnerabilities_on_reference_id" add_index "reference_vulnerabilities", ["vulnerability_id"], :name => "index_reference_vulnerabilities_on_vulnerability_id" create_table "references", :force => true do |t| t.string "name" t.datetime "created_at" t.datetime "updated_at" end create_table "settings", :force => true do |t| t.string "skey" t.string "svalue" end create_table "vulnerabilities", :force => true do |t| t.string "nasl" t.text "data" t.datetime "created_at" t.datetime "updated_at" end end
