0

I'm trying to import volatility3 into my python project/script, so that I don't have to use os.system since volatility3 is already made in python3.

I'm wondering how can I import all the functions/modules of said project ? The functions I'm interested in are located in volatility3/volatility/framework I tried simply putting:

>>> import volatility3.volatility.framework

But I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/volatility3/volatility/framework/__init__.py", line 12, in <module>
    from volatility.framework import constants, interfaces
ModuleNotFoundError: No module named 'volatility'

My guess is I have to modify sys.path or one of the path variables but this does not seem to work.

Thanks,

1 Answers1

0

The best solution here would be to properly install volatility with pip3, from your already exiting repository folder:

$ pip3 install /home/volatility3

or directly from pipy (not tested):

$ pip3 install volatility3

then you should be able to import the from volatility package directly:

Python 3.6.9 (default, Nov  7 2019, 10:44:02) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import volatility.framework
>>> volatility.framework
<module 'volatility.framework' from '/home/bruno/.local/lib/python3.6/site-packages/volatility/framework/__init__.py'>
>>> 
bruno desthuilliers
  • 75,974
  • 6
  • 88
  • 118
  • Yes thank you. That's what I was looking for. Actually, I found the same answer here: https://stackoverflow.com/questions/14509192/how-to-import-functions-from-other-projects-in-python I didn't know how to phrase my problem. Also it seems volatility3 is available from pip3 without having to clone the volatility repo Thanks again –  Dec 17 '19 at 12:27
  • @Win well yes of course if the package is on pipy (I didn't bothered looking it up since you already had a local repo clone). Answer edited. – bruno desthuilliers Dec 17 '19 at 12:57