# Path: lib/cuckoo/common/abstracts.py
# class Processing(object):
#     """Base abstract class for processing module."""
#     order = 1
#     enabled = True
# 
#     def __init__(self):
#         self.analysis_path = ""
#         self.logs_path = ""
#         self.task = None
#         self.options = None
# 
#     def set_options(self, options):
#         """Set report options.
#         @param options: report options dict.
#         """
#         self.options = options
# 
#     def set_task(self, task):
#         """Add task information.
#         @param task: task dictionary.
#         """
#         self.task = task
# 
#     def set_path(self, analysis_path):
#         """Set paths.
#         @param analysis_path: analysis folder path.
#         """
#         self.analysis_path = analysis_path
#         self.log_path = os.path.join(self.analysis_path, "analysis.log")
#         self.file_path = os.path.realpath(os.path.join(self.analysis_path,
#                                                        "binary"))
#         self.dropped_path = os.path.join(self.analysis_path, "files")
#         self.logs_path = os.path.join(self.analysis_path, "logs")
#         self.shots_path = os.path.join(self.analysis_path, "shots")
#         self.pcap_path = os.path.join(self.analysis_path, "dump.pcap")
#         self.pmemory_path = os.path.join(self.analysis_path, "memory")
#         self.memory_path = os.path.join(self.analysis_path, "memory.dmp")
# 
#     def run(self):
#         """Start processing.
#         @raise NotImplementedError: this method is abstract.
#         """
#         raise NotImplementedError
# 
# Path: lib/cuckoo/common/config.py
# class Config:
#     """Configuration file parser."""
# 
#     def __init__(self, file_name="cuckoo", cfg=None):
#         """
#         @param file_name: file name without extension.
#         @param cfg: configuration file path.
#         """
#         config = ConfigParser.ConfigParser()
# 
#         if cfg:
#             config.read(cfg)
#         else:
#             config.read(os.path.join(CUCKOO_ROOT, "conf", "%s.conf" % file_name))
# 
#         for section in config.sections():
#             setattr(self, section, Dictionary())
#             for name, raw_value in config.items(section):
#                 try:
#                     # Ugly fix to avoid '0' and '1' to be parsed as a
#                     # boolean value.
#                     # We raise an exception to goto fail^w parse it
#                     # as integer.
#                     if config.get(section, name) in ["0", "1"]:
#                         raise ValueError
# 
#                     value = config.getboolean(section, name)
#                 except ValueError:
#                     try:
#                         value = config.getint(section, name)
#                     except ValueError:
#                         value = config.get(section, name)
# 
#                 setattr(getattr(self, section), name, value)
# 
#     def get(self, section):
#         """Get option.
#         @param section: section to fetch.
#         @raise CuckooOperationalError: if section not found.
#         @return: option value.
#         """
#         try:
#             return getattr(self, section)
#         except AttributeError as e:
#             raise CuckooOperationalError("Option %s is not found in "
#                                          "configuration, error: %s" %
#                                          (section, e))


import os
import logging
    import volatility.conf as conf
    import volatility.registry as registry
    import volatility.commands as commands
    import volatility.utils as utils
    import volatility.plugins.malware.devicetree as devicetree
    import volatility.plugins.malware.apihooks as apihooks
    import volatility.plugins.getsids as sidm
    import volatility.plugins.privileges as privm
    import volatility.plugins.taskmods as taskmods
    import volatility.win32.tasks as tasks
    import volatility.obj as obj
    import volatility.exceptions as exc
    import volatility.plugins.filescan as filescan
from lib.cuckoo.common.abstracts import Processing
from lib.cuckoo.common.config import Config
from lib.cuckoo.common.constants import CUCKOO_ROOT

        self.__config()
        results = []

        command = self.plugins["imageinfo"](self.config)
        new = {}
        for key, value in command.calculate():
            new[key] = value

        osp = new["Suggested Profile(s)"].split(",")[0]
        new["osprofile"] = osp

        results.append(new)

        return dict(config={}, data=results)

class VolatilityManager(object):
    """Handle several volatility results."""

    def __init__(self, memfile, osprofile=None):
        self.mask_pid = []
        self.taint_pid = set()
        self.memfile = memfile

        conf_path = os.path.join(CUCKOO_ROOT, "conf", "memory.conf")
        if not os.path.exists(conf_path):
            log.error("Configuration file volatility.conf not found".format(conf_path))
            self.voptions = False
            return


