Generalized views for each module type, added platform icons support and started the base for full payload generation support.
git-svn-id: file:///home/svn/framework3/trunk@3996 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
9ae0737253
commit
03fb9ae376
|
@ -1,7 +1,12 @@
|
||||||
|
# Author: HDM <hdm@metasploit.com> and L.M.H <lmh@info-pull.com>
|
||||||
|
# Description: Helper methods for the controllers, including search and other
|
||||||
|
# functionality.
|
||||||
|
|
||||||
# Filters added to this controller will be run for all controllers in the application.
|
# 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.
|
# Likewise, all the methods added will be available for all controllers.
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
|
# Search functionality for modules
|
||||||
def search_modules(mlist, terms)
|
def search_modules(mlist, terms)
|
||||||
res = {}
|
res = {}
|
||||||
|
|
||||||
|
@ -38,4 +43,37 @@ class ApplicationController < ActionController::Base
|
||||||
list
|
list
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns the module by id of specified type.
|
||||||
|
def get_view_for_module(module_type, module_id)
|
||||||
|
@tmod = nil
|
||||||
|
|
||||||
|
# Get available moduls of specified type
|
||||||
|
case module_type
|
||||||
|
when "exploit"
|
||||||
|
@mod_list = Exploit.find_all()
|
||||||
|
when "auxiliary"
|
||||||
|
@mod_list = Auxiliary.find_all()
|
||||||
|
when "payload"
|
||||||
|
@mod_list = Payload.find_all()
|
||||||
|
when "nop"
|
||||||
|
@mod_list = Nop.find_all()
|
||||||
|
when "encoder"
|
||||||
|
@mod_list = Encoder.find_all()
|
||||||
|
else
|
||||||
|
return @tmod
|
||||||
|
end
|
||||||
|
|
||||||
|
# Return the module if found
|
||||||
|
if id
|
||||||
|
@mod_list.each do |m|
|
||||||
|
if m.refname.gsub('/', ':') == params[:id]
|
||||||
|
@tmod = m
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return @tmod
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
# Author: L.M.H <lmh@info-pull.com>
|
||||||
|
# Description: The auxiliary controller of msfweb v.3. Handles views, listing
|
||||||
|
# and other actions related to auxiliary modules. Code and processing goes here.
|
||||||
|
# Instance variables, final values, etc, go into views.
|
||||||
|
|
||||||
class AuxiliariesController < ApplicationController
|
class AuxiliariesController < ApplicationController
|
||||||
layout 'windows'
|
layout 'windows'
|
||||||
|
|
||||||
|
@ -5,6 +10,11 @@ class AuxiliariesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def view
|
def view
|
||||||
|
@tmod = get_view_for_module("auxiliary", params[:id])
|
||||||
|
|
||||||
|
unless @tmod
|
||||||
|
render_text "Unknown module specified."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
# Author: L.M.H <lmh@info-pull.com>
|
||||||
|
# Description: The encoder controller of msfweb v.3. Handles views, listing
|
||||||
|
# and other actions related to encoder modules. Code and processing goes here.
|
||||||
|
# Instance variables, final values, etc, go into views.
|
||||||
|
|
||||||
class EncodersController < ApplicationController
|
class EncodersController < ApplicationController
|
||||||
layout 'windows'
|
layout 'windows'
|
||||||
|
|
||||||
|
@ -5,6 +10,11 @@ class EncodersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def view
|
def view
|
||||||
|
@tmod = get_view_for_module("encoder", params[:id])
|
||||||
|
|
||||||
|
unless @tmod
|
||||||
|
render_text "Unknown module specified."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def encode
|
def encode
|
||||||
|
|
|
@ -10,15 +10,7 @@ class ExploitsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def view
|
def view
|
||||||
@exploits = Exploit.find_all()
|
@tmod = get_view_for_module("exploit", params[:id])
|
||||||
if params[:id]
|
|
||||||
@exploits.each do |m|
|
|
||||||
if m.refname.gsub('/', ':') == params[:id]
|
|
||||||
@tmod = m
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
unless @tmod
|
unless @tmod
|
||||||
render_text "Unknown module specified."
|
render_text "Unknown module specified."
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
# Author: L.M.H <lmh@info-pull.com>
|
||||||
|
# Description: The nop controller of msfweb v.3. Handles views, listing
|
||||||
|
# and other actions related to nop modules. Code and processing goes here.
|
||||||
|
# Instance variables, final values, etc, go into views.
|
||||||
|
|
||||||
class NopsController < ApplicationController
|
class NopsController < ApplicationController
|
||||||
layout 'windows'
|
layout 'windows'
|
||||||
|
|
||||||
|
@ -5,7 +10,11 @@ class NopsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def view
|
def view
|
||||||
@nops = Nop.find_all()
|
@tmod = get_view_for_module("nop", params[:id])
|
||||||
|
|
||||||
|
unless @tmod
|
||||||
|
render_text "Unknown module specified."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate
|
def generate
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
# Author: L.M.H <lmh@info-pull.com>
|
||||||
|
# Description: The payload controller of msfweb v.3. Handles views, listing
|
||||||
|
# and other actions related to payload modules. Code and processing goes here.
|
||||||
|
# Instance variables, final values, etc, go into views.
|
||||||
|
|
||||||
class PayloadsController < ApplicationController
|
class PayloadsController < ApplicationController
|
||||||
layout 'windows'
|
layout 'windows'
|
||||||
|
|
||||||
|
@ -5,7 +10,16 @@ class PayloadsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def view
|
def view
|
||||||
@payloads = Payload.find_all()
|
@tmod = get_view_for_module("payload", params[:id])
|
||||||
|
|
||||||
|
unless @tmod
|
||||||
|
render_text "Unknown module specified."
|
||||||
|
end
|
||||||
|
|
||||||
|
if params[:step]
|
||||||
|
@module_step = params[:step]
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate
|
def generate
|
||||||
|
|
|
@ -19,4 +19,34 @@ module ApplicationHelper
|
||||||
return "onMouseOver=\"this.className='#{css_class_name}'\" onMouseOut=\"this.className=''\""
|
return "onMouseOver=\"this.className='#{css_class_name}'\" onMouseOut=\"this.className=''\""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Adapted from old msfweb code, returns HTML necessary for displaying icons
|
||||||
|
# associated with a specific module.
|
||||||
|
# Added missing platform icons (HPUX, Irix, etc).
|
||||||
|
def module_platform_icons(platform)
|
||||||
|
return "" if (platform.nil?)
|
||||||
|
|
||||||
|
# If this module has no platforms, then we don't show any icons...
|
||||||
|
return "" if (platform.empty?)
|
||||||
|
|
||||||
|
# Otherwise, get the platform specific information...
|
||||||
|
html = ""
|
||||||
|
[
|
||||||
|
[ Msf::Module::Platform::Windows, "windows.png", "win32" ],
|
||||||
|
[ Msf::Module::Platform::Linux, "linux.png", "linux" ],
|
||||||
|
[ Msf::Module::Platform::Solaris, "sun.png", "solaris" ],
|
||||||
|
[ Msf::Module::Platform::OSX, "apple.png", "osx" ],
|
||||||
|
[ Msf::Module::Platform::BSD, "bsd.gif", "bsd" ],
|
||||||
|
[ Msf::Module::Platform::BSDi, "bsd.gif", "bsdi" ],
|
||||||
|
[ Msf::Module::Platform::HPUX, "hp.png", "hpux" ],
|
||||||
|
[ Msf::Module::Platform::Irix, "sgi.png", "irix" ],
|
||||||
|
[ Msf::Module::Platform::Unix, "unix.png", "unix" ]
|
||||||
|
].each do |plat|
|
||||||
|
if (platform.supports?(Msf::Module::PlatformList.new(plat[0])) == true)
|
||||||
|
html += "<img src=\"/images/platform-icons/#{plat[1]}\" alt=\"#{plat[2]}\"/>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return html
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,52 +1,31 @@
|
||||||
<style type="text/css">
|
|
||||||
|
|
||||||
p.moduleNameX {
|
|
||||||
padding: 6px;
|
|
||||||
color: #222222;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
background: #eeeeee;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
p.moduleDescX {
|
|
||||||
color: #333333;
|
|
||||||
text-align: justify;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<table align="center" width="100%" cellspacing="0" cellpadding="15" border="0">
|
<table align="center" width="100%" cellspacing="0" cellpadding="15" border="0">
|
||||||
|
|
||||||
<tr width="100%" align='center'>
|
<tr width="100%" align="center">
|
||||||
<p class="moduleNameX">
|
<p class="moduleName">
|
||||||
<%= html_escape(@tmod.name) %>
|
<%= html_escape(@tmod.name) %>
|
||||||
</p>
|
</p>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr width="100%" align='center'>
|
<tr width="100%" align="center">
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p class="moduleDescX">
|
<p class="moduleDesc">
|
||||||
<%= html_escape(@tmod.description) %>
|
<%= html_escape(@tmod.description) %>
|
||||||
</p>
|
</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<tr width="100%" align='center'>
|
<tr width="100%" align="center">
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p class="moduleDescX">
|
<p class="moduleDesc">
|
||||||
This module was provided by
|
This module was provided by <%= @tmod.author.join(' and ') %>.
|
||||||
<%= @tmod.author.join(' and ') %>
|
</p>
|
||||||
</p>
|
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr width="100%" align='center'>
|
<tr width="100%" align="center">
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p class="moduleDescX">
|
<p class="moduleDesc">
|
||||||
External references:
|
External references:
|
||||||
<ul>
|
<ul>
|
||||||
<% @tmod.references.each { |ref| %>
|
<% @tmod.references.each { |ref| %>
|
||||||
|
@ -61,9 +40,9 @@ p.moduleDescX {
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr width="100%" align='center'>
|
<tr width="100%" align="center">
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p class="moduleDescX">
|
<p class="moduleDesc">
|
||||||
Available targets:
|
Available targets:
|
||||||
<ul>
|
<ul>
|
||||||
<% @tmod.targets.each_with_index { |tgt, idx| %>
|
<% @tmod.targets.each_with_index { |tgt, idx| %>
|
||||||
|
@ -75,71 +54,4 @@ p.moduleDescX {
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
<table align="center" width="95%" cellspacing="0" cellpadding="6" border="0">
|
|
||||||
<tr width="100%">
|
|
||||||
<p class="moduleName">
|
|
||||||
<%= html_escape(@tmod.name) %>
|
|
||||||
</p>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align="right" width="80" class="moduleFieldTitle">Authors:</td>
|
|
||||||
<td class="moduleFieldDescription">
|
|
||||||
<ul>
|
|
||||||
<% @tmod.author.each do |a| %>
|
|
||||||
<li><%= html_escape(a) %></li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align="right" width="80" valign="top" class="moduleFieldTitle">Description:</td>
|
|
||||||
<td colspan="2" valign="top" class="moduleFieldDescription">
|
|
||||||
<%= html_escape(@tmod.description) %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align="right" width="80" valign="top" class="moduleFieldTitle">References:</td>
|
|
||||||
<td colspan="2" valign="top" class="moduleFieldDescription">
|
|
||||||
<% @tmod.references.each { |ref| %>
|
|
||||||
<% if (ref.kind_of?(Msf::Module::SiteReference)) %>
|
|
||||||
- <a href="<%= ref.site %>"><%= ref.to_s %></a><br/>
|
|
||||||
<% else %>
|
|
||||||
- <%= ref.to_s %><br/>
|
|
||||||
<% end %>
|
|
||||||
<% } %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align="right" width="80" class="moduleFieldTitle">Targets:</td>
|
|
||||||
<td> </td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td> </td>
|
|
||||||
<td>
|
|
||||||
<table align="align" cellpadding="2" cellspacing="0" border="0" class="moduleFieldDescription">
|
|
||||||
<tr>
|
|
||||||
<td>Target Name</td>
|
|
||||||
<td>Platform</td>
|
|
||||||
</tr>
|
|
||||||
<% @tmod.targets.each_with_index { |tgt, idx| %>
|
|
||||||
<tr>
|
|
||||||
<td class="target<%= (idx % 2 == 0) ? "B" : "A" %>" align="left">
|
|
||||||
<%= idx %> - <a href='#'><%= tgt.name %></a>
|
|
||||||
</td>
|
|
||||||
<td class="target<%= (idx % 2 == 0) ? "B" : "A" %>" align="left">
|
|
||||||
#ICON#
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% } %>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
|
@ -2,18 +2,23 @@
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Modules</th>
|
<th colspan="2">Modules</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @results.each do |m| %>
|
<% @results.each do |m| %>
|
||||||
<tr class="itemTitle">
|
<tr>
|
||||||
<td class="itemTitle">
|
<td class="itemTitle">
|
||||||
<a onClick="window.parent.openModuleWindow('<%= @module_type %>', '<%= m.refname.gsub('/', ':') %>', '<%= m.name.gsub('"','').gsub("'","") %>')" href="#"><%= h(m.name) %></a>
|
<a onClick="window.parent.openModuleWindow('<%= @module_type %>', '<%= m.refname.gsub('/', ':') %>', '<%= m.name.gsub('"','').gsub("'","") %>')" href="#"><%= h(m.name) %></a>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<% if m.platform %>
|
||||||
|
<%= module_platform_icons(m.platform) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="itemDescription">
|
<tr class="itemDescription">
|
||||||
<td class="itemDescription"><%= m.description %></td>
|
<td colspan="2" class="itemDescription"><%= m.description %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -1,50 +1,49 @@
|
||||||
<%
|
<table align="center" width="100%" cellspacing="0" cellpadding="2" border="0" class="moduleInfo">
|
||||||
|
|
||||||
modidx = (params[:id] || 0).to_i
|
|
||||||
modinst = @payloads[modidx]
|
|
||||||
%>
|
|
||||||
|
|
||||||
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="moduleIcons" align="center">
|
<p class="moduleName">
|
||||||
|
<span class="moduleIcons">
|
||||||
</td>
|
<%= module_platform_icons(@tmod.platform) %>
|
||||||
<td class="moduleName">
|
</span>
|
||||||
<div class="textBold"><%= html_escape(modinst.name) %></div>
|
<%= html_escape(@tmod.name) %>
|
||||||
</td>
|
</p>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
|
||||||
<br/>
|
<tr>
|
||||||
|
<blockquote>
|
||||||
<table align="center" width="95%" cellspacing="0" cellpadding="6" border="0">
|
<p class="moduleDesc">
|
||||||
<tr>
|
<%= html_escape(@tmod.description) %>
|
||||||
<td align="right" width="80">Name:</td>
|
</p>
|
||||||
<td><%= html_escape(modinst.name) %></td>
|
</blockquote>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td align="right" width="80">Version:</td>
|
<tr>
|
||||||
<td><%= html_escape(modinst.version) %></td>
|
<blockquote>
|
||||||
</tr>
|
<p class="moduleDesc">
|
||||||
<tr>
|
This module was provided by <%= @tmod.author.join(' and ') %>.
|
||||||
<td align="right" width="80" valign="top">Authors:</td>
|
</p>
|
||||||
<td><%= modinst.author.map { |x| html_escape(x) }.join("<br/>") %></td>
|
</blockquote>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td align="right" width="80" valign="top">Description:</td>
|
<tr>
|
||||||
<td colspan="2" valign="top">
|
<td>Version:</td>
|
||||||
<%= html_escape(modinst.description) %>
|
<td><%= @tmod.version %></td>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right" width="80">Size:</td>
|
<td>Size:</td>
|
||||||
<td><%= modinst.generate.length %></td>
|
<td><%= @tmod.generate.length %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td align="right" width="80">Arch:</td>
|
<tr>
|
||||||
<td><%= modinst.arch_to_s %></td>
|
<td>Architecture:</td>
|
||||||
</tr>
|
<td><%= @tmod.arch_to_s %></td>
|
||||||
<tr>
|
</tr>
|
||||||
<td align="right" width="80">OS:</td>
|
|
||||||
<td><%= modinst.platform_to_s %></td>
|
<tr>
|
||||||
</tr>
|
<td>Operating system:</td>
|
||||||
|
<td><%= @tmod.platform_to_s %></td>
|
||||||
|
</tr>
|
||||||
|
</div>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 595 B |
Binary file not shown.
Before Width: | Height: | Size: 646 B After Width: | Height: | Size: 949 B |
Binary file not shown.
After Width: | Height: | Size: 566 B |
|
@ -19,8 +19,7 @@ table {
|
||||||
background: #FAFAFA;
|
background: #FAFAFA;
|
||||||
}
|
}
|
||||||
|
|
||||||
table .itemTitle,
|
table .itemTitle {
|
||||||
table .moduleFieldTitle {
|
|
||||||
background: #666666 url(/images/bullet_go.png) left no-repeat;
|
background: #666666 url(/images/bullet_go.png) left no-repeat;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
|
@ -40,8 +39,7 @@ table .itemTitle a:hover {
|
||||||
font-size: 9pt;
|
font-size: 9pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
table .itemDescription,
|
table .itemDescription {
|
||||||
table .moduleFieldDescription {
|
|
||||||
background: #EDEDED;
|
background: #EDEDED;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
|
@ -57,16 +55,23 @@ table .itemDescription:hover {
|
||||||
border: 1px solid #444;
|
border: 1px solid #444;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.moduleName {
|
table.moduleInfo tr td {
|
||||||
background: #666666 url(/images/bug.png) left no-repeat;
|
|
||||||
color: #fff;
|
|
||||||
padding: 6px;
|
|
||||||
padding-left: 16px;
|
|
||||||
text-align: center;
|
|
||||||
border: 1px solid #AAAAAA;
|
|
||||||
}
|
|
||||||
|
|
||||||
table .moduleFieldName {
|
|
||||||
background: #ddd;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.moduleName {
|
||||||
|
padding: 6px;
|
||||||
|
color: #222222;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
background: #eeeeee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.moduleIcons {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.moduleDesc {
|
||||||
|
color: #333333;
|
||||||
|
text-align: justify;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue