Skip to content

Commit

Permalink
A number of changes:
Browse files Browse the repository at this point in the history
* Bumping Werkzeug version to 0.15.3.
* VFSOpen fixes: preferring context manager-based syntax.
* RDFValues parsing refactored. ParseFromBytes -> FromSerializedBytes class method.
  • Loading branch information
mbushkov committed Oct 2, 2019
1 parent ececdac commit c2a442a
Show file tree
Hide file tree
Showing 59 changed files with 1,522 additions and 1,281 deletions.
2 changes: 1 addition & 1 deletion api_client/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def make_release_tree(self, base_dir, files):
"cryptography==2.4.2",
"ipython==%s" % ("5.0.0" if sys.version_info < (3, 0) else "7.2.0"),
"requests==2.21.0",
"Werkzeug==0.11.3",
"Werkzeug==0.15.3",
],
data=["version.ini"])

Expand Down
2 changes: 1 addition & 1 deletion appveyor/tests/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ test_script:
# We have 4 vCPUs available, but only use 3 here to avoid timeouts like
# https://ci.appveyor.com/project/grr/grr-ia94e/builds/20483467/messages ,
# which happen when tests stall.
- pytest --verbose -n 3 grr/ --ignore grr/server/grr_response_server/gui/selenium_tests/ --ignore grr/client/grr_response_client/client_actions/windows
- pytest --verbose -n 3 grr/ --ignore grr/server/grr_response_server/gui/selenium_tests/ --ignore grr/client/grr_response_client/client_actions/windows/
# jsTree tests seem to fail on Chrome 71 headless due to https://github.com/GoogleChrome/puppeteer/issues/3463
- if [ $(google-chrome --version | grep -Eo " [0-9]{1,3}") != "71" ]; then (cd grr/server/grr_response_server/gui/static/ && npm run gulp test); fi
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ def _Recurse(self, path, depth):
pathspec = rdf_paths.PathSpec(
path=path, pathtype=rdf_paths.PathSpec.PathType.REGISTRY)
try:
if not vfs.VFSOpen(pathspec).IsDirectory():
return
with vfs.VFSOpen(pathspec) as filedesc:
if not filedesc.IsDirectory():
return
except IOError:
return # Skip inaccessible Registry parts (e.g. HKLM\SAM\SAM) silently.
else:
Expand Down Expand Up @@ -146,17 +147,16 @@ def _GenerateLiteralMatch(self, dirpath):
new_path = os.path.join(dirpath, self._glob)
pathspec = rdf_paths.PathSpec(path=new_path, pathtype=self.opts.pathtype)
try:
fd = vfs.VFSOpen(pathspec)

if fd.path == "/" and new_path != "/":
# TODO: VFSHandler has path = "/" as default. Thus, if we
# encounter "/", it could either mean the path never has been assigned
# or the path is literally "/". Thus, we return None if the path is "/"
# because it has never been set, by cross-referencing with the path we
# glob for.
return None
else:
return os.path.basename(fd.path)
with vfs.VFSOpen(pathspec) as filedesc:
if filedesc.path == "/" and new_path != "/":
# TODO: VFSHandler has path = "/" as default. Thus, if we
# encounter "/", it could either mean the path never has been assigned
# or the path is literally "/". Thus, we return None if the path is
# "/" because it has never been set, by cross-referencing with the
# path we glob for.
return None
else:
return os.path.basename(filedesc.path)
except IOError:
return None # Indicate "File not found" by returning None.

Expand Down Expand Up @@ -394,14 +394,14 @@ def _ListDir(dirpath, pathtype):
pathspec = rdf_paths.PathSpec(path=dirpath, pathtype=pathtype)
childpaths = []
try:
file_obj = vfs.VFSOpen(pathspec)
for path in file_obj.ListNames():
# For Windows registry, ignore the empty string which corresponds to the
# default value in the current key. Otherwise, globbing a key will yield
# the key itself, because joining the name of the default value u"" with
# a key name yields the key name again.
if pathtype != rdf_paths.PathSpec.PathType.REGISTRY or path:
childpaths.append(path)
with vfs.VFSOpen(pathspec) as filedesc:
for path in filedesc.ListNames():
# For Windows registry, ignore the empty string which corresponds to the
# default value in the current key. Otherwise, globbing a key will yield
# the key itself, because joining the name of the default value u"" with
# a key name yields the key name again.
if pathtype != rdf_paths.PathSpec.PathType.REGISTRY or path:
childpaths.append(path)
except IOError:
pass

Expand Down

0 comments on commit c2a442a

Please sign in to comment.