Skip to content

Commit

Permalink
Changes to match style guide
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Aug 27, 2023
1 parent 2a6969b commit d708c55
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions plaso/parsers/chrome_cache.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
"""Parser for Google Chrome and Chromium Cache files."""

import os
import json
import os

from dfdatetime import webkit_time as dfdatetime_webkit_time
from dfvfs.resolver import resolver as path_spec_resolver
Expand Down Expand Up @@ -85,8 +85,8 @@ class CacheEntry(object):
key (bytes): key.
next (int): cache address of the next cache entry.
original_url (str): original URL derived from the key.
payloads (str): A json list of filenames (and offsets)
to find the cache payload
payloads (str): A json list of filenames (and offsets)
to find the cache payload.
rankings_node (int): cache address of the rankings node.
"""

Expand Down Expand Up @@ -266,11 +266,11 @@ def ParseCacheEntry(self, file_object, block_offset):
for stream in list(cache_entry.data_stream_addresses):
data_stream = CacheAddress(stream)
if data_stream.filename is not None:
if data_stream.filename.startswith("f_"):
if data_stream.filename.startswith('f_'):
payloads.append(data_stream.filename)
else:
payloads.append(
f"{data_stream.filename} (offset: {hex(data_stream.block_offset)})")
f'{data_stream.filename} (offset: {hex(data_stream.block_offset)})')
cache_entry_object.payloads = json.dumps(payloads)

cache_entry_object.hash = cache_entry.hash
Expand Down Expand Up @@ -377,7 +377,7 @@ def _ParseCacheEntries(self, parser_mediator, index_table, data_block_files):
timestamp=cache_entry.creation_time)

# In Chrome Cache v3, doublekey-ing cache entries was introduced
# This shows up as r"_dk_{domain}( {domain})* {url}"
# This shows up as "_dk_{domain}( {domain})* {url}"
# https://chromium.googlesource.com/chromium/src/+/
# 95faad3cfd90169f0a267e979c36e3348476a948/net/http/http_cache.cc#427
if '_dk_' in cache_entry.original_url[:20]:
Expand Down
3 changes: 2 additions & 1 deletion tests/parsers/chrome_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def testParseWithVersion3(self):
'data_type': 'chrome:cache:entry',
'original_url': ('https://m.media-amazon.com/images/'
'G/01/gno/sprites/nav-sprite-global-1x-reorg-privacy'
'._CB587940754_.png')}
'._CB587940754_.png'),
'payloads': '["data_3 (offset: 0x5c000)", "f_000010"]'}

event_data = storage_writer.GetAttributeContainerByIndex('event_data', 0)
self.CheckEventData(event_data, expected_event_values)
Expand Down

0 comments on commit d708c55

Please sign in to comment.