Skip to content

Commit 27ac31d

Browse files
authored
Merge pull request #5 from digitalisx/fix/workflow
Fix/workflow
2 parents 324df09 + 3fda434 commit 27ac31d

File tree

27 files changed

+121
-110
lines changed

27 files changed

+121
-110
lines changed

.github/workflows/build-pypi.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ on:
1515
jobs:
1616

1717
build:
18-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-20.04
19+
strategy:
20+
matrix:
21+
python-version: ["3.6"]
1922
steps:
20-
- uses: actions/checkout@v2
21-
22-
- name: Set up Python 3.x
23-
uses: actions/setup-python@v2
23+
- uses: actions/checkout@v3
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v4
2426
with:
25-
python-version: '3.x'
27+
python-version: ${{ matrix.python-version }}
2628

2729
- name: Install dependencies
2830
run: |

.github/workflows/test.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ on: [push, pull_request]
33
jobs:
44

55
build:
6-
runs-on: ubuntu-latest
6+
runs-on: ubuntu-20.04
7+
strategy:
8+
matrix:
9+
python-version: ["3.6"]
710
steps:
8-
- uses: actions/checkout@v2
9-
10-
- name: Set up Python 3.6
11-
uses: actions/setup-python@v2
11+
- uses: actions/checkout@v3
12+
- name: Set up Python ${{ matrix.python-version }}
13+
uses: actions/setup-python@v4
1214
with:
13-
python-version: '3.6'
15+
python-version: ${{ matrix.python-version }}
1416

1517
- name: Install dependencies
1618
run: |

development/mac-kdk/parse_pbzx2.py

Lines changed: 41 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -17,61 +17,54 @@ def seekread(f, offset = None, length = 0, relative = True):
1717
f.seek(offset, [0, 1, 2][relative])
1818
if length:
1919
return f.read(length)
20+
return None
2021

2122

2223
def parse_pbzx(pbzx_path):
2324
section = 0
2425
xar_out_path = '%s.part%02d.cpio.xz' % (pbzx_path, section)
25-
f = open(pbzx_path, 'rb')
26-
# pbzx = f.read()
27-
# f.close()
28-
magic = seekread(f, length = 4)
29-
if magic != 'pbzx':
30-
raise RuntimeError("Error: Not a pbzx file")
31-
# Read 8 bytes for initial flags
32-
flags = seekread(f, length = 8)
33-
# Interpret the flags as a 64-bit big-endian unsigned int
34-
flags = struct.unpack('>Q', flags)[0]
35-
xar_f = open(xar_out_path, 'wb')
36-
while flags & (1 << 24):
37-
# Read in more flags
26+
with open(pbzx_path, 'rb') as f:
27+
# pbzx = f.read()
28+
# f.close()
29+
magic = seekread(f, length = 4)
30+
if magic != 'pbzx':
31+
raise RuntimeError("Error: Not a pbzx file")
32+
# Read 8 bytes for initial flags
3833
flags = seekread(f, length = 8)
34+
# Interpret the flags as a 64-bit big-endian unsigned int
3935
flags = struct.unpack('>Q', flags)[0]
40-
# Read in length
41-
f_length = seekread(f, length = 8)
42-
f_length = struct.unpack('>Q', f_length)[0]
43-
xzmagic = seekread(f, length = 6)
44-
if xzmagic != '\xfd7zXZ\x00':
45-
# This isn't xz content, this is actually _raw decompressed cpio_ chunk of 16MB in size...
46-
# Let's back up ...
47-
seekread(f, offset = -6, length = 0)
48-
# ... and split it out ...
49-
f_content = seekread(f, length = f_length)
50-
section += 1
51-
decomp_out = '%s.part%02d.cpio' % (pbzx_path, section)
52-
g = open(decomp_out, 'wb')
53-
g.write(f_content)
54-
g.close()
55-
# Now to start the next section, which should hopefully be .xz (we'll just assume it is ...)
56-
xar_f.close()
57-
section += 1
58-
new_out = '%s.part%02d.cpio.xz' % (pbzx_path, section)
59-
xar_f = open(new_out, 'wb')
60-
else:
61-
f_length -= 6
62-
# This part needs buffering
63-
f_content = seekread(f, length = f_length)
64-
tail = seekread(f, offset = -2, length = 2)
65-
xar_f.write(xzmagic)
66-
xar_f.write(f_content)
67-
if tail != 'YZ':
68-
xar_f.close()
69-
raise RuntimeError("Error: Footer is not xar file footer")
70-
try:
71-
f.close()
72-
xar_f.close()
73-
except IOError:
74-
pass
36+
while flags & (1 << 24):
37+
with open(xar_out_path, 'wb') as xar_f:
38+
xar_f.seek(0, os.SEEK_END)
39+
# Read in more flags
40+
flags = seekread(f, length = 8)
41+
flags = struct.unpack('>Q', flags)[0]
42+
# Read in length
43+
f_length = seekread(f, length = 8)
44+
f_length = struct.unpack('>Q', f_length)[0]
45+
xzmagic = seekread(f, length = 6)
46+
if xzmagic != '\xfd7zXZ\x00':
47+
# This isn't xz content, this is actually _raw decompressed cpio_ chunk of 16MB in size...
48+
# Let's back up ...
49+
seekread(f, offset = -6, length = 0)
50+
# ... and split it out ...
51+
f_content = seekread(f, length = f_length)
52+
section += 1
53+
decomp_out = '%s.part%02d.cpio' % (pbzx_path, section)
54+
with open(decomp_out, 'wb') as g:
55+
g.write(f_content)
56+
# Now to start the next section, which should hopefully be .xz (we'll just assume it is ...)
57+
section += 1
58+
xar_out_path = '%s.part%02d.cpio.xz' % (pbzx_path, section)
59+
else:
60+
f_length -= 6
61+
# This part needs buffering
62+
f_content = seekread(f, length = f_length)
63+
tail = seekread(f, offset = -2, length = 2)
64+
xar_f.write(xzmagic)
65+
xar_f.write(f_content)
66+
if tail != 'YZ':
67+
raise RuntimeError("Error: Footer is not xar file footer")
7568

