Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
log.info("History items from {}:".format(history_file))
try:
with open(os.path.join(path, history_file), 'rb') as history_input:
history_raw = history_input.read()
history_json = json.loads(history_raw)
for version_dict in history_json['about']['brave']['versionInformation']:
if version_dict['name'] == u'Brave':
self.display_version = version_dict['version']
for s, site in enumerate(history_json['sites']):
if history_json['sites'][s].get('location'):
last_accessed = history_json['sites'][s]['lastAccessedTime'] if history_json['sites'][s].get('lastAccessedTime') else history_json['sites'][s]['lastAccessed']
new_row = Brave.URLItem(s, history_json['sites'][s]['location'],
history_json['sites'][s].get('title', ""),
last_accessed, last_accessed,
None, None, None, None, None, None, None, None, None, )
# Set the row type as determined earlier
new_row.row_type = row_type
# Set the row type as determined earlier
new_row.timestamp = to_datetime(new_row.last_visit_time, self.timezone)
# Add the new row to the results array
results.append(new_row)
self.artifacts_counts[history_file] = len(results)
log.info(" - Parsed {} items".format(len(results)))
self.parsed_artifacts.extend(results)
self.artifacts_display = browser_analysis.artifacts_display
self.version.extend(browser_analysis.version)
self.display_version = browser_analysis.display_version
self.preferences.extend(browser_analysis.preferences)
for item in browser_analysis.__dict__:
if isinstance(browser_analysis.__dict__[item], dict):
try:
# If the browser_analysis attribute has 'presentation' and 'data' subkeys, promote from
if browser_analysis.__dict__[item].get('presentation') and browser_analysis.__dict__[item].get('data'):
self.promote_object_to_analysis_session(item, browser_analysis.__dict__[item])
except Exception as e:
log.info("Exception occurred while analyzing {} for analysis session promotion: {}".format(item, e))
elif self.browser_type == "Brave":
browser_analysis = Brave(found_profile_path, timezone=self.timezone)
browser_analysis.process()
self.parsed_artifacts = browser_analysis.parsed_artifacts
self.artifacts_counts = browser_analysis.artifacts_counts
self.artifacts_display = browser_analysis.artifacts_display
self.version = browser_analysis.version
self.display_version = browser_analysis.display_version
for item in browser_analysis.__dict__:
if isinstance(browser_analysis.__dict__[item], dict):
try:
# If the browser_analysis attribute has 'presentation' and 'data' subkeys, promote from
if browser_analysis.__dict__[item].get('presentation') and browser_analysis.__dict__[item].get('data'):
self.promote_object_to_analysis_session(item, browser_analysis.__dict__[item])
except Exception as e:
log.info("Exception occurred while analyzing {} for analysis session promotion: {}".format(item, e))