Skip to content

Commit fb76bf6

Browse files
committed
Linux: Minor linting fixes to fbdev plugin
1 parent 0d7f985 commit fb76bf6

File tree

1 file changed

+10
-15
lines changed
  • volatility3/framework/plugins/linux/graphics

1 file changed

+10
-15
lines changed

volatility3/framework/plugins/linux/graphics/fbdev.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,9 @@
66

77
from dataclasses import dataclass
88
from typing import Type, List, Dict, Tuple
9-
from volatility3.framework import constants, exceptions, interfaces
9+
from volatility3.framework import constants, exceptions, interfaces, renderers
1010
from volatility3.framework.configuration import requirements
11-
from volatility3.framework.renderers import (
12-
format_hints,
13-
TreeGrid,
14-
NotAvailableValue,
15-
UnreadableValue,
16-
)
11+
from volatility3.framework.renderers import format_hints
1712
from volatility3.framework.objects import utility
1813
from volatility3.framework.constants import architectures
1914
from volatility3.framework.symbols import linux
@@ -181,7 +176,7 @@ def dump_fb(
181176
"""
182177
kernel = context.modules[kernel_name]
183178
kernel_layer = context.layers[kernel.layer_name]
184-
id = "N-A" if isinstance(fb.id, NotAvailableValue) else fb.id
179+
id = "N-A" if isinstance(fb.id, renderers.NotAvailableValue) else fb.id
185180
base_filename = f"{id}_{fb.xres_virtual}x{fb.yres_virtual}_{fb.bpp}bpp"
186181
if convert_to_png_image:
187182
image_object = cls.convert_fb_raw_buffer_to_image(context, kernel_name, fb)
@@ -193,9 +188,9 @@ def dump_fb(
193188
final_fb_buffer = kernel_layer.read(fb.fb_info.screen_base, fb.size)
194189
filename = f"{base_filename}.raw"
195190

196-
with open_method(filename) as f:
197-
f.write(final_fb_buffer)
198-
return f.preferred_filename
191+
with open_method(filename) as fp:
192+
fp.write(final_fb_buffer)
193+
return fp.preferred_filename
199194

200195
@classmethod
201196
def parse_fb_info(
@@ -216,7 +211,7 @@ def parse_fb_info(
216211
- struct fb_var_screeninfo stores device independent changeable information about a frame buffer device, its current format and video mode,
217212
as well as other miscellaneous parameters.
218213
"""
219-
id = utility.array_to_string(fb_info.fix.id) or NotAvailableValue()
214+
id = utility.array_to_string(fb_info.fix.id) or renderers.NotAvailableValue()
220215
color_fields = None
221216

222217
# 0 = color, 1 = grayscale, >1 = FOURCC
@@ -299,14 +294,14 @@ def _generator(self):
299294
vollog.error(
300295
f'Layer {excp.layer_name} failed to read address {hex(excp.invalid_address)} when dumping framebuffer "{fb.id}".'
301296
)
302-
file_output = UnreadableValue()
297+
file_output = renderers.UnreadableValue()
303298

304299
try:
305300
fb_device_name = utility.pointer_to_string(
306301
fb.fb_info.dev.kobj.name, 256
307302
)
308303
except exceptions.InvalidAddressException:
309-
fb_device_name = NotAvailableValue()
304+
fb_device_name = renderers.NotAvailableValue()
310305

311306
yield (
312307
0,
@@ -334,7 +329,7 @@ def run(self):
334329
("Filename", str),
335330
]
336331

337-
return TreeGrid(
332+
return renderers.TreeGrid(
338333
columns,
339334
self._generator(),
340335
)

0 commit comments

Comments
 (0)