Markopy
Utilizing Markov Models for brute forcing attacks
importer.py
Go to the documentation of this file.
1 
2 
6 
7 from importlib.util import spec_from_loader, module_from_spec
8 from importlib.machinery import SourceFileLoader, ExtensionFileLoader
9 import os
10 
11 
13  """! @brief import and return markopy module
14  @returns markopy module
15  """
16  ext = "so"
17  if os.name == 'nt':
18  ext="pyd"
19  try:
20  spec = spec_from_loader("markopy", ExtensionFileLoader("markopy", os.path.abspath(f"markopy.{ext}")))
21  markopy = module_from_spec(spec)
22  spec.loader.exec_module(markopy)
23  return markopy
24  except ImportError as e:
25  #print(f"({__file__}) Working in development mode. Trying to load markopy.{ext} from ../../../out/")
26  if(os.path.exists(f"../../../out/lib/markopy.{ext}")):
27  spec = spec_from_loader("markopy", ExtensionFileLoader("markopy", os.path.abspath(f"../../../out/lib/markopy.{ext}")))
28  markopy = module_from_spec(spec)
29  spec.loader.exec_module(markopy)
30  return markopy
31  else:
32  raise e
def import_markopy()
import and return markopy module
Definition: importer.py:12