0

I'm trying to setup volatility so I can execute commands regardless of what directory I happen to be in at the time. I'm not sure what I'm doing wrong, I've set the environmental variables with the export command. I've double checked my my ~/.bashrc and even added the directory to /etc/enviroment. Running echo $PATH=vol.py returns /mydir/volatility/vol.py. But when I run python vol.py I get "python: can't open file 'vol.py': [Errno 2] No such file or directory" .

So I guess my question. How can I set evironmental variables for python so that when I run python vol.py it executes on whatever image file I point it to without being in the volatility directory? Or even better just type vol.py -f whatever/imagefile, the system recognizes it as a python script and executes.

I figure its probably something simple, but I'm still learning, so any help is much appreciated.

My system : Kubuntu 14.04LTS; Python 2.7; Volatility 2.4

2 Answers2

1

I've not used Volatility but it sounds like you need to add the directory of vol.py to PYTHONPATH rather than PATH.

https://docs.python.org/3/tutorial/modules.html#the-module-search-path

You can run modules directly from the interpreter:

https://docs.python.org/3/using/cmdline.html

If those aren't it, I'd have a look in to python import order and then the various gotchas

http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html

  • Lol it took over a year for someone to answer... I figured it quite a while ago. I don't recall exactly what I did because so much time has passed, but if I remember correctly it had something to do with executing a the python script with volatility arguments. And I'm pretty sure it was fixed by initiating an interactive login shell to run the commands. If anyone else falls into the same problem I hope this tid-bit of info helps. Alternatively also, not sure if it would be worth it (depends on what you're doing) but Kali is a much friendlier distro for forensics and pen-testing. – Chris_Frost Jan 05 '16 at 13:20
0

It looks like you added the vol.py to your PATH, which is incorrect. You need to only add the directory to it such as /mydir/volatility/ without the vol.py in it

Eric
  • 19,525
  • 19
  • 84
  • 147
  • The directory is added. I was simply showing that the system was looking in the directory and could find the file. I actually I think it more has to do with python itself. when running python it does not look in that directory for the vol.py file. – Chris_Frost Nov 02 '14 at 16:40