Updated migrations to use ActiveRecord

This commit is contained in:
Ben Passmore
2019-10-08 16:18:21 +10:00
parent 21d0906c12
commit 91265cad77

View File

@@ -27,14 +27,10 @@ module Core
def update_commands!
config = BeEF::Core::Configuration.instance
db_modules = []
BeEF::Core::Models::CommandModule.all.each do |mod|
db_modules << mod.name
end
db_modules = BeEF::Core::Models::CommandModule.all.pluck(:name)
config.get('beef.module').each do |k, v|
h = { :name => k, :path => "#{v['path']}module.rb" }
BeEF::Core::Models::CommandModule.new(h).save unless db_modules.include? k
BeEF::Core::Models::CommandModule.new(name: k, path: "#{v['path']}module.rb").save! unless db_modules.include? k
end
BeEF::Core::Models::CommandModule.all.each do |mod|