# Path: ui/UIManager.py
# class UIManager(object):
#     def __init__(self):
#     def get_init_menu(self):
#     def add_menu(self, name):
#     def remove_menu(self, name):
#     def clear(self):
#     def add_view(self, view):
# 
# Path: ui/UIManager.py
# class UIManager(object):
#     def __init__(self):
#     def get_init_menu(self):
#     def add_menu(self, name):
#     def remove_menu(self, name):
#     def clear(self):
#     def add_view(self, view):
# 
# Path: ui/UIManager.py
# class UIManager(object):
#     def __init__(self):
#     def get_init_menu(self):
#     def add_menu(self, name):
#     def remove_menu(self, name):
#     def clear(self):
#     def add_view(self, view):
# 
# Path: ui/UIManager.py
# class UIManager(object):
#     def __init__(self):
#     def get_init_menu(self):
#     def add_menu(self, name):
#     def remove_menu(self, name):
#     def clear(self):
#     def add_view(self, view):
# 
# Path: lib/VMRepresentation.py
# def get_vmr():
#     """
#     Get the VMR instance.
#     :return: vmr
#     """
#     global vmr
#     if vmr is None:
#         vmr = VMRepresentation()
#     return vmr
# 
# Path: ui/NotifyProgress.py
# class NotifyProgress(QtWidgets.QWidget):
#     def __init__(self, name='current', *args, **kwargs):
#         super(NotifyProgress, self).__init__(*args, **kwargs)
#         self.analysis = name
#         self.pbar = QtWidgets.QProgressBar(self)
#         self.pbar.setGeometry(30, 40, 370, 25)
#         self.value = 0
#         self.setFixedSize(400, 100)
#         self.setWindowTitle('Running %s Analysis...' % self.analysis)
# 
#     def pbar_update(self, value):
#         self.value += value
#         if self.value > 100:
#             self.value = 100
#             self.close()
#         self.pbar.setValue(self.value)
# 
#     def pbar_set(self, value):
#         self.pbar.setValue(value)
# 
# Path: ui/UIManager.py
# class UIManager(object):
#     def __init__(self):
#     def get_init_menu(self):
#     def add_menu(self, name):
#     def remove_menu(self, name):
#     def clear(self):
#     def add_view(self, view):


from threading import Thread
from ui.UIManager import GradingViewer
from ui.UIManager import OptimizationViewer
from ui.UIManager import StackChangeViewer
from ui.UIManager import VMInputOuputViewer
from DebuggerHandler import load, save, get_dh
from lib.TraceAnalysis import *
from lib.VMRepresentation import get_vmr
from ui.NotifyProgress import NotifyProgress
from ui.UIManager import ClusterViewer
    from IDADebugger import IDADebugger
    from OllyDebugger import OllyDebugger
    from IDADebugger import IDADebugger
    from IDADebugger import IDADebugger
    from IDADebugger import IDADebugger


### INIT AND LOAD CONTEXT ###

def prepare_trace():
    vmr = get_vmr()
    if vmr.trace is None:
        vmr.trace = load()
    return deepcopy(vmr.trace)

def prepare_vm_ctx():
    vmr = get_vmr()
    return deepcopy(vmr.vm_ctx)

def prepare_vm_operands():
    vmr = get_vmr()
    return deepcopy(vmr.vm_operands)

def load_dbg(choice):
    dbg_handl = get_dh(available_debuggers[choice])
    if dbg_handl.check:
        return dbg_handl
    else:
        raise Exception("[*] Could not load debugger! Please check if the selected debugger is available.")

def load_trace():
    vmr = get_vmr()
    trace = load()
    vmr.trace = trace


# Path: ui/UIManager.py
# class UIManager(object):
#     def __init__(self):
#     def get_init_menu(self):
#     def add_menu(self, name):
#     def remove_menu(self, name):
#     def clear(self):
#     def add_view(self, view):
# 
# Path: ui/UIManager.py
# class UIManager(object):
#     def __init__(self):
#     def get_init_menu(self):
#     def add_menu(self, name):
#     def remove_menu(self, name):
#     def clear(self):
#     def add_view(self, view):
# 
# Path: ui/UIManager.py
# class UIManager(object):
#     def __init__(self):
#     def get_init_menu(self):
#     def add_menu(self, name):
#     def remove_menu(self, name):
#     def clear(self):
#     def add_view(self, view):
# 
# Path: ui/UIManager.py
# class UIManager(object):
#     def __init__(self):
#     def get_init_menu(self):
#     def add_menu(self, name):
#     def remove_menu(self, name):
#     def clear(self):
#     def add_view(self, view):
# 
# Path: lib/VMRepresentation.py
# def get_vmr():
#     """
#     Get the VMR instance.
#     :return: vmr
#     """
#     global vmr
#     if vmr is None:
#         vmr = VMRepresentation()
#     return vmr
# 
# Path: ui/NotifyProgress.py
# class NotifyProgress(QtWidgets.QWidget):
#     def __init__(self, name='current', *args, **kwargs):
#         super(NotifyProgress, self).__init__(*args, **kwargs)
#         self.analysis = name
#         self.pbar = QtWidgets.QProgressBar(self)
#         self.pbar.setGeometry(30, 40, 370, 25)
#         self.value = 0
#         self.setFixedSize(400, 100)
#         self.setWindowTitle('Running %s Analysis...' % self.analysis)
# 
#     def pbar_update(self, value):
#         self.value += value
#         if self.value > 100:
#             self.value = 100
#             self.close()
#         self.pbar.setValue(self.value)
# 
#     def pbar_set(self, value):
#         self.pbar.setValue(value)
# 
# Path: ui/UIManager.py
# class UIManager(object):
#     def __init__(self):
#     def get_init_menu(self):
#     def add_menu(self, name):
#     def remove_menu(self, name):
#     def clear(self):
#     def add_view(self, view):


# Path: dynamic/dynamic_deobfuscate.py
from threading import Thread
from ui.UIManager import GradingViewer
from ui.UIManager import OptimizationViewer
from ui.UIManager import StackChangeViewer
from ui.UIManager import VMInputOuputViewer
from DebuggerHandler import load, save, get_dh
from lib.TraceAnalysis import *
from lib.VMRepresentation import get_vmr
from ui.NotifyProgress import NotifyProgress
from ui.UIManager import ClusterViewer
    from IDADebugger import IDADebugger
    from OllyDebugger import OllyDebugger
    from IDADebugger import IDADebugger
    from IDADebugger import IDADebugger
    from IDADebugger import IDADebugger



### INIT AND LOAD CONTEXT ###

def prepare_trace():
    vmr = get_vmr()
    if vmr.trace is None:
        vmr.trace = load()
    return deepcopy(vmr.trace)

def prepare_vm_ctx():
    vmr = get_vmr()
    return deepcopy(vmr.vm_ctx)

def prepare_vm_operands():
    vmr = get_vmr()
    return deepcopy(vmr.vm_operands)

def load_dbg(choice):
    dbg_handl = get_dh(available_debuggers[choice])
    if dbg_handl.check:
        return dbg_handl
    else:
        raise Exception("[*] Could not load debugger! Please check if the selected debugger is available.")

def load_trace():
    vmr = get_vmr()
    trace = load()
    vmr.trace = trace


def save_trace():