Skip to content

Commit 0a9e663

Browse files
iMHLv2ikelos
authored andcommitted
remove the _VACB.is_valid() method - do all validity checks in the calling function
1 parent 442f877 commit 0a9e663

File tree

1 file changed

+10
-25
lines changed
  • volatility/framework/symbols/windows/extensions

1 file changed

+10
-25
lines changed

volatility/framework/symbols/windows/extensions/__init__.py

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -982,24 +982,6 @@ class VACB(objects.StructType):
982982

983983
FILEOFFSET_MASK = 0xFFFFFFFFFFFF0000
984984

985-
def is_valid(self, shared_cache_map: interfaces.objects.ObjectInterface) -> bool:
986-
"""Determine if the object is valid."""
987-
try:
988-
layer = self._context.layers[self.vol.layer_name]
989-
990-
# Check if the Overlay member of _VACB is resident. The Overlay member stores information
991-
# about the FileOffset and the ActiveCount. This is just another proactive sanity check.
992-
#if not self.Overlay:
993-
# return False
994-
995-
if not layer.is_valid(self.SharedCacheMap):
996-
return False
997-
998-
# Make sure that the SharedCacheMap member of the VACB points back to the parent object.
999-
return self.SharedCacheMap == shared_cache_map.vol.offset
1000-
except exceptions.InvalidAddressException:
1001-
return False
1002-
1003985
def get_file_offset(self) -> int:
1004986
# The FileOffset member of VACB is used to denote the offset within the file where the
1005987
# view begins. Since all views are 256 KB in size, the bottom 16 bits are used to
@@ -1091,15 +1073,19 @@ def get_available_pages(self) -> List:
10911073
iterval = 0
10921074
while (iterval < full_blocks) and (full_blocks <= 4):
10931075
vacb_obj = self.InitialVacbs[iterval]
1094-
if vacb_obj.is_valid(shared_cache_map=self):
1095-
self.save_vacb(vacb_obj, vacb_list)
1076+
try:
1077+
# Make sure that the SharedCacheMap member of the VACB points back to the parent object.
1078+
if vacb_obj.SharedCacheMap == self.vol.offset:
1079+
self.save_vacb(vacb_obj, vacb_list)
1080+
except exceptions.InvalidAddressException:
1081+
pass
10961082
iterval += 1
10971083

10981084
# We also have to account for the spill over data that is not found in the full blocks.
10991085
# The first case to consider is when the spill over is still in InitialVacbs.
11001086
if (left_over > 0) and (full_blocks < 4):
11011087
vacb_obj = self.InitialVacbs[iterval]
1102-
if vacb_obj.is_valid(shared_cache_map=self):
1088+
if vacb_obj.SharedCacheMap == self.vol.offset:
11031089
self.save_vacb(vacb_obj, vacb_list)
11041090

11051091
# If the file is larger than 1 MB, a seperate VACB index array needs to be allocated.
@@ -1136,7 +1122,7 @@ def get_available_pages(self) -> List:
11361122
continue
11371123

11381124
vacb = vacb_entry.dereference().cast(symbol_table_name + constants.BANG + "_VACB")
1139-
if vacb.is_valid(shared_cache_map=self):
1125+
if vacb.SharedCacheMap == self.vol.offset:
11401126
self.save_vacb(vacb, vacb_list)
11411127

11421128
if left_over > 0:
@@ -1148,7 +1134,7 @@ def get_available_pages(self) -> List:
11481134
return vacb_list
11491135

11501136
vacb = vacb_entry.dereference().cast(symbol_table_name + constants.BANG + "_VACB")
1151-
if vacb.is_valid(shared_cache_map=self):
1137+
if vacb.SharedCacheMap == self.vol.offset:
11521138
self.save_vacb(vacb, vacb_list)
11531139

11541140
# The file is less than 32 MB, so we can stop processing.
@@ -1180,8 +1166,7 @@ def get_available_pages(self) -> List:
11801166

11811167
vacb = vacb_array[counter].dereference().cast(symbol_table_name + constants.BANG + "_VACB")
11821168
if vacb.SharedCacheMap == self.vol.offset:
1183-
if vacb.is_valid(shared_cache_map=self):
1184-
self.save_vacb(vacb, vacb_list)
1169+
self.save_vacb(vacb, vacb_list)
11851170
else:
11861171
# Process the next level of the multi-level array. We set the limit_depth to be
11871172
# the depth of the tree as determined from the size and we initialize the

0 commit comments

Comments
 (0)