Class: AddModuleDetails

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
db/migrate/20120625000006_add_module_details.rb

Class Method Summary collapse

Class Method Details

.downObject



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'db/migrate/20120625000006_add_module_details.rb', line 75

def self.down
  remove_index :module_details, :refname
  remove_index :module_details, :name
  remove_index :module_details, :description
  remove_index :module_details, :mtype

  remove_index :module_authors, :module_detail_id
  remove_index :module_mixins, :module_detail_id
  remove_index :module_targets, :module_detail_id
  remove_index :module_actions, :module_detail_id
  remove_index :module_refs, :module_detail_id
  remove_index :module_refs, :name
  remove_index :module_archs, :module_detail_id
  remove_index :module_platform, :module_detail_id

  drop_table :module_details
  drop_table :module_authors
  drop_table :module_mixins
  drop_table :module_targets
  drop_table :module_actions
  drop_table :module_refs
  drop_table :module_archs
  drop_table :module_platforms

end

.upObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'db/migrate/20120625000006_add_module_details.rb', line 3

def self.up

  create_table :module_details do |t|
    t.timestamp :mtime             # disk modified time
    t.text      :file              # location on disk
    t.string    :mtype             # exploit, auxiliary, post, etc
    t.text      :refname           # module path (no type)
    t.text      :fullname          # module path with type
    t.text      :name              # module title
    t.integer   :rank              # exploit rank
    t.text      :description       #
    t.string  :license           # MSF_LICENSE
    t.boolean :privileged        # true or false
    t.timestamp :disclosure_date   # Mar 10 2004
    t.integer :default_target    # 0
    t.text    :default_action    # "scan"
    t.string  :stance            # "passive"
    t.boolean :ready             # true/false
  end

  add_index :module_details, :refname
  add_index :module_details, :name
  add_index :module_details, :description
  add_index :module_details, :mtype

  create_table :module_authors do |t|
    t.integer :module_detail_id
    t.text :name
    t.text :email
  end
  add_index :module_authors, :module_detail_id

  create_table :module_mixins do |t|
    t.integer :module_detail_id
    t.text :name
  end
  add_index :module_mixins, :module_detail_id

  create_table :module_targets do |t|
    t.integer :module_detail_id
    t.integer :index
    t.text :name
  end
  add_index :module_targets, :module_detail_id

  create_table :module_actions do |t|
    t.integer :module_detail_id
    t.text :name
  end
  add_index :module_actions, :module_detail_id

  create_table :module_refs do |t|
    t.integer :module_detail_id
    t.text :name
  end
  add_index :module_refs, :module_detail_id
  add_index :module_refs, :name

  create_table :module_archs do |t|
    t.integer :module_detail_id
    t.text :name
  end
  add_index :module_archs, :module_detail_id

  create_table :module_platforms do |t|
    t.integer :module_detail_id
    t.text :name
  end
  add_index :module_platforms, :module_detail_id

end