Skip to content

Commit

Permalink
'#43 In the IPED embedded python some code were inside zip files. This
Browse files Browse the repository at this point in the history
was leading to exception as fileLoader does not work with these files
inside zip. So, for now, as ALeapp will be deployed unzipped, ignores
the override of any files that are inside ZIP libs.
  • Loading branch information
patrickdalla committed Oct 17, 2023
1 parent 3dbd758 commit ce81e08
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions iped-utils/src/main/java/iped/utils/pythonhook/PythonHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,21 @@ public static void main(String args[]) {
+ " loaders = importlib._bootstrap_external._get_supported_file_loaders()\n"
+ " fileLoader = importlib._bootstrap_external.FileFinder.path_hook(*loaders)\n"
+ " foundPath=None\n"
+ " if(paths):\n" + " for path in paths:\n" + " if(fileLoader(path)):\n"
+ " foundPath=path\n" + " break\n" + " if(foundPath):\n"
+ " if(paths):\n"
+ " for path in paths:\n"
+ " if('.zip\\\\' in path or '.zip/' in path):\n"
+ " return None\n"
+ " if(fileLoader(path)):\n"
+ " foundPath=path\n"
+ " break\n" + " if(foundPath):\n"
+ " if(javahook.hasModule(fullname)):\n"
+ " return spec_from_loader(fullname, self, origin=foundPath, is_package=True)\n"
+ " else:\n" + " return None\n"
+ " else:\n"
+ " return None\n"
+ " def create_module(self, spec):\n"
+ " modules=spec.name.split('.')\n"
+ " with open(spec.origin+'/'+modules[len(modules)-1]+'.py') as f:\n"
+ " with open(spec.origin+'/'+modules[len(modules)-1]+'.py', encoding='utf8') as f:\n"
+ " source = f.read()\n"
+ " source = javahook.processHook(spec.origin, spec.name, source)\n"
+ " if(source == None):\n"
Expand Down

0 comments on commit ce81e08

Please sign in to comment.