From 03fb9ae3766e7271cafa0232901acf7fc1176d80 Mon Sep 17 00:00:00 2001 From: lmh <> Date: Fri, 29 Sep 2006 13:53:51 +0000 Subject: [PATCH] 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-b9f4589650da --- data/msfweb/app/controllers/application.rb | 38 ++++++ .../app/controllers/auxiliaries_controller.rb | 10 ++ .../app/controllers/encoders_controller.rb | 10 ++ .../app/controllers/exploits_controller.rb | 10 +- .../msfweb/app/controllers/nops_controller.rb | 11 +- .../app/controllers/payloads_controller.rb | 16 ++- data/msfweb/app/helpers/application_helper.rb | 30 +++++ data/msfweb/app/views/exploits/view.rhtml | 116 +++--------------- data/msfweb/app/views/msf/search.rhtml | 11 +- data/msfweb/app/views/payloads/view.rhtml | 95 +++++++------- .../public/images/platform-icons/bsd.gif | Bin 0 -> 595 bytes .../public/images/platform-icons/hp.png | Bin 646 -> 949 bytes .../public/images/platform-icons/unix.png | Bin 0 -> 566 bytes data/msfweb/public/stylesheets/windows.css | 35 +++--- 14 files changed, 203 insertions(+), 179 deletions(-) create mode 100644 data/msfweb/public/images/platform-icons/bsd.gif create mode 100644 data/msfweb/public/images/platform-icons/unix.png diff --git a/data/msfweb/app/controllers/application.rb b/data/msfweb/app/controllers/application.rb index 505b069e9f..375e02935f 100644 --- a/data/msfweb/app/controllers/application.rb +++ b/data/msfweb/app/controllers/application.rb @@ -1,7 +1,12 @@ +# Author: HDM and L.M.H +# 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. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base + # Search functionality for modules def search_modules(mlist, terms) res = {} @@ -38,4 +43,37 @@ class ApplicationController < ActionController::Base list 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 diff --git a/data/msfweb/app/controllers/auxiliaries_controller.rb b/data/msfweb/app/controllers/auxiliaries_controller.rb index 3872d99e39..6123a8337e 100644 --- a/data/msfweb/app/controllers/auxiliaries_controller.rb +++ b/data/msfweb/app/controllers/auxiliaries_controller.rb @@ -1,3 +1,8 @@ +# Author: L.M.H +# 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 layout 'windows' @@ -5,6 +10,11 @@ class AuxiliariesController < ApplicationController end def view + @tmod = get_view_for_module("auxiliary", params[:id]) + + unless @tmod + render_text "Unknown module specified." + end end def run diff --git a/data/msfweb/app/controllers/encoders_controller.rb b/data/msfweb/app/controllers/encoders_controller.rb index a7692868bc..6555f46dbf 100644 --- a/data/msfweb/app/controllers/encoders_controller.rb +++ b/data/msfweb/app/controllers/encoders_controller.rb @@ -1,3 +1,8 @@ +# Author: L.M.H +# 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 layout 'windows' @@ -5,6 +10,11 @@ class EncodersController < ApplicationController end def view + @tmod = get_view_for_module("encoder", params[:id]) + + unless @tmod + render_text "Unknown module specified." + end end def encode diff --git a/data/msfweb/app/controllers/exploits_controller.rb b/data/msfweb/app/controllers/exploits_controller.rb index ce418df2b4..53ba8cbbfd 100644 --- a/data/msfweb/app/controllers/exploits_controller.rb +++ b/data/msfweb/app/controllers/exploits_controller.rb @@ -10,15 +10,7 @@ class ExploitsController < ApplicationController end def view - @exploits = Exploit.find_all() - if params[:id] - @exploits.each do |m| - if m.refname.gsub('/', ':') == params[:id] - @tmod = m - break - end - end - end + @tmod = get_view_for_module("exploit", params[:id]) unless @tmod render_text "Unknown module specified." diff --git a/data/msfweb/app/controllers/nops_controller.rb b/data/msfweb/app/controllers/nops_controller.rb index 34ca679988..9616f82b69 100644 --- a/data/msfweb/app/controllers/nops_controller.rb +++ b/data/msfweb/app/controllers/nops_controller.rb @@ -1,3 +1,8 @@ +# Author: L.M.H +# 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 layout 'windows' @@ -5,7 +10,11 @@ class NopsController < ApplicationController end def view - @nops = Nop.find_all() + @tmod = get_view_for_module("nop", params[:id]) + + unless @tmod + render_text "Unknown module specified." + end end def generate diff --git a/data/msfweb/app/controllers/payloads_controller.rb b/data/msfweb/app/controllers/payloads_controller.rb index 90a6295f3e..7e141e6a31 100644 --- a/data/msfweb/app/controllers/payloads_controller.rb +++ b/data/msfweb/app/controllers/payloads_controller.rb @@ -1,3 +1,8 @@ +# Author: L.M.H +# 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 layout 'windows' @@ -5,7 +10,16 @@ class PayloadsController < ApplicationController end 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 def generate diff --git a/data/msfweb/app/helpers/application_helper.rb b/data/msfweb/app/helpers/application_helper.rb index b1e9d3843e..b3410adc50 100644 --- a/data/msfweb/app/helpers/application_helper.rb +++ b/data/msfweb/app/helpers/application_helper.rb @@ -19,4 +19,34 @@ module ApplicationHelper return "onMouseOver=\"this.className='#{css_class_name}'\" onMouseOut=\"this.className=''\"" 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 += "\"#{plat[2]}\"/" + end + end + + return html + end + end diff --git a/data/msfweb/app/views/exploits/view.rhtml b/data/msfweb/app/views/exploits/view.rhtml index ec15a20d76..b12a722ad0 100644 --- a/data/msfweb/app/views/exploits/view.rhtml +++ b/data/msfweb/app/views/exploits/view.rhtml @@ -1,52 +1,31 @@ - - - -

