Skip to content

Instantly share code, notes, and snippets.

@wchen-r7
Created December 9, 2015 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wchen-r7/3d8b95aa9f3e14df8d65 to your computer and use it in GitHub Desktop.
Save wchen-r7/3d8b95aa9f3e14df8d65 to your computer and use it in GitHub Desktop.
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
load "./lib/msf/core/exploit/exe.rb"
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = NormalRanking
include Msf::Exploit::EXE
def initialize(info = {})
super(update_info(info,
'Name' => 'generate_payload_exe Test',
'Description' => %q{
generate_payload_exe test
},
'Author' => [ 'sinn3r' ],
'License' => MSF_LICENSE,
'Platform' => 'linux',
'Arch' => ARCH_X86,
'References' => [ ['URL', 'http://metasploit.com'] ],
'DisclosureDate' => 'Dec 8 2015',
'Targets' =>
[
[ 'Default', {} ],
[ 'Windows', { 'Platform' => 'win', 'Arch' => ARCH_X86 }],
[ 'Linux', { 'Platform' => 'linux', 'Arch' => ARCH_X86 }],
[ 'OSX', { 'Platform' => 'osx', 'Arch' => ARCH_X86 }],
],
'DefaultTarget' => 0
))
end
def exploit
exe = generate_payload_exe
case exe
when /^MZ/
print_status("This is a Windows binary.")
when /.ELF/
print_status("This is a Linux binary.")
when /__PAGEZERO/
print_status("This is an OS X binary")
else
print_status("Something else:")
print_line(Rex::Text.to_hex_dump(exe))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment