Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_client(self):
"""Creates a client connecting to the localhost server."""
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_port = self.read_or_generate_server_port()
try:
sock.connect(('127.0.0.1', server_port))
self.client = Client(sock, self)
self.client_created.emit(self.client)
except socket.error:
sock.close()
raise Exception("No server found")
from .project import Project
def launch_ida_gui_instance(idb_path):
"""Launches a fresh IDA instance, opening the given IDB."""
return subprocess.Popen([sys.executable, idb_path])
class Continuum(QObject):
"""
Plugin core class, providing functionality required for both, the
analysis stub and the full GUI instance version.
"""
project_opened = pyqtSignal([Project])
project_closing = pyqtSignal()
client_created = pyqtSignal([Client])
def __init__(self):
super(Continuum, self).__init__()
self.project = None
self.client = None
self.server = None
self._timer = None
# Sign up for events.
idaapi.notify_when(idaapi.NW_OPENIDB, self.handle_open_idb)
idaapi.notify_when(idaapi.NW_CLOSEIDB, self.handle_close_idb)
def create_server_if_none(self):
"""Creates a localhost server if none is alive, yet."""
# Server alive?