Files
metasploit-gs/data/msfweb/app/controllers/msf_controller.rb
T
lmh e7b100c4ed Generalized search code, now all modules are listed with AJAX requests.
Added javascript helper for automatic live search love.

git-svn-id: file:///home/svn/framework3/trunk@3990 4d416f70-5f16-0410-b530-b9f4589650da
2006-09-28 05:27:20 +00:00

38 lines
1.0 KiB
Ruby

# Author: L.M.H <lmh@info-pull.com>
# Description: The main controller of msfweb v.3
class MsfController < ApplicationController
layout 'msfweb', :except => 'search'
def index
end
# Generic search function as suggested by HDM
def search
if params[:module_type]
@module_type = params[:module_type]
if params[:terms]
case @module_type
when 'exploits'
@results = search_modules(Exploit.find_all(), params[:terms])
when 'auxiliaries'
@results = search_modules(Auxiliary.find_all(), params[:terms])
when 'payloads'
@results = search_modules(Payload.find_all(), params[:terms])
when 'nops'
@results = search_modules(Nop.find_all(), params[:terms])
when 'encoders'
@results = search_modules(Encoder.find_all(), params[:terms])
else
render_text "Module type unknown."
end
else
render_text "No search terms provided."
end
else
render_text "Module type not specified."
end
end
end