Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main(self):
self.process_convos()
table = 'Messages'
kw = {'order_by': 'timestamp', 'where': {'chatmsg_type': 3}}
for i in self.sql_table_as_dict(table, **kw):
i['identity'] = self.convos.get(i['convo_id'], '')
i['chatmsg_status'] = self.skype_msg_type(i['chatmsg_status'])
i['type'] = 'Inbox' if i['author'] == i['identity'] else 'Sentbox'
i['timestamp'] = self.unix_to_time(i['timestamp'])
# i['timestamp__ms'] = self.unix_to_time_ms(i['timestamp__ms'])
self.DATA.append(i)
# -----------------------------------------------------------------------------
class SkypeMessagesDecoder(AndroidDecoder):
RETARGET = '*.db'
NAMESPACE = 'db'
PACKAGE = 'com.skype.raider'
exclude_from_decoding = True
def __init__(self, work_dir, input_file, **kwargs):
self.owner = None
self.owners = {}
self.users = {}
super().__init__(work_dir, input_file, **kwargs)
self.template_name = 'skype_messages.html'
self.title = 'Skype Messages'
self.Titles = {
'_id': 'Index',
'x_sender': 'Sender',
'x_conversation': 'Conversation',
@property
def target_path_ab(self):
return f'apps/com.android.providers.settings/f/{self.TARGET}'
@property
def target_path_posix(self):
return f'/data/misc/wifi/{self.TARGET}'
class WifiPasswordsAbDecoder(WifiPasswordsDecoder):
TARGET = 'flattened-data'
exclude_from_menus = True
# -----------------------------------------------------------------------------
class WebViewDecoder(AndroidDecoder):
TARGET = 'webview.db'
NAMESPACE = 'db'
PACKAGE = 'com.android.browser'
def __init__(self, work_dir, input_file, **kwargs):
super().__init__(work_dir, input_file, **kwargs)
self.template_name = 'web_passwords.html'
self.title = 'WebView Browser Passwords'
self.Titles = {
'_id': 'Index',
'host': 'Host',
'username': 'Username',
'password': 'Password',
}
def main(self):
target_is_db = True
def __init__(self, work_dir, input_file, **kwargs):
super().__init__(work_dir, input_file, **kwargs)
self.title = 'Google Chrome History'
def main(self):
table = 'urls'
for i in self.sql_table_as_dict(table, order_by='last_visit_time'):
i['date'] = self.webkit_to_time(i['last_visit_time'])
i['visits'] = i['visit_count']
self.DATA.append(i)
# -----------------------------------------------------------------------------
class ChromePasswordsDecoder(AndroidDecoder):
TARGET = 'Login Data'
NAMESPACE = 'app_chrome/Default'
PACKAGE = 'com.android.chrome'
target_is_db = True
def __init__(self, work_dir, input_file, **kwargs):
super().__init__(work_dir, input_file, **kwargs)
self.template_name = 'chrome_passwords.html'
self.title = 'Google Chrome Passwords'
self.Titles = {
'_id': 'Index',
'origin_url': 'URL',
'username_value': 'Username',
'password_value': 'Password',
'date_created': 'Date created',
}
'status': 'Status',
'lastmod': 'Time',
}
def main(self):
table = 'downloads'
kw = {'order_by': 'lastmod'}
for i in self.sql_table_as_dict(table, **kw):
i['total_size'] = utils.human_bytes(i['total_bytes'])
i['status'] = self.http_status(i['status'])
i['lastmod'] = self.unix_to_time_ms(i['lastmod'])
self.DATA.append(i)
# -----------------------------------------------------------------------------
class AndroidCalendarDecoder(AndroidDecoder):
TARGET = 'calendar.db'
NAMESPACE = 'db'
PACKAGE = 'com.android.providers.calendar'
def __init__(self, work_dir, input_file, **kwargs):
self.accounts = {}
super().__init__(work_dir, input_file, **kwargs)
self.template_name = 'calendar.html'
self.title = 'Android Calendar'
self.Titles = {
'_id': 'Index',
'title': 'Title',
'eventLocation': 'Location',
'description': 'Description',
'lastDate': 'Time',
'dtstart': 'Start',
'type': 'Type',
'date': 'Time',
}
def main(self):
table = 'logs'
kw = {'order_by': 'date', 'where': {'logtype': 300}}
for i in self.sql_table_as_dict(table, **kw):
i['type'] = self.sms_type(i['type'])
i['number'] = self.parse_number(i['number'])
i['date'] = self.unix_to_time_ms(i['date'])
self.DATA.append(i)
# -----------------------------------------------------------------------------
class SMSMMSDecoder(AndroidDecoder):
TARGET = 'mmssms.db'
NAMESPACE = 'db'
PACKAGE = 'com.android.providers.telephony'
def __init__(self, work_dir, input_file, **kwargs):
super().__init__(work_dir, input_file, **kwargs)
self.template_name = 'sms_messages.html'
self.title = 'SMS Messages'
self.Titles = {
'_id': 'Index',
'address': 'Number',
'body': 'Message',
'date': 'Time',
'type': 'Type'
}
return 'Unknown'
def main(self):
table = 'messages'
kw = {'where': {'media_wa_type': 8}, 'order_by': 'timestamp'}
for i in self.sql_table_as_dict(table, **kw):
i['number'] = self.num(i['key_remote_jid'])
# IDEA: try getting name from wa.db?
i['date'] = self.unix_to_time_ms(i['timestamp'])
i['type'] = self.call_type(i['key_from_me'], i['media_duration'])
i['duration'] = self.duration(i['media_duration'])
self.DATA.append(i)
# -----------------------------------------------------------------------------
class WhatsAppMessagesDecoder(AndroidDecoder):
TARGET = 'msgstore.db'
NAMESPACE = 'db'
PACKAGE = 'com.whatsapp'
def __init__(self, work_dir, input_file, **kwargs):
self.owner = '(This device)'
self.parts = collections.defaultdict(list)
self.thumbs = {}
super().__init__(work_dir, input_file, **kwargs)
self.template_name = 'whatsapp_messages.html'
self.title = 'WhatsApp Messages'
self.Titles = {
'_id': 'Index',
'sender': 'Sender',
'x_recipients': 'Recipient(s)',
'x_message': 'Message',
self.DICT = collections.ChainMap(*[self.name_val(d) for d in data_])
keys_ = {
'bluetooth_address': 'Bluetooth MAC',
'bluetooth_name': 'Bluetooth Name',
'android_id': 'Android ID',
'lockscreen.password_salt': 'Lockscreen Salt',
}
for key, name in keys_.items():
if key in self.DICT:
item = self.DICT[key]
# item['text'] = name
self.DATA.append(item)
# -----------------------------------------------------------------------------
class LocksettingsDecoder(AndroidDecoder):
TARGET = 'locksettings.db'
target_is_db = True
exclude_from_menus = True
def __init__(self, work_dir, input_file, **kwargs):
super().__init__(work_dir, input_file, **kwargs)
def main(self):
table = 'locksettings'
self.DICT = collections.ChainMap(
*[self.name_val(d) for d in self.sql_table_as_dict(table)])
# self.DATA = list(self.DICT)
@property
def target_path_root(self):
return f'/data/system/{self.TARGET}'
import re
import json
import javaobj
import logging
import pathlib
import itertools
import collections
from . import utils
from .classes import AndroidDecoder
logger = logging.getLogger(__name__)
javaobj._log.level = logging.WARNING
# -----------------------------------------------------------------------------
class SettingsDecoder(AndroidDecoder):
TARGET = 'settings.db'
NAMESPACE = 'db'
PACKAGE = 'com.android.providers.settings'
exclude_from_menus = True
def __init__(self, work_dir, input_file, **kwargs):
super().__init__(work_dir, input_file, **kwargs)
# TODO: template
def main(self):
table = 'secure'
data_ = self.sql_table_as_dict(table)
self.DICT = collections.ChainMap(*[self.name_val(d) for d in data_])
keys_ = {
'bluetooth_address': 'Bluetooth MAC',
'bluetooth_name': 'Bluetooth Name',
'body': 'Message',
'date': 'Time',
'type': 'Type'
}
def main(self):
table = 'sms'
for i in self.sql_table_as_dict(table, order_by=f'date'):
i['address'] = self.parse_number(i['address'])
i['date'] = self.unix_to_time_ms(i['date'])
i['type'] = self.sms_type(i['type'])
self.DATA.append(i)
# -----------------------------------------------------------------------------
class WhatsAppContactsDecoder(AndroidDecoder):
TARGET = 'wa.db'
NAMESPACE = 'db'
PACKAGE = 'com.whatsapp'
def __init__(self, work_dir, input_file, **kwargs):
super().__init__(work_dir, input_file, **kwargs)
self.template_name = 'whatsapp_contacts.html'
self.title = 'WhatsApp Contacts'
self.Titles = {
'_id': 'Index',
'display_name': 'Name',
'number': 'Number',
'status': 'Status',
}
def main(self):
def process_stickers(self):
stickers_db = self.get_neighbour('stickers_db')
if stickers_db:
dec = AndroidDecoder(None, stickers_db, stage=True)
for k, v in dec.sql_table_rows('stickers', columns=['id', 'uri']):
self.stickers[k] = v