7669

7770
def main():

doc/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def setup(app):
121121

122122
extensions.append('sphinx_autodoc_typehints')
123123
except ImportError:
124+
# If the autodoc typehints extension isn't available, carry on regardless
124125
pass
125126

126127
# Add any paths that contain templates here, relative to this directory.

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pycryptodome
1616

1717
# This can improve error messages regarding improperly configured ISF files,
1818
# but is only recommended for development
19-
# jsonschema>=2.3.0
19+
jsonschema>=2.3.0
2020

2121
# This is required for memory acquisition via leechcore/pcileech.
2222
leechcorepyc>=2.4.0

volatility3/cli/volshell/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class VolShell(cli.CommandLine):
3636

3737
def __init__(self):
3838
super().__init__()
39-
self.output_dir = None
4039

4140
def run(self):
4241
"""Executes the command line module, taking the system arguments,

volatility3/cli/volshell/generic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,11 @@ def display_type(self,
324324
" " * (longest_member - len_member), " ", member_type.vol.type_name)
325325

326326
@classmethod
327-
def _display_value(self, value: Any) -> str:
327+
def _display_value(cls, value: Any) -> str:
328328
if isinstance(value, objects.PrimitiveObject):
329329
return repr(value)
330330
elif isinstance(value, objects.Array):
331-
return repr([self._display_value(val) for val in value])
331+
return repr([cls._display_value(val) for val in value])
332332
else:
333333
return hex(value.vol.offset)
334334

@@ -390,8 +390,8 @@ def run_script(self, location: str):
390390
location = "file:" + request.pathname2url(location)
391391
print(f"Running code from {location}\n")
392392
accessor = resources.ResourceAccessor()
393-
with io.TextIOWrapper(accessor.open(url = location), encoding = 'utf-8') as fp:
394-
self.__console.runsource(fp.read(), symbol = 'exec')
393+
with accessor.open(url = location) as fp:
394+
self.__console.runsource(io.TextIOWrapper(fp.read(), encoding = 'utf-8'), symbol = 'exec')
395395
print("\nCode complete")
396396

397397
def load_file(self, location: str):

volatility3/framework/automagic/pdbscan.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ def test_physical_kernel(physical_layer_name: str, virtual_layer_name: str, kern
181181
hex(kvo)))
182182
except exceptions.InvalidAddressException:
183183
vollog.debug(f"Potential kernel_virtual_offset caused a page fault: {hex(kvo)}")
184+
return None
184185

185186
vollog.debug("Kernel base determination - testing fixed base address")
186187
return self._method_layer_pdb_scan(context, vlayer, test_physical_kernel, False, True, progress_callback)

volatility3/framework/automagic/symbol_cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,7 @@ def get_local_locations(self) -> Generator[str, None, None]:
223223
def is_url_local(self, url: str) -> bool:
224224
"""Determines whether an url is local or not"""
225225
parsed = urllib.parse.urlparse(url)
226-
if parsed.scheme in ['file', 'jar']:
227-
return True
226+
return parsed.scheme in ['file', 'jar']
228227

229228
def get_identifier(self, location: str) -> Optional[bytes]:
230229
results = self._database.cursor().execute('SELECT identifier FROM cache WHERE location = ?',
@@ -246,6 +245,7 @@ def get_hash(self, location: str) -> Optional[str]:
246245
(location,)).fetchall()
247246
for row in results:
248247
return row['hash']
248+
return None
249249

250250
def update(self, progress_callback = None):
251251
"""Locates all files under the symbol directories. Updates the cache with additions, modifications and removals.

volatility3/framework/interfaces/automagic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class StackerLayerInterface(metaclass = ABCMeta):
113113
"""The list operating systems/first-level plugin hierarchy that should exclude this stacker"""
114114

115115
@classmethod
116-
def stack(self,
116+
def stack(cls,
117117
context: interfaces.context.ContextInterface,
118118
layer_name: str,
119119
progress_callback: constants.ProgressCallback = None) -> Optional[interfaces.layers.DataLayerInterface]:

0 commit comments

Comments
 (0)