0

I write below code and it gives me error in first line! whats wrong is with this code:

import volatility.conf as conf
import volatility.registry as reg
import volatility.commands as commands
import volatility.addrspace as addrspace
import volatility.plugins.taskmods as taskmode



# configure volatility
reg.PluginImporter()
config=conf.ConfObject()
reg.register_global_options(conf,commands.Command)
reg.register_global_options(conf,addrspace.BaseAddressSpace)

config.parse_options()
config.PROFILE="Linuxfedora32x64"
config.LOCATION="./dumps/mem.lime"

p=taskmode.PSList(config)
for process in p.calculate:
    print(process)

the error code:i think there is some code insode conf.py witch in not support in python 3.6 .but volatility is copatible with python 3.6. so i don't know what to do :

Traceback (most recent call last):
  File "../PycharmProjects/volpractive/test.py", line 6, in <module>
    import volatility.conf as conf
  File "/anaconda3/lib/python3.6/site-packages/volatility-2.6-py3.6.egg/volatility/conf.py", line 84
    except (optparse.BadOptionError, optparse.OptionValueError), err:
MSepehr
  • 890
  • 2
  • 13
  • 36

1 Answers1

1

You were right, the line:

except (optparse.BadOptionError, optparse.OptionValueError), err:

is not Python3 compatible (according to [Python]: The try statement).

According to [GitHub]: volatilityfoundation/volatility - (2.6) volatility/README.txt:126+ (as it is at this point):

Requirements
============
- Python 2.6 or later, but not 3.0. http://www.python.org

Note:

  • The stacktrace is still incomplete (missing the last line - should be SyntaxError); that would have cleared things up much sooner

So, you have to run it with Python2.6+ (of course you could also modify the code (at least the part that you need) to be Python3 compatible, but I doubt that's feasible).

CristiFati
  • 38,250
  • 9
  • 50
  • 87