@@ -70,6 +70,12 @@ def googlevoice_accounts(files_found, report_folder, seeker, wrap_text):
7070 data_list = []
7171 source_path = ""
7272
73+ account_number = ""
74+ full_name = ""
75+ email_address = ""
76+ linked_number = ""
77+ voice_number = ""
78+
7379 accounts = []
7480 for file in files_found :
7581 if os .path .basename (file ).endswith ("VoiceAccountCache.db" ):
@@ -157,6 +163,7 @@ def googlevoice_calls(files_found, report_folder, seeker, wrap_text):
157163 for file in files_found :
158164 if os .path .basename (file ) == 'LegacyMsgDbInstance.db' :
159165
166+ account_number = ""
160167 parts = file .split (os .sep )
161168 user_index = parts .index ("accounts" ) + 1
162169
@@ -184,50 +191,54 @@ def googlevoice_calls(files_found, report_folder, seeker, wrap_text):
184191 message = blackboxprotobuf .decode_message (pb )
185192
186193 # check if the entry is a call (answered, missed, outgoing)
187- # 13 = 0 for a missed or declined call
194+ # 13 = 0 for a missed or declined call without a voicemail
188195 # 13 = 1 for an answered call
189196 # 13 = 2 for an outgoing call
190197 # 22 has a value if a call was missed or declined
191- # 13 = 3 for a missed or declined call with
198+ # 13 = 3 for a received voicemail
192199 # The Google Voice welcome voicemail does not call the phone but leaves a voicemail
193200 if message [0 ]['13' ] == 0 or message [0 ]['13' ] == 1 or message [0 ]['13' ] == 2 or ('22' in message [0 ]) or (message [0 ]['13' ] == 3 and "welcome_voicemail" not in message [0 ]['1' ].decode ('utf-8' )):
194201
195202 # Timestamp
196- timestamp = message [0 ]['2' ] / 1000 # convert to seconds
197- timestamp = time .strftime ('%Y/%m/%d %H:%M:%S' , time .gmtime (timestamp )) # convert to UTC time
203+ timestamp = ""
204+ if '2' in message [0 ]:
205+ timestamp = message [0 ]['2' ] / 1000 # convert to seconds
206+ timestamp = time .strftime ('%Y/%m/%d %H:%M:%S' , time .gmtime (timestamp )) # convert to UTC time
198207
199208 # Direction
200- if message [0 ]['13' ] == 1 or ('22' in message [0 ]):
209+ direction = ""
210+ from_num = ""
211+ to_num = ""
212+ voicemail = ""
213+ if message [0 ]['13' ] == 0 or message [0 ]['13' ] == 1 or ('22' in message [0 ]) or message [0 ]['13' ] == 3 :
201214 direction = "Incoming"
202215 from_num = str (message [0 ]['4' ]['1' ].decode ('utf-8' ))
203216 to_num = message [0 ]['3' ].decode ('utf-8' ) # GV number
204217
205218 # Voicemail
206- # 13 = 3 if a voicemail was left
207219 if message [0 ]['13' ] == 3 :
208220 voicemail = "Yes"
209- else :
221+ elif message [ 0 ][ '13' ] != 1 :
210222 voicemail = "No"
211223
212224 elif message [0 ]['13' ] == 2 :
213225 direction = "Outgoing"
214226 from_num = message [0 ]['3' ].decode ('utf-8' ) # GV number
215227 to_num = message [0 ]['4' ]['1' ].decode ('utf-8' )
216228
217- # Voicemail
218- voicemail = ""
219-
220229 # Call Status
221230 call_status = ""
222- if '22' in message [0 ]:
231+ if ( '22' in message [0 ]) or message [ 0 ][ '13' ] == 3 or message [ 0 ][ '13' ] == 0 :
223232 call_status = "Missed"
224233 elif message [0 ]['13' ] == 1 :
225234 call_status = "Answered"
226235
227236 # Duration
228- duration = message [0 ]['9' ]
229- duration = struct .unpack ('f' , struct .pack ('I' , duration ))[0 ] # convert int32 value to a float
230- duration = time .strftime ("%H:%M:%S" , time .gmtime (duration )) # convert seconds to Hours:Minutes:Seconds
237+ duration = ""
238+ if '9' in message [0 ]:
239+ duration = message [0 ]['9' ]
240+ duration = struct .unpack ('f' , struct .pack ('I' , duration ))[0 ] # convert int32 value to a float
241+ duration = time .strftime ("%H:%M:%S" , time .gmtime (duration )) # convert seconds to Hours:Minutes:Seconds
231242
232243 # Recording
233244 # 23 has values if an incoming call was recorded
@@ -270,6 +281,7 @@ def googlevoice_voicemails(files_found, report_folder, seeker, wrap_text):
270281 for file in files_found :
271282 if os .path .basename (file ) == 'LegacyMsgDbInstance.db' :
272283
284+ account_number = ""
273285 parts = file .split (os .sep )
274286 user_index = parts .index ("accounts" ) + 1
275287
@@ -301,21 +313,30 @@ def googlevoice_voicemails(files_found, report_folder, seeker, wrap_text):
301313 if message [0 ]['13' ] == 3 :
302314
303315 # Timestamp
304- timestamp = message [0 ]['2' ] / 1000 # convert to seconds
305- timestamp = time .strftime ('%Y/%m/%d %H:%M:%S' , time .gmtime (timestamp )) # convert to UTC time
316+ timestamp = ""
317+ if '2' in message [0 ]:
318+ timestamp = message [0 ]['2' ] / 1000 # convert to seconds
319+ timestamp = time .strftime ('%Y/%m/%d %H:%M:%S' , time .gmtime (timestamp )) # convert to UTC time
306320
307321 # Caller
308- from_num = str (message [0 ]['4' ]['1' ].decode ('utf-8' ))
322+ from_num = ""
323+ if '4' in message [0 ] and '1' in message [0 ]['4' ]:
324+ from_num = str (message [0 ]['4' ]['1' ].decode ('utf-8' ))
309325
310326 # Recipient
311- to_num = message [0 ]['3' ].decode ('utf-8' ) # GV number
327+ to_num = ""
328+ if '3' in message [0 ]:
329+ to_num = message [0 ]['3' ].decode ('utf-8' ) # GV number
312330
313331 # Duration
314- duration = message [0 ]['9' ]
315- duration = struct .unpack ('f' , struct .pack ('I' , duration ))[0 ] # convert int32 value to a float
316- duration = time .strftime ("%H:%M:%S" , time .gmtime (duration )) # convert seconds to Hours:Minutes:Seconds
332+ duration = ""
333+ if '9' in message [0 ]:
334+ duration = message [0 ]['9' ]
335+ duration = struct .unpack ('f' , struct .pack ('I' , duration ))[0 ] # convert int32 value to a float
336+ duration = time .strftime ("%H:%M:%S" , time .gmtime (duration )) # convert seconds to Hours:Minutes:Seconds
317337
318338 # Read Status
339+ read_status = ""
319340 if message [0 ]['6' ] == 0 :
320341 read_status = "Unread"
321342 elif message [0 ]['6' ] == 1 :
@@ -337,17 +358,16 @@ def googlevoice_voicemails(files_found, report_folder, seeker, wrap_text):
337358 transcript = "Transcript Not Available"
338359
339360 # Audio File
361+ audio = ""
340362 artifact_info = inspect .stack ()[0 ]
341363 message_id = message [0 ]['1' ].decode ('utf-8' )
342- audio = ""
343364 # get the voicemail audio file
344365 for audio_file in files_found :
345366 if "audio" in audio_file and message_id in audio_file :
346367 audio = check_in_media (artifact_info , report_folder , seeker , files_found , audio_file )
347368 break
348369
349- if timestamp :
350- data_list .append ((timestamp ,account_number ,from_num ,to_num ,duration ,read_status ,transcript ,audio ))
370+ data_list .append ((timestamp ,account_number ,from_num ,to_num ,duration ,read_status ,transcript ,audio ))
351371
352372 return data_headers , data_list , source_path
353373
@@ -371,6 +391,7 @@ def googlevoice_messages(files_found, report_folder, seeker, wrap_text):
371391 for file in files_found :
372392 if os .path .basename (file ) == 'LegacyMsgDbInstance.db' :
373393
394+ account_number = ""
374395 parts = file .split (os .sep )
375396 user_index = parts .index ("accounts" ) + 1
376397
@@ -404,16 +425,22 @@ def googlevoice_messages(files_found, report_folder, seeker, wrap_text):
404425 conversation_id = row [1 ]
405426
406427 # Timestamp
407- timestamp = message [0 ]['2' ] / 1000 # convert to seconds
408- timestamp = time .strftime ('%Y/%m/%d %H:%M:%S' , time .gmtime (timestamp )) # convert to UTC time
428+ timestamp = ""
429+ if '2' in message [0 ]:
430+ timestamp = message [0 ]['2' ] / 1000 # convert to seconds
431+ timestamp = time .strftime ('%Y/%m/%d %H:%M:%S' , time .gmtime (timestamp )) # convert to UTC time
409432
410433 # Direction
411434 # 13 = 5 when a message is received
412435 # 13 = 6 when a message is sent
436+ direction = ""
437+ from_num = ""
438+ to_num = ""
439+ read_status = ""
413440 if message [0 ]['13' ] == 5 :
414441 direction = "Incoming"
415442 from_num = message [0 ]['4' ]['1' ].decode ('utf-8' )
416- to_nums = message [0 ]['3' ].decode ('utf-8' ) # GV number
443+ to_num = message [0 ]['3' ].decode ('utf-8' ) # GV number
417444
418445 # Read Status
419446 if message [0 ]['6' ] == 0 :
@@ -424,13 +451,12 @@ def googlevoice_messages(files_found, report_folder, seeker, wrap_text):
424451 elif message [0 ]['13' ] == 6 :
425452 direction = "Outgoing"
426453 from_num = message [0 ]['3' ].decode ('utf-8' ) # GV number
427- to_nums = message [0 ]['4' ]['1' ].decode ('utf-8' )
428-
429- # Read Status
430- read_status = ""
454+ to_num = message [0 ]['4' ]['1' ].decode ('utf-8' )
431455
432456 # Message
433- message_content = message [0 ]['10' ].decode ('utf-8' )
457+ message_content = ""
458+ if '10' in message [0 ]:
459+ message_content = message [0 ]['10' ].decode ('utf-8' )
434460
435461 # Image
436462 if "MMS" in message_content :
@@ -444,15 +470,15 @@ def googlevoice_messages(files_found, report_folder, seeker, wrap_text):
444470 # filename: message_id + "-14" + extension
445471 if "Photo MMS images" in image and message_id in image and "-14" in image :
446472 thumb = check_in_media (artifact_info , report_folder , seeker , files_found , image )
447- data_list .append ((timestamp ,account_number ,conversation_id ,direction ,from_num ,to_nums ,read_status ,message_content ,thumb ))
473+ data_list .append ((timestamp ,account_number ,conversation_id ,direction ,from_num ,to_num ,read_status ,message_content ,thumb ))
448474 break
449475
450476 # if no image file is cached for the message
451477 if thumb == "" :
452- data_list .append ((timestamp ,account_number ,conversation_id ,direction ,from_num ,to_nums ,read_status ,message_content ,"" ))
478+ data_list .append ((timestamp ,account_number ,conversation_id ,direction ,from_num ,to_num ,read_status ,message_content ,"" ))
453479
454480 else :
455- data_list .append ((timestamp ,account_number ,conversation_id ,direction ,from_num ,to_nums ,read_status ,message_content ,"" ))
481+ data_list .append ((timestamp ,account_number ,conversation_id ,direction ,from_num ,to_num ,read_status ,message_content ,"" ))
456482
457483 # conversation_id starts with "g" for group chat messages
458484 elif row [1 ].startswith ("g" ):
@@ -463,16 +489,22 @@ def googlevoice_messages(files_found, report_folder, seeker, wrap_text):
463489 conversation_id = row [1 ]
464490
465491 # Timestamp
466- timestamp = message [0 ]['2' ] / 1000 # convert to seconds
467- timestamp = time .strftime ('%Y/%m/%d %H:%M:%S' , time .gmtime (timestamp )) # convert to UTC time
492+ timestamp = ""
493+ if '2' in message [0 ]:
494+ timestamp = message [0 ]['2' ] / 1000 # convert to seconds
495+ timestamp = time .strftime ('%Y/%m/%d %H:%M:%S' , time .gmtime (timestamp )) # convert to UTC time
468496
469497 # Direction
470498 # 5 exists in 15 when the message is received
499+ direction = ""
500+ from_num = ""
501+ to_nums_list = []
502+ read_status = ""
471503 if '5' in message [0 ]['15' ]:
472504 direction = "Incoming"
473505 from_num = message [0 ]['15' ]['5' ].decode ('utf-8' )
474506
475- to_nums_list = [] # GV number & other group chat members
507+ # GV number & other group chat members in to_nums_list
476508 to_nums_list .append (message [0 ]['3' ].decode ('utf-8' )) # GV number
477509 for j in range (len (message [0 ]['15' ]['4' ])):
478510 if message [0 ]['15' ]['4' ][j ]['1' ].decode ('utf-8' ) != from_num :
@@ -489,17 +521,16 @@ def googlevoice_messages(files_found, report_folder, seeker, wrap_text):
489521 direction = "Outgoing"
490522 from_num = message [0 ]['3' ].decode ('utf-8' ) # GV number
491523
492- to_nums_list = [] # other group chat members
524+ # other group chat members in to_nums_list
493525 for j in range (len (message [0 ]['15' ]['4' ])):
494526 to_nums_list .append (message [0 ]['15' ]['4' ][j ]['1' ].decode ('utf-8' ))
495527
496- # Read Status
497- read_status = ""
498-
499528 to_nums = ', ' .join (to_nums_list )
500529
501530 # Message
502- message_content = message [0 ]['15' ]['1' ].decode ('utf-8' )
531+ message_content = ""
532+ if '15' in message [0 ] and '1' in message [0 ]['15' ]:
533+ message_content = message [0 ]['15' ]['1' ].decode ('utf-8' )
503534
504535 # Image
505536 if "MMS" in message_content :
0 commit comments