From 3a79ad1483be4cec72e69f2700bdb8c90b087c51 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Wed, 27 Apr 2016 15:13:21 +0200 Subject: [PATCH] move private function out of loop (all required variables are arguments) --- oletools/olevba.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/oletools/olevba.py b/oletools/olevba.py index 49c2fff..9e621f1 100755 --- a/oletools/olevba.py +++ b/oletools/olevba.py @@ -2237,6 +2237,15 @@ class VBA_Parser(object): # - The root/VBA storage MUST contain a _VBA_PROJECT stream and a dir stream # - all names are case-insensitive + def check_vba_stream(ole, vba_root, stream_path): + full_path = vba_root + stream_path + if ole.exists(full_path) and ole.get_type(full_path) == olefile.STGTY_STREAM: + log.debug('Found %s stream: %s' % (stream_path, full_path)) + return full_path + else: + log.debug('Missing %s stream, this is not a valid VBA project structure' % stream_path) + return False + # start with an empty list: self.vba_projects = [] # Look for any storage containing those storage/streams: @@ -2253,15 +2262,6 @@ class VBA_Parser(object): vba_root += '/' log.debug('Checking vba_root="%s"' % vba_root) - def check_vba_stream(ole, vba_root, stream_path): - full_path = vba_root + stream_path - if ole.exists(full_path) and ole.get_type(full_path) == olefile.STGTY_STREAM: - log.debug('Found %s stream: %s' % (stream_path, full_path)) - return full_path - else: - log.debug('Missing %s stream, this is not a valid VBA project structure' % stream_path) - return False - # Check if the VBA root storage also contains a PROJECT stream: project_path = check_vba_stream(ole, vba_root, 'PROJECT') if not project_path: continue -- libgit2 0.21.4