Skip to content

Commit 2d3b315

Browse files
committed
correct sql query and strip identifier
1 parent 11ddafd commit 2d3b315

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

volatility3/framework/automagic/symbol_cache.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,18 +429,19 @@ def update(self, progress_callback=None):
429429
progress_callback(0, "Reading remote ISF list")
430430
cursor = self._database.cursor()
431431
cursor.execute(
432-
f"SELECT cached FROM cache WHERE local = 0 and cached < datetime('now', {self.cache_period})"
433-
)
432+
f"SELECT cached FROM cache WHERE local = 0 and cached < datetime('now', '{self.cache_period}')" )
434433
remote_identifiers = RemoteIdentifierFormat(constants.REMOTE_ISF_URL)
435434
progress_callback(50, "Reading remote ISF list")
436435
for operating_system in constants.OS_CATEGORIES:
437436
identifiers = remote_identifiers.process(
438437
{}, operating_system=operating_system
439438
)
440439
for identifier, location in identifiers:
440+
identifier = identifier.rstrip()
441+
identifier = identifier[:-1] if identifier.endswith(b"\x00") else identifier # Linux banners dumped by dwarf2json end with "\x00\n". If not stripped, the banner cannot match.
441442
cursor.execute(
442-
"INSERT OR REPLACE INTO cache(identifier, location, operating_system, local, cached) VALUES (?, ?, ?, ?, datetime('now'))",
443-
(location, identifier, operating_system, False),
443+
"INSERT OR REPLACE INTO cache(identifier, location, operating_system, local, cached) VALUES (?, ?, ?, ?, datetime('now'))",
444+
(identifier, location, operating_system, False),
444445
)
445446
progress_callback(100, "Reading remote ISF list")
446447
self._database.commit()

0 commit comments

Comments
 (0)