adjust templates, move SerializedPrefs into its own file
git-svn-id: file:///home/svn/framework3/trunk@10494 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
7b2a29365f
commit
337a0be8fc
|
@ -0,0 +1,11 @@
|
|||
class AddTemplatePrefs < ActiveRecord::Migration
|
||||
def self.up
|
||||
remove_column :email_templates, :generate_exe
|
||||
add_column :email_templates, :prefs, :text
|
||||
add_column :web_templates, :prefs, :text
|
||||
end
|
||||
def self.down
|
||||
remove_column :email_templates, :prefs
|
||||
remove_column :web_templates, :prefs
|
||||
end
|
||||
end
|
|
@ -1,3 +1,6 @@
|
|||
|
||||
require 'msf/core/model/serialized_prefs'
|
||||
|
||||
require 'msf/core/model/activerecord_patches'
|
||||
|
||||
require 'msf/core/model/user'
|
||||
|
@ -24,4 +27,3 @@ require 'msf/core/model/campaign'
|
|||
require 'msf/core/model/email_address'
|
||||
require 'msf/core/model/email_template'
|
||||
require 'msf/core/model/web_template'
|
||||
|
||||
|
|
|
@ -1,28 +1,6 @@
|
|||
module Msf
|
||||
class DBManager
|
||||
|
||||
module SerializedPrefs
|
||||
def serialized_prefs_attr_accessor(*args)
|
||||
args.each do |method_name|
|
||||
method_declarations = %Q^
|
||||
def #{method_name}
|
||||
return if not self.prefs
|
||||
self.prefs[:#{method_name}]
|
||||
end
|
||||
|
||||
def #{method_name}=(value)
|
||||
temp = self.prefs || {}
|
||||
temp[:#{method_name}] = value
|
||||
self.prefs = temp
|
||||
end
|
||||
^
|
||||
class_eval method_declarations
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
class Campaign < ActiveRecord::Base
|
||||
has_one :email_template
|
||||
has_one :web_template
|
||||
|
|
|
@ -4,6 +4,13 @@ class DBManager
|
|||
class EmailTemplate < ActiveRecord::Base
|
||||
belongs_to :campaign
|
||||
has_and_belongs_to_many :attachments
|
||||
|
||||
extend SerializedPrefs
|
||||
|
||||
serialize :prefs
|
||||
|
||||
serialized_prefs_attr_accessor :exploit_name, :exploit_opts
|
||||
serialized_prefs_attr_accessor :generate_exe
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
module Msf
|
||||
class DBManager
|
||||
|
||||
module SerializedPrefs
|
||||
def serialized_prefs_attr_accessor(*args)
|
||||
args.each do |method_name|
|
||||
method_declarations = %Q^
|
||||
def #{method_name}
|
||||
return if not self.prefs
|
||||
self.prefs[:#{method_name}]
|
||||
end
|
||||
|
||||
def #{method_name}=(value)
|
||||
temp = self.prefs || {}
|
||||
temp[:#{method_name}] = value
|
||||
self.prefs = temp
|
||||
end
|
||||
^
|
||||
class_eval method_declarations
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -3,6 +3,13 @@ class DBManager
|
|||
|
||||
class WebTemplate < ActiveRecord::Base
|
||||
belongs_to :campaign
|
||||
|
||||
extend SerializedPrefs
|
||||
|
||||
serialize :prefs
|
||||
|
||||
serialized_prefs_attr_accessor :exploit_type
|
||||
serialized_prefs_attr_accessor :exploit_name, :exploit_opts
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue