Normalized the model methods, added search completion, etc
git-svn-id: file:///home/svn/framework3/trunk@3980 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
@@ -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
|
||||
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,7 +2,7 @@ class JobsController < ApplicationController
|
||||
layout 'windows'
|
||||
|
||||
def list
|
||||
@all_jobs = Job.get_available()
|
||||
@jobs = Job.find_all()
|
||||
end
|
||||
|
||||
def stop
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,7 +2,7 @@ class SessionsController < ApplicationController
|
||||
layout 'windows'
|
||||
|
||||
def list
|
||||
@all_sessions = Session.get_available()
|
||||
@sessions = Session.find_all()
|
||||
end
|
||||
|
||||
def stop
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Job
|
||||
def self.get_available()
|
||||
def self.find_all()
|
||||
$msframework.jobs
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Session
|
||||
def self.get_available()
|
||||
def self.find_all()
|
||||
$msframework.sessions
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @all_auxiliary.each do |m| %>
|
||||
<% @auxiliaries.each do |m| %>
|
||||
<tr>
|
||||
<td><a onClick="window.parent.openModuleWindow('auxiliaries', '<%= m.refname.gsub('/', ':') %>', '<%= m.name %>')" href="#"><%= m.name %></a></td>
|
||||
<td><%= m.description %></td>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @all_exploits.each_index do |i|
|
||||
m = @all_exploits[i]
|
||||
<% @exploits.each_index do |i|
|
||||
m = @exploits[i]
|
||||
%>
|
||||
<tr>
|
||||
<td><a onClick="window.parent.openModuleWindow('exploits', '<%= i %>', '<%= m.name %>')" href="#"><%= m.name %></a></td>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<%
|
||||
|
||||
modidx = (params[:id] || 0).to_i
|
||||
modinst = @all_exploits[modidx]
|
||||
modinst = @exploits[modidx]
|
||||
%>
|
||||
|
||||
<table width='100%' cellspacing='0' cellpadding='0' border='0'>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @all_jobs.each_pair do |n,m| %>
|
||||
<% @jobs.each_pair do |n,m| %>
|
||||
<tr><td><%= n %></td><td><%= m %></td></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @all_payloads.each_index do |i|
|
||||
m = @all_payloads[i]
|
||||
<% @payloads.each_index do |i|
|
||||
m = @payloads[i]
|
||||
%>
|
||||
<tr>
|
||||
<td><a onClick="window.parent.openModuleWindow('payloads', '<%= i %>', '<%= m.name %>')" href="#"><%= m.name %></a></td>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<%
|
||||
|
||||
modidx = (params[:id] || 0).to_i
|
||||
modinst = @all_payloads[modidx]
|
||||
modinst = @payloads[modidx]
|
||||
%>
|
||||
|
||||
<table width='100%' cellspacing='0' cellpadding='0' border='0'>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @all_sessions.each_pair do |n,m| %>
|
||||
<% @sessions.each_pair do |n,m| %>
|
||||
<tr><td><%= n %></td><td><%= m %></td></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user