How to use the continuum.proto.ProtoMixin function in continuum

To help you get started, we’ve selected a few continuum examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zyantific / continuum / continuum / client.py View on Github external
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.
"""

from __future__ import absolute_import, print_function, division

import sys
import asyncore
from idc import *
from idautils import *
from .proto import ProtoMixin
from PyQt5.QtCore import QObject, pyqtSignal


class Client(QObject, ProtoMixin, asyncore.dispatcher_with_send):
    """Client class for the localhost network."""
    client_analysis_state_updated = pyqtSignal([str, str])  # idb_path, state
    sync_types = pyqtSignal([bool])  # purge_non_indexed

    def __init__(self, sock, core):
        asyncore.dispatcher_with_send.__init__(self, sock=sock)
        ProtoMixin.__init__(self)
        QObject.__init__(self)
        self.core = core
        self.idb_path = GetIdbPath()

        self.send_packet({
            'kind': 'new_client',
            'input_file': GetInputFile(),
            'idb_path': GetIdbPath(),
            'pid': os.getpid(),
github zyantific / continuum / continuum / server.py View on Github external
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.
"""
from __future__ import absolute_import, print_function, division

import asyncore
import socket
from idc import *
from idautils import *
from collections import defaultdict
from .proto import ProtoMixin
from PyQt5.QtCore import QObject, pyqtSignal


class ClientConnection(ProtoMixin, asyncore.dispatcher_with_send):
    """Represents a client that is connected to the localhost server."""
    def __init__(self, sock, server):
        # We need to use old-style init calls here because asyncore 
        # consists of old-style classes :(
        asyncore.dispatcher_with_send.__init__(self, sock=sock)
        ProtoMixin.__init__(self)

        self.input_file = None
        self.idb_path = None
        self.server = server
        self.project = server.core.project
        self.server.clients.add(self)

    def handle_close(self):
        self.server.clients.remove(self)
        self.server.update_idb_client_map()