# Path: lib/cuckoo/common/abstracts.py
# class Processing(object):
#     """Base abstract class for processing module."""
#     order = 1
#     enabled = True
# 
#     def __init__(self):
#         self.analysis_path = ""
#         self.logs_path = ""
#         self.task = None
#         self.options = None
# 
#     def set_options(self, options):
#         """Set report options.
#         @param options: report options dict.
#         """
#         self.options = options
# 
#     def set_task(self, task):
#         """Add task information.
#         @param task: task dictionary.
#         """
#         self.task = task
# 
#     def set_path(self, analysis_path):
#         """Set paths.
#         @param analysis_path: analysis folder path.
#         """
#         self.analysis_path = analysis_path
#         self.log_path = os.path.join(self.analysis_path, "analysis.log")
#         self.file_path = os.path.realpath(os.path.join(self.analysis_path,
#                                                        "binary"))
#         self.dropped_path = os.path.join(self.analysis_path, "files")
#         self.logs_path = os.path.join(self.analysis_path, "logs")
#         self.shots_path = os.path.join(self.analysis_path, "shots")
#         self.pcap_path = os.path.join(self.analysis_path, "dump.pcap")
#         self.pmemory_path = os.path.join(self.analysis_path, "memory")
#         self.memory_path = os.path.join(self.analysis_path, "memory.dmp")
# 
#     def run(self):
#         """Start processing.
#         @raise NotImplementedError: this method is abstract.
#         """
#         raise NotImplementedError
# 
# Path: lib/cuckoo/common/config.py
# class Config:
#     """Configuration file parser."""
# 
#     def __init__(self, file_name="cuckoo", cfg=None):
#         """
#         @param file_name: file name without extension.
#         @param cfg: configuration file path.
#         """
#         config = ConfigParser.ConfigParser()
# 
#         if cfg:
#             config.read(cfg)
#         else:
#             config.read(os.path.join(CUCKOO_ROOT, "conf", "%s.conf" % file_name))
# 
#         for section in config.sections():
#             setattr(self, section, Dictionary())
#             for name, raw_value in config.items(section):
#                 try:
#                     # Ugly fix to avoid '0' and '1' to be parsed as a
#                     # boolean value.
#                     # We raise an exception to goto fail^w parse it
#                     # as integer.
#                     if config.get(section, name) in ["0", "1"]:
#                         raise ValueError
# 
#                     value = config.getboolean(section, name)
#                 except ValueError:
#                     try:
#                         value = config.getint(section, name)
#                     except ValueError:
#                         value = config.get(section, name)
# 
#                 setattr(getattr(self, section), name, value)
# 
#     def get(self, section):
#         """Get option.
#         @param section: section to fetch.
#         @raise CuckooOperationalError: if section not found.
#         @return: option value.
#         """
#         try:
#             return getattr(self, section)
#         except AttributeError as e:
#             raise CuckooOperationalError("Option %s is not found in "
#                                          "configuration, error: %s" %
#                                          (section, e))


# Path: modules/processing/memory.py
import os
import logging
    import volatility.conf as conf
    import volatility.registry as registry
    import volatility.commands as commands
    import volatility.utils as utils
    import volatility.plugins.malware.devicetree as devicetree
    import volatility.plugins.malware.apihooks as apihooks
    import volatility.plugins.getsids as sidm
    import volatility.plugins.privileges as privm
    import volatility.plugins.taskmods as taskmods
    import volatility.win32.tasks as tasks
    import volatility.obj as obj
    import volatility.exceptions as exc
    import volatility.plugins.filescan as filescan
from lib.cuckoo.common.abstracts import Processing
from lib.cuckoo.common.config import Config
from lib.cuckoo.common.constants import CUCKOO_ROOT


        self.__config()
        results = []

        command = self.plugins["imageinfo"](self.config)
        new = {}
        for key, value in command.calculate():
            new[key] = value

        osp = new["Suggested Profile(s)"].split(",")[0]
        new["osprofile"] = osp

        results.append(new)

        return dict(config={}, data=results)

class VolatilityManager(object):
    """Handle several volatility results."""

    def __init__(self, memfile, osprofile=None):
        self.mask_pid = []
        self.taint_pid = set()
        self.memfile = memfile

        conf_path = os.path.join(CUCKOO_ROOT, "conf", "memory.conf")
        if not os.path.exists(conf_path):
            log.error("Configuration file volatility.conf not found".format(conf_path))
            self.voptions = False
            return


        self.voptions = Config("memory")