diff --git a/data/msfweb/app/controllers/application.rb b/data/msfweb/app/controllers/application.rb index 537de40d7e..7c687990c4 100644 --- a/data/msfweb/app/controllers/application.rb +++ b/data/msfweb/app/controllers/application.rb @@ -1,4 +1,23 @@ # Filters added to this controller will be run for all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base -end \ No newline at end of file + + def search_modules(mlist, terms) + res = [] + mlist.each do |m| + + if (m.name.downcase.index(terms.downcase)) + res << m + next + end + + if (m.desc.downcase.index(terms.downcase)) + res << m + next + end + + end + res + end + +end diff --git a/data/msfweb/app/controllers/auxiliaries_controller.rb b/data/msfweb/app/controllers/auxiliaries_controller.rb index f2431ced38..22f7fa3ab0 100644 --- a/data/msfweb/app/controllers/auxiliaries_controller.rb +++ b/data/msfweb/app/controllers/auxiliaries_controller.rb @@ -1,8 +1,12 @@ class AuxiliariesController < ApplicationController layout 'windows' - + + def search_complete(terms) + search_modules(Auxiliary.find_all(), terms) + end + def list - @all_auxiliary = Auxiliary.get_available() + @auxiliaries = Auxiliary.find_all() end def view diff --git a/data/msfweb/app/controllers/encoders_controller.rb b/data/msfweb/app/controllers/encoders_controller.rb index 14a275ac6e..0fff420c62 100644 --- a/data/msfweb/app/controllers/encoders_controller.rb +++ b/data/msfweb/app/controllers/encoders_controller.rb @@ -1,8 +1,12 @@ class EncodersController < ApplicationController layout 'windows' - + + def search_complete(terms) + search_modules(Encoder.find_all(), terms) + end + def list - @all_encoders = Encoder.get_available() + @encoders = Encoder.find_all() end def view diff --git a/data/msfweb/app/controllers/exploits_controller.rb b/data/msfweb/app/controllers/exploits_controller.rb index 489777bb79..888d2317f2 100644 --- a/data/msfweb/app/controllers/exploits_controller.rb +++ b/data/msfweb/app/controllers/exploits_controller.rb @@ -1,12 +1,16 @@ class ExploitsController < ApplicationController layout 'windows' + + def search_complete(terms) + search_modules(Exploit.find_all(), terms) + end def list - @all_exploits = Exploit.get_available() + @exploits = Exploit.find_all() end def view - @all_exploits = Exploit.get_available() + @exploits = Exploit.find_all() end def exploit diff --git a/data/msfweb/app/controllers/jobs_controller.rb b/data/msfweb/app/controllers/jobs_controller.rb index 46907a8e93..ecc34ed3d5 100644 --- a/data/msfweb/app/controllers/jobs_controller.rb +++ b/data/msfweb/app/controllers/jobs_controller.rb @@ -2,7 +2,7 @@ class JobsController < ApplicationController layout 'windows' def list - @all_jobs = Job.get_available() + @jobs = Job.find_all() end def stop diff --git a/data/msfweb/app/controllers/nops_controller.rb b/data/msfweb/app/controllers/nops_controller.rb index e99783e631..07d33f5ddb 100644 --- a/data/msfweb/app/controllers/nops_controller.rb +++ b/data/msfweb/app/controllers/nops_controller.rb @@ -1,8 +1,12 @@ class NopsController < ApplicationController layout 'windows' - + + def search_complete(terms) + search_modules(Nop.find_all(), terms) + end + def list - @all_nops = Nop.get_available() + @nops = Nop.find_all() end def view diff --git a/data/msfweb/app/controllers/payloads_controller.rb b/data/msfweb/app/controllers/payloads_controller.rb index b1c64f9883..ff18ddc22d 100644 --- a/data/msfweb/app/controllers/payloads_controller.rb +++ b/data/msfweb/app/controllers/payloads_controller.rb @@ -1,12 +1,16 @@ class PayloadsController < ApplicationController - layout 'windows' - + layout 'windows' + + def search_complete(terms) + search_modules(Payload.find_all(), terms) + end + def list - @all_payloads = Payload.get_available() + @payloads = Payload.find_all() end def view - @all_payloads = Payload.get_available() + @payloads = Payload.find_all() end def generate diff --git a/data/msfweb/app/controllers/sessions_controller.rb b/data/msfweb/app/controllers/sessions_controller.rb index 00008d8906..e6a481571f 100644 --- a/data/msfweb/app/controllers/sessions_controller.rb +++ b/data/msfweb/app/controllers/sessions_controller.rb @@ -2,7 +2,7 @@ class SessionsController < ApplicationController layout 'windows' def list - @all_sessions = Session.get_available() + @sessions = Session.find_all() end def stop diff --git a/data/msfweb/app/models/auxiliary.rb b/data/msfweb/app/models/auxiliary.rb index 0712a195f1..49106fec4b 100644 --- a/data/msfweb/app/models/auxiliary.rb +++ b/data/msfweb/app/models/auxiliary.rb @@ -1,5 +1,5 @@ class Auxiliary - def self.get_available() + def self.find_all() mods = [] $msframework.auxiliary.each_module { |n,m| mods << m.new } mods diff --git a/data/msfweb/app/models/encoder.rb b/data/msfweb/app/models/encoder.rb index ff9a2a8543..30db8e53d5 100644 --- a/data/msfweb/app/models/encoder.rb +++ b/data/msfweb/app/models/encoder.rb @@ -1,9 +1,7 @@ class Encoder - - def self.get_available() + def self.find_all() mods = [] $msframework.encoders.each_module { |n,m| mods << m.new } mods end - end diff --git a/data/msfweb/app/models/exploit.rb b/data/msfweb/app/models/exploit.rb index b97c1126d8..aea9d4c5dd 100644 --- a/data/msfweb/app/models/exploit.rb +++ b/data/msfweb/app/models/exploit.rb @@ -1,9 +1,7 @@ class Exploit - - def self.get_available() + def self.find_all() mods = [] $msframework.exploits.each_module { |n,m| mods << m.new } mods end - end diff --git a/data/msfweb/app/models/job.rb b/data/msfweb/app/models/job.rb index 3c0f74fc4c..53496e6919 100644 --- a/data/msfweb/app/models/job.rb +++ b/data/msfweb/app/models/job.rb @@ -1,5 +1,5 @@ class Job - def self.get_available() + def self.find_all() $msframework.jobs end end diff --git a/data/msfweb/app/models/nop.rb b/data/msfweb/app/models/nop.rb index 9bd53b8a4f..7ef9715794 100644 --- a/data/msfweb/app/models/nop.rb +++ b/data/msfweb/app/models/nop.rb @@ -1,9 +1,7 @@ class Nop - - def self.get_available() + def self.find_all() mods = [] $msframework.nops.each_module { |n,m| mods << m.new } mods end - end diff --git a/data/msfweb/app/models/payload.rb b/data/msfweb/app/models/payload.rb index fc596ba0d5..ccc6eb9c25 100644 --- a/data/msfweb/app/models/payload.rb +++ b/data/msfweb/app/models/payload.rb @@ -1,9 +1,7 @@ class Payload - - def self.get_available() + def self.find_all() mods = [] $msframework.payloads.each_module { |n,m| mods << m.new } mods end - end diff --git a/data/msfweb/app/models/session.rb b/data/msfweb/app/models/session.rb index 005c35d6a0..be79181b63 100644 --- a/data/msfweb/app/models/session.rb +++ b/data/msfweb/app/models/session.rb @@ -1,5 +1,5 @@ class Session - def self.get_available() + def self.find_all() $msframework.sessions end end diff --git a/data/msfweb/app/views/auxiliaries/list.rhtml b/data/msfweb/app/views/auxiliaries/list.rhtml index cda2cadfc5..3469f1adab 100644 --- a/data/msfweb/app/views/auxiliaries/list.rhtml +++ b/data/msfweb/app/views/auxiliaries/list.rhtml @@ -6,7 +6,7 @@ - <% @all_auxiliary.each do |m| %> + <% @auxiliaries.each do |m| %> <%= m.name %> <%= m.description %> diff --git a/data/msfweb/app/views/exploits/list.rhtml b/data/msfweb/app/views/exploits/list.rhtml index 24c237d047..d145d1bc46 100644 --- a/data/msfweb/app/views/exploits/list.rhtml +++ b/data/msfweb/app/views/exploits/list.rhtml @@ -6,8 +6,8 @@ - <% @all_exploits.each_index do |i| - m = @all_exploits[i] + <% @exploits.each_index do |i| + m = @exploits[i] %> <%= m.name %> diff --git a/data/msfweb/app/views/exploits/view.rhtml b/data/msfweb/app/views/exploits/view.rhtml index b52d08ab9e..9e20958cb1 100644 --- a/data/msfweb/app/views/exploits/view.rhtml +++ b/data/msfweb/app/views/exploits/view.rhtml @@ -1,7 +1,7 @@ <% modidx = (params[:id] || 0).to_i - modinst = @all_exploits[modidx] + modinst = @exploits[modidx] %> diff --git a/data/msfweb/app/views/jobs/list.rhtml b/data/msfweb/app/views/jobs/list.rhtml index 3ed8317902..4b1882e6a9 100644 --- a/data/msfweb/app/views/jobs/list.rhtml +++ b/data/msfweb/app/views/jobs/list.rhtml @@ -6,7 +6,7 @@ - <% @all_jobs.each_pair do |n,m| %> + <% @jobs.each_pair do |n,m| %> <% end %> diff --git a/data/msfweb/app/views/payloads/list.rhtml b/data/msfweb/app/views/payloads/list.rhtml index 6b82af3e4a..6a22b5a07a 100644 --- a/data/msfweb/app/views/payloads/list.rhtml +++ b/data/msfweb/app/views/payloads/list.rhtml @@ -6,8 +6,8 @@ - <% @all_payloads.each_index do |i| - m = @all_payloads[i] + <% @payloads.each_index do |i| + m = @payloads[i] %> diff --git a/data/msfweb/app/views/payloads/view.rhtml b/data/msfweb/app/views/payloads/view.rhtml index 7205e3136f..ad514fa072 100644 --- a/data/msfweb/app/views/payloads/view.rhtml +++ b/data/msfweb/app/views/payloads/view.rhtml @@ -1,7 +1,7 @@ <% modidx = (params[:id] || 0).to_i - modinst = @all_payloads[modidx] + modinst = @payloads[modidx] %>
<%= n %><%= m %>
<%= m.name %>
diff --git a/data/msfweb/app/views/sessions/list.rhtml b/data/msfweb/app/views/sessions/list.rhtml index 381e30fdd3..e30ad8dc56 100644 --- a/data/msfweb/app/views/sessions/list.rhtml +++ b/data/msfweb/app/views/sessions/list.rhtml @@ -6,7 +6,7 @@ - <% @all_sessions.each_pair do |n,m| %> + <% @sessions.each_pair do |n,m| %> <% end %>
<%= n %><%= m %>