コード例 #1
0
    def parse(self):
        super().parse()

        i = 1
        i, self.sender_address = sshtype.parse_string_from(self.buf, i)
        if i == len(self.buf):
            return
        if len(self.buf) - i > 64:
            raise ChordException("Version string in packet is too long.")
        i, self.version = sshtype.parse_string_from(self.buf, i)
コード例 #2
0
ファイル: chord_packet.py プロジェクト: tailsjoin/morphis
    def parse(self):
        super().parse()

        i = 1
        i, self.sender_address = sshtype.parse_string_from(self.buf, i)
        if i == len(self.buf):
            return
        if len(self.buf) - i > 64:
            raise ChordException("Version string in packet is too long.")
        i, self.version = sshtype.parse_string_from(self.buf, i)
コード例 #3
0
ファイル: dmail.py プロジェクト: tailsjoin/morphis
    def parse_from(self, buf, idx, length=None):
        if not length:
            length = len(buf)

        self.version = struct.unpack_from(">L", buf, idx)[0]
        idx += 4
        idx, self.sender_pubkey = sshtype.parse_binary_from(buf, idx)
        idx, self.subject = sshtype.parse_string_from(buf, idx)
        idx, self.date = sshtype.parse_string_from(buf, idx)

        while idx < length:
            part = DmailPart()
            idx = part.parse_from(buf, idx)
            self.parts.append(part)

        return idx
コード例 #4
0
    def parse_from(self, buf, idx, length=None):
        if not length:
            length = len(buf)

        self.version = struct.unpack_from(">L", buf, idx)[0]
        idx += 4
        idx, self.sender_pubkey = sshtype.parse_binary_from(buf, idx)
        idx, self.subject = sshtype.parse_string_from(buf, idx)
        idx, self.date = sshtype.parse_string_from(buf, idx)

        while idx < length:
            part = DmailPart()
            idx = part.parse_from(buf, idx)
            self.parts.append(part)

        return idx
コード例 #5
0
    def parse_from(self, buf, idx):
        self.version = struct.unpack_from(">L", buf, idx)[0]
        idx += 4
        idx, self.sender_pubkey = sshtype.parse_binary_from(buf, idx)
        idx, self.destination_addr = sshtype.parse_binary_from(buf, idx)
        idx, self.subject = sshtype.parse_string_from(buf, idx)
        idx, self.date = sshtype.parse_string_from(buf, idx)

        part_cnt = struct.unpack_from(">H", buf, idx)[0]
        idx += 2

        for i in range(part_cnt):
            part = DmailPart()
            idx = part.parse_from(buf, idx)
            self.parts.append(part)

        self.signature_offset = idx
        idx, self.signature = sshtype.parse_binary_from(buf, idx)

        return idx
コード例 #6
0
    def parse_from(self, buf, idx):
        self.version = struct.unpack_from(">L", buf, idx)[0]
        idx += 4
        idx, self.ssm = sshtype.parse_string_from(buf, idx)
        idx, self.sse = sshtype.parse_mpint_from(buf, idx)
        idx, self.ssf = sshtype.parse_mpint_from(buf, idx)

        self.data_len = struct.unpack_from(">L", buf, idx)[0]
        idx += 4

        self.data_enc = buf[idx:]

        return idx
コード例 #7
0
ファイル: dmail.py プロジェクト: tailsjoin/morphis
    def parse_from(self, buf, idx):
        self.version = struct.unpack_from(">L", buf, idx)[0]
        idx += 4
        idx, self.ssm = sshtype.parse_string_from(buf, idx)
        idx, self.sse = sshtype.parse_mpint_from(buf, idx)
        idx, self.ssf = sshtype.parse_mpint_from(buf, idx)

        idx, self.signature = sshtype.parse_binary_from(buf, idx)

        self.data_len = struct.unpack_from(">L", buf, idx)[0]
        idx += 4

        self.data_enc = buf[idx:]

        return idx
コード例 #8
0
ファイル: dmail.py プロジェクト: tailsjoin/morphis
 def parse_from(self, buf, idx):
     idx, self.mime_type = sshtype.parse_string_from(buf, idx)
     idx, self.data = sshtype.parse_binary_from(buf, idx)
     return idx
コード例 #9
0
ファイル: multipart.py プロジェクト: fps/morphis-mirror
    def parse(self):
        i = super().parse()

        i, self.mime_type = sshtype.parse_string_from(self.buf, i)
        self.destination = self.buf[i:]
コード例 #10
0
 def parse_from(self, buf, idx):
     idx, self.mime_type = sshtype.parse_string_from(buf, idx)
     idx, self.data = sshtype.parse_binary_from(buf, idx)
     return idx
コード例 #11
0
    def parse(self):
        i = super().parse()

        i, self.mime_type = sshtype.parse_string_from(self.buf, i)
        self.destination = self.buf[i:]