@@ -15,10 +15,6 @@ module Ui
15
15
class Console ::CommandDispatcher ::Android
16
16
include Console ::CommandDispatcher
17
17
include Msf ::Auxiliary ::Report
18
-
19
- def framework
20
- client . framework
21
- end
22
18
23
19
#
24
20
# List of supported commands.
@@ -35,18 +31,17 @@ def commands
35
31
36
32
reqs = {
37
33
'dump_sms' => [ 'dump_sms' ] ,
38
- 'dump_contacts' => [ 'dump_contacts' ] ,
39
- 'geolocate' => [ 'geolocate' ] ,
40
- 'dump_calllog' => [ 'dump_calllog' ] ,
41
- 'check_root' => [ 'check_root' ] ,
34
+ 'dump_contacts' => [ 'dump_contacts' ] ,
35
+ 'geolocate' => [ 'geolocate' ] ,
36
+ 'dump_calllog' => [ 'dump_calllog' ] ,
37
+ 'check_root' => [ 'check_root' ] ,
42
38
'device_shutdown' => [ 'device_shutdown' ]
43
39
}
44
40
41
+ # Ensure any requirements of the command are met
45
42
all . delete_if do |cmd , desc |
46
43
reqs [ cmd ] . any? { |req | not client . commands . include? ( req ) }
47
44
end
48
-
49
- all
50
45
end
51
46
52
47
def cmd_device_shutdown ( *args )
@@ -55,7 +50,7 @@ def cmd_device_shutdown(*args)
55
50
device_shutdown_opts = Rex ::Parser ::Arguments . new (
56
51
'-h' => [ false , 'Help Banner' ] ,
57
52
'-t' => [ false , 'Shutdown after n seconds' ]
58
- )
53
+ )
59
54
60
55
device_shutdown_opts . parse ( args ) { | opt , idx , val |
61
56
case opt
@@ -98,15 +93,15 @@ def cmd_dump_sms(*args)
98
93
end
99
94
}
100
95
101
- smsList = Array . new
96
+ smsList = [ ]
102
97
smsList = client . android . dump_sms
103
98
104
99
if smsList . count > 0
105
100
print_status ( "Fetching #{ smsList . count } sms #{ smsList . count == 1 ? 'message' : 'messages' } " )
106
101
begin
107
102
info = client . sys . config . sysinfo
108
103
109
- data = String :: new
104
+ data = ""
110
105
data << "\n =====================\n "
111
106
data << "[+] Sms messages dump\n "
112
107
data << "=====================\n \n "
@@ -191,15 +186,15 @@ def cmd_dump_contacts(*args)
191
186
end
192
187
}
193
188
194
- contactList = Array . new
189
+ contactList = [ ]
195
190
contactList = client . android . dump_contacts
196
191
197
192
if contactList . count > 0
198
193
print_status ( "Fetching #{ contactList . count } #{ contactList . count == 1 ? 'contact' : 'contacts' } into list" )
199
194
begin
200
195
info = client . sys . config . sysinfo
201
196
202
- data = String :: new
197
+ data = ""
203
198
data << "\n ======================\n "
204
199
data << "[+] Contacts list dump\n "
205
200
data << "======================\n \n "
@@ -273,7 +268,6 @@ def cmd_geolocate(*args)
273
268
print_line ( "\t Longitude: #{ geo [ 0 ] [ 'long' ] } \n " )
274
269
print_line ( "To get the address: https://maps.googleapis.com/maps/api/geocode/json?latlng=#{ geo [ 0 ] [ 'lat' ] . to_f } ,#{ geo [ 0 ] [ 'long' ] . to_f } &sensor=true\n " )
275
270
276
-
277
271
if generate_map
278
272
link = "https://maps.google.com/maps?q=#{ geo [ 0 ] [ 'lat' ] . to_f } ,#{ geo [ 0 ] [ 'long' ] . to_f } "
279
273
print_status ( "Generated map on google-maps:" )
@@ -312,7 +306,7 @@ def cmd_dump_calllog(*args)
312
306
begin
313
307
info = client . sys . config . sysinfo
314
308
315
- data = String :: new
309
+ data = ""
316
310
data << "\n =================\n "
317
311
data << "[+] Call log dump\n "
318
312
data << "=================\n \n "
@@ -368,7 +362,7 @@ def cmd_check_root(*args)
368
362
is_rooted = client . android . check_root
369
363
370
364
if is_rooted
371
- print_status ( 'Device is rooted' )
365
+ print_good ( 'Device is rooted' )
372
366
elsif
373
367
print_status ( 'Device is not rooted' )
374
368
end
0 commit comments