+

+

<%= html_escape(@tmod.name) %>

- +
-

- <%= html_escape(@tmod.description) %> -

+

+ <%= html_escape(@tmod.description) %> +

- +
-

- This module was provided by - <%= @tmod.author.join(' and ') %> -

+

+ This module was provided by <%= @tmod.author.join(' and ') %>. +

- +
-

+

External references:

    <% @tmod.references.each { |ref| %> @@ -61,9 +40,9 @@ p.moduleDescX {
- +
-

+

Available targets:

    <% @tmod.targets.each_with_index { |tgt, idx| %> @@ -75,71 +54,4 @@ p.moduleDescX {
- -
- - diff --git a/data/msfweb/app/views/msf/search.rhtml b/data/msfweb/app/views/msf/search.rhtml index c5696ea261..69813be1ac 100644 --- a/data/msfweb/app/views/msf/search.rhtml +++ b/data/msfweb/app/views/msf/search.rhtml @@ -2,18 +2,23 @@ - + <% @results.each do |m| %> - + + - + <% end %> diff --git a/data/msfweb/app/views/payloads/view.rhtml b/data/msfweb/app/views/payloads/view.rhtml index 1ffa40dafc..31ce4b4571 100644 --- a/data/msfweb/app/views/payloads/view.rhtml +++ b/data/msfweb/app/views/payloads/view.rhtml @@ -1,50 +1,49 @@ -<% - - modidx = (params[:id] || 0).to_i - modinst = @payloads[modidx] -%> - -
ModulesModules
')" href="#"><%= h(m.name) %> + <% if m.platform %> + <%= module_platform_icons(m.platform) %> + <% end %> +
<%= m.description %><%= m.description %>
+
+ - - - -
- - -
<%= html_escape(modinst.name) %>
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +

+ + <%= module_platform_icons(@tmod.platform) %> + + <%= html_escape(@tmod.name) %> +

+ + + +
+

+ <%= html_escape(@tmod.description) %> +

+
+ + + +
+

+ This module was provided by <%= @tmod.author.join(' and ') %>. +

+
+ + + + + + + + + + + + + + + + + + + + + + +
Name:<%= html_escape(modinst.name) %>
Version:<%= html_escape(modinst.version) %>
Authors:<%= modinst.author.map { |x| html_escape(x) }.join("
") %>
Description: - <%= html_escape(modinst.description) %> -
Size:<%= modinst.generate.length %>
Arch:<%= modinst.arch_to_s %>
OS:<%= modinst.platform_to_s %>
Version:<%= @tmod.version %>
Size:<%= @tmod.generate.length %>
Architecture:<%= @tmod.arch_to_s %>
Operating system:<%= @tmod.platform_to_s %>
diff --git a/data/msfweb/public/images/platform-icons/bsd.gif b/data/msfweb/public/images/platform-icons/bsd.gif new file mode 100644 index 0000000000000000000000000000000000000000..c78f01a4c3182fa3641b231e8a4423e81c87a0fc GIT binary patch literal 595 zcmZ?wbhEHb~peOYOOcZ$<(e`GbbV}F(G!or)76^5`qb2nf|7>x)PjP%g5rYW z;==S6pOv{uGpdv4loc;8kMC}*-&&N_+1c6K*}AZ)ZrYSd%O_1*H?eo_+&Q}zL~NWn zegEvzMT-_~Ssr(IPUW(d?Q2%9ShZ@^*5!-VtX;Eh&FYOC)^6UkVb_NBd$&$Lzp4Ao zhSg{G?LBj3;n~C6&mGxv{n&~tr%s$Xcj5fGbC)k)zIFBL-J7Q$-9CTs{=LT!A3lBj z_{r0!&!0Yd@$%KnmoMJDe*O0C+YcW;eEj&~%a<=-zkd7n^~<+!-@XIEk8eMI{P^_? zh<^S4{rk_KKYu|O0{#KPe+UFp*nr|cQRkx6#FEq$h4Rdj426)4R0VfW-v9<31|R@M z5(E4EhRUXr_|nQWkIbg-CQplG7dvg!oSw>JRV8UoH4VksX{GK=Y$Cq)h6&Ru3v3v~ zoH+RWvdgDMGxExbN*ViPRP>ZOu=0qj+d2m1PIKj#RS+Jot%)iNP8GEo&u6 literal 0 HcmV?d00001 diff --git a/data/msfweb/public/images/platform-icons/hp.png b/data/msfweb/public/images/platform-icons/hp.png index d0a68b83703742903be881dcd7306e75a5fd54b6..8623b66098155f7df472447ac445a76c3cd34ad7 100644 GIT binary patch delta 936 zcmV;Z16TZp1+@nuiBL{Q4GJ0x0000DNk~Le0000G0000G2nGNE03Y-JVUZyme+v@; z01FcV0GgZ_00007bV*G`2i6H42opJ%DIkLY00TlvL_t(I%T1F_OxtxB$3MTm@-HpW zmMTLKN;f-(O${mn8LKi6B{AY#vgnc>6b~jQCdSLi%*GBLJZNH^-kh7+VbP0;QHE~I zL~%n9Vi_Byq=i}9^(Ay&-~a9ZfA66z`n`P*-zQJL&*u^0>`u24WIYHYpsJX4I)heG zs%W+PR#jDYs>v<;2B-pMz#%%uKS|gjY=Hr54a^pmF~5`9**N~O&iQco-oT%W zF$xt8RK#tKh6l0(2so+My^7my;H@|NNQ(^TFK+VH$A_^sS_lNU_;LOYe^-7=lG#w| zv0Z85xl;gMuaT*#eqK8=%-OGR(xg>*XTryR_gWk~ptBm^XJn40! z(;K)nw?aBu|Q5hM0gk#6t96!EHwW^{sOYo}CO`D^Q zTp`b|m+x?}-wLq`pDnClYuEDS7pn~UtxVrclewGZ-4BL&sP`7zfifD&XryaTJCe!7 z+D4S6V4B{cW>RH^r`#59{T&B8^!7I*p>W98hTGMFr`rg-H{I=2f91+_5Fvw2=t+mG z_y(;k{*}Vxwh)RGk#&OppuO(nUX&2o8m9q)j|@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