예제 #1
0
 def create_type_ascii(self,
                       value=None,
                       nb_char_min=None,
                       nb_char_max=None):
     return Serializer.datatype_to_json(
         self.__project.create_type_ascii(value=value,
                                          nb_char_min=nb_char_min,
                                          nb_char_max=nb_char_max))
예제 #2
0
    def get_domain(self, did):
        if did is None:
            raise ValueError("A DID must be specified")

        did = str(did).strip()
        if len(did) == 0:
            raise ValueError("A DID must be specified")

        return Serializer.domain_to_json(self.__project.get_domain(did=did))
예제 #3
0
    def get_capture(self, cid):
        if cid is None:
            raise ValueError("A CID must be specified")

        cid = str(cid).strip()
        if len(cid) == 0:
            raise ValueError("A CID must be specified")

        return Serializer.capture_to_json(self.__project.get_capture(cid=cid))
예제 #4
0
    def get_symbol(self, sid):
        if sid is None:
            raise ValueError("A SID must be specified")

        sid = str(sid).strip()
        if len(sid) == 0:
            raise ValueError("A SID must be specified")

        return Serializer.symbol_to_json(self.__project.get_symbol(sid=sid))
예제 #5
0
    def get_message(self, mid):
        if mid is None:
            raise ValueError("A MID must be specified")

        mid = str(mid).strip()
        if len(mid) == 0:
            raise ValueError("A MID must be specified")

        return Serializer.message_to_json(self.__project.get_message(mid=mid))
예제 #6
0
    def get_field(self, fid):

        if fid is None:
            raise ValueError("A FID must be specified")

        fid = str(fid).strip()
        if len(fid) == 0:
            raise ValueError("A FID must be specified")

        return Serializer.field_to_json(self.__project.get_field(fid))
예제 #7
0
    def get_datatype(self, tid):
        if tid is None:
            raise ValueError("A TID must be specified")

        tid = str(tid).strip()
        if len(tid) == 0:
            raise ValueError("A TID must be specified")

        return Serializer.datatype_to_json(
            self.__project.get_datatype(tid=tid))
예제 #8
0
    def add_symbol(self, name):

        if name is None:
            raise ValueError("A name must be specified")

        name = str(name).strip()
        if len(name) == 0:
            raise ValueError("A name must be specified")

        x = Serializer.symbol_to_json(self.__project.create_symbol(name=name))
        return x
예제 #9
0
    def add_capture(self, name, date=None):

        if name is None:
            raise ValueError("A name must be specified")

        name = str(name).strip()
        if len(name) == 0:
            raise ValueError("A name must be specified")

        return Serializer.capture_to_json(
            self.__project.create_capture(name=name, date=date))
예제 #10
0
    def get_domains_in_aggregate(self, aid, limit, offset):
        if aid is None:
            raise ValueError("A AID must be specified")

        aid = str(aid).strip()
        if len(aid) == 0:
            raise ValueError("A AID must be specified")

        return [
            Serializer.domain_to_json(domain)
            for domain in self.__project.get_domains_in_aggregate(
                aid=aid, limit=limit, offset=offset)
        ]
예제 #11
0
    def get_messages_in_capture(self, cid, limit, offset):

        if cid is None:
            raise ValueError("A CID must be specified")

        cid = str(cid).strip()
        if len(cid) == 0:
            raise ValueError("A CID must be specified")

        return [
            Serializer.message_to_json(message) for message in
            self.__project.get_capture(cid).messages[offset:offset + limit]
        ]
예제 #12
0
    def get_symbol_fields(self, sid, limit, offset):
        if sid is None:
            raise ValueError("A SID must be specified")

        sid = str(sid).strip()
        if len(sid) == 0:
            raise ValueError("A SID must be specified")

        return [
            Serializer.field_to_json(field)
            for field in self.__project.get_symbol_fields(
                sid=sid, limit=limit, offset=offset)
        ]
예제 #13
0
    def remove_domain_in_aggregate(self, aid, did):
        if aid is None:
            raise ValueError("A AID must be specified")

        aid = str(aid).strip()
        if len(aid) == 0:
            raise ValueError("A AID must be specified")

        if did is None:
            raise ValueError("A AID must be specified")

        did = str(did).strip()
        if len(did) == 0:
            raise ValueError("A DID must be specified")

        return Serializer.domain_to_json(
            self.__project.remove_domain_in_aggregate(aid=aid, did=did))
예제 #14
0
    def create_domain_data(self, name, tid):
        if name is None:
            raise ValueError("A name must be specified")

        name = str(name).strip()
        if len(name) == 0:
            raise ValueError("A name must be specified")

        if tid is None:
            raise ValueError("A TID must be specified")

        tid = str(tid).strip()
        if len(tid) == 0:
            raise ValueError("A TID must be specified")

        return Serializer.domain_to_json(
            self.__project.create_domain_data(name=name, tid=tid))
예제 #15
0
    def update_symbol(self, sid, name):
        if sid is None:
            raise ValueError("A SID must be specified")

        sid = str(sid).strip()
        if len(sid) == 0:
            raise ValueError("A SID must be specified")

        if name is None:
            raise ValueError("A name must be specified")

        name = str(name).strip()
        if len(name) == 0:
            raise ValueError("A name must be specified")

        return Serializer.symbol_to_json(
            self.__project.update_symbol(sid=sid, name=name))
예제 #16
0
    def add_message(self, cid, data, date=None, source=None, destination=None):

        if cid is None:
            raise ValueError("A CID must be specified")

        if data is None:
            raise ValueError("A data must be specified")

        data = str(data).strip()
        if len(data) == 0:
            raise ValueError("A data must be specified")

        return Serializer.message_to_json(
            self.__project.create_message(cid=cid,
                                          data=data,
                                          date=date,
                                          source=source,
                                          destination=destination))
예제 #17
0
    def add_field(self, name, did):
        if name is None:
            raise ValueError("A name must be specified")

        name = str(name).strip()
        if len(name) == 0:
            raise ValueError("A name must be specified")

        if did is None:
            raise ValueError("A DID must be specified")

        did = str(did).strip()
        if len(did) == 0:
            raise ValueError("A DID must be specified")

        x = Serializer.field_to_json(
            self.__project.create_field(name=name, did=did))
        return x
예제 #18
0
 def get_symbols(self, limit, offset):
     return [
         Serializer.symbol_to_json(symbol)
         for symbol in self.__project.get_symbols(limit, offset)
     ]
예제 #19
0
 def get_fields(self, limit, offset):
     return [
         Serializer.field_to_json(field)
         for field in self.__project.get_fields(limit, offset)
     ]
예제 #20
0
 def create_domain_aggregate(self):
     return Serializer.domain_to_json(
         self.__project.create_domain_aggregate())
예제 #21
0
 def get_messages(self, limit, offset):
     return [
         Serializer.message_to_json(message)
         for message in self.__project.get_messages(limit, offset)
     ]
예제 #22
0
 def get_captures(self, limit, offset):
     return [
         Serializer.capture_to_json(capture)
         for capture in self.__project.get_captures(limit, offset)
     ]
예제 #23
0
 def create_type_raw(self, value=None, nb_byte_min=None, nb_byte_max=None):
     return Serializer.datatype_to_json(
         self.__project.create_type_raw(value=value,
                                        nb_byte_min=nb_byte_min,
                                        nb_byte_max=nb_byte_max))
예제 #24
0
 def get_datatypes(self, limit, offset):
     return [
         Serializer.datatype_to_json(domain)
         for domain in self.__project.get_datatypes(limit, offset)
     ]