def parse(self): super().parse() i = 1 l, self.host_key = sshtype.parseBinary(self.buf[i:]) i += l l, self.f = sshtype.parseMpint(self.buf[i:]) i += l l, self.signature = sshtype.parseBinary(self.buf[i:])
def parse(self): super().parse() i = 1 l, self.algorithm_name = sshtype.parseString(self.buf[i:]) i += l l, self.public_key = sshtype.parseBinary(self.buf[i:])
def parse(self): super().parse() i = 1 if i + 1 == len(self.buf): self.data_present = struct.unpack("?", self.buf[i : i + 1])[0] else: l, self.first_id = sshtype.parseBinary(self.buf[i:])
def parse(self): super().parse() i = 1 if i + 1 == len(self.buf): self.data_present = struct.unpack("?", self.buf[i:i + 1])[0] else: l, self.first_id = sshtype.parseBinary(self.buf[i:])
def parse(self): super().parse() i = 1 l, self.data = sshtype.parseBinary(self.buf[i:]) i += l self.targeted = struct.unpack_from("?", self.buf, i)[0] i += 1 if i == len(self.buf): return l, self.pubkey = sshtype.parseBinary(self.buf[i:]) i += l l, self.path_hash = sshtype.parseBinary(self.buf[i:]) i += l l, self.version = sshtype.parseMpint(self.buf[i:]) i += l l, self.signature = sshtype.parseBinary(self.buf[i:])
def parse(self): super().parse() i = 1 pcnt = struct.unpack(">L", self.buf[i:i + 4])[0] i += 4 self.peers = [] for n in range(pcnt): if log.isEnabledFor(logging.DEBUG): log.debug("Reading record {}.".format(n)) peer = Peer() # db.Peer. l, peer.address = sshtype.parseString(self.buf[i:]) i += l l, peer.node_id = sshtype.parseBinary(self.buf[i:]) i += l l, peer.pubkey = sshtype.parseBinary(self.buf[i:]) i += l self.peers.append(peer)
def parse(self): super().parse() i = 1 pcnt = struct.unpack(">L", self.buf[i : i + 4])[0] i += 4 self.peers = [] for n in range(pcnt): if log.isEnabledFor(logging.DEBUG): log.debug("Reading record {}.".format(n)) peer = Peer() # db.Peer. l, peer.address = sshtype.parseString(self.buf[i:]) i += l l, peer.node_id = sshtype.parseBinary(self.buf[i:]) i += l l, peer.pubkey = sshtype.parseBinary(self.buf[i:]) i += l self.peers.append(peer)
def parse(self): super().parse() i = 1 l, self.user_name = sshtype.parseString(self.buf[i:]) i += l l, self.service_name = sshtype.parseString(self.buf[i:]) i += l l, self.method_name = sshtype.parseString(self.buf[i:]) i += l if self.method_name == "publickey": self.signature_present = struct.unpack("?", self.buf[i:i + 1])[0] i += 1 l, self.algorithm_name = sshtype.parseString(self.buf[i:]) i += l l, self.public_key = sshtype.parseBinary(self.buf[i:]) if self.signature_present: i += l l, self.signature = sshtype.parseBinary(self.buf[i:]) self.signature_length = l
def parse(self): super().parse() i = 1 l, self.user_name = sshtype.parseString(self.buf[i:]) i += l l, self.service_name = sshtype.parseString(self.buf[i:]) i += l l, self.method_name = sshtype.parseString(self.buf[i:]) i += l if self.method_name == "publickey": self.signature_present = struct.unpack("?", self.buf[i:i+1])[0] i += 1 l, self.algorithm_name = sshtype.parseString(self.buf[i:]) i += l l, self.public_key = sshtype.parseBinary(self.buf[i:]) if self.signature_present: i += l l, self.signature = sshtype.parseBinary(self.buf[i:]) self.signature_length = l
def parse(self): super().parse() i = 1 l, self.data = sshtype.parseBinary(self.buf[i:]) i += l self.original_size = struct.unpack(">L", self.buf[i:i + 4])[0] i += 4 if i == len(self.buf): return l, self.version = sshtype.parseMpint(self.buf[i:]) i += l l, self.signature = sshtype.parseBinary(self.buf[i:]) i += l if i == len(self.buf): return l, self.epubkey = sshtype.parseBinary(self.buf[i:]) i += l self.pubkeylen = struct.unpack(">L", self.buf[i:i + 4])[0]
def parse(self): super().parse() i = 1 self.index = struct.unpack(">L", self.buf[i:i + 4])[0] i += 4 cnt = struct.unpack(">L", self.buf[i:i + 4])[0] i += 4 self.packets = [] for n in range(cnt): l, packet = sshtype.parseBinary(self.buf[i:]) i += l self.packets.append(packet)
def parse(self): super().parse() i = 1 self.index = struct.unpack(">L", self.buf[i : i + 4])[0] i += 4 cnt = struct.unpack(">L", self.buf[i : i + 4])[0] i += 4 self.packets = [] for n in range(cnt): l, packet = sshtype.parseBinary(self.buf[i:]) i += l self.packets.append(packet)
def parse(self): super().parse() i = 1 l, self.data = sshtype.parseBinary(self.buf[i:]) i += l self.original_size = struct.unpack(">L", self.buf[i : i + 4])[0] i += 4 if i == len(self.buf): return l, self.version = sshtype.parseMpint(self.buf[i:]) i += l l, self.signature = sshtype.parseBinary(self.buf[i:]) i += l if i == len(self.buf): return l, self.epubkey = sshtype.parseBinary(self.buf[i:]) i += l self.pubkeylen = struct.unpack(">L", self.buf[i : i + 4])[0]
def verify_ssh_sig(self, key_data, sig_msg): i, v = sshtype.parseString(sig_msg) if v != "ssh-rsa": log.warning("Not an ssh-rsa signature!") return False if log.isEnabledFor(logging.DEBUG): log.debug("l[{}][{}]".format(i, len(sig_msg))) sig = util.inflate_long(sshtype.parseBinary(sig_msg[i:])[1], True) # verify the signature by SHA'ing the key_data and encrypting it using the # public key. some wackiness ensues where we "pkcs1imify" the 20-byte # hash into a string as long as the RSA key. if log.isEnabledFor(logging.DEBUG): log.debug("sig=[{}].".format(sig)) hash_obj = util.inflate_long(self._pkcs1imify(sha1(key_data).digest()), True) rsa = self._public_key() return rsa.verify(hash_obj, (sig,))
def verify_ssh_sig(self, key_data, sig_msg): i, v = sshtype.parseString(sig_msg) if v != 'ssh-rsa': log.warning("Not an ssh-rsa signature!") return False if log.isEnabledFor(logging.DEBUG): log.debug("l[{}][{}]".format(i, len(sig_msg))) sig = util.inflate_long(sshtype.parseBinary(sig_msg[i:])[1], True) # verify the signature by SHA'ing the key_data and encrypting it using the # public key. some wackiness ensues where we "pkcs1imify" the 20-byte # hash into a string as long as the RSA key. if log.isEnabledFor(logging.DEBUG): log.debug("sig=[{}].".format(sig)) hash_obj = util.inflate_long(self._pkcs1imify(sha1(key_data).digest()), True) rsa = self._public_key() return rsa.verify(hash_obj, (sig, ))
def parse(self): super().parse() i = 1 l, self.node_id = sshtype.parseBinary(self.buf[i:]) i += l self.data_mode = DataMode(struct.unpack("B", self.buf[i:i + 1])[0]) i += 1 has_version = struct.unpack_from("?", self.buf, i)[0] i += 1 if has_version: i, self.version = sshtype.parse_mpint_from(self.buf, i) if i == len(self.buf): return self.significant_bits = struct.unpack(">H", self.buf[i:i + 2])[0] i += 2 if i == len(self.buf): return i, self.target_key = sshtype.parse_binary_from(self.buf, i)
def parse(self): super().parse() i = 1 l, self.node_id = sshtype.parseBinary(self.buf[i:]) i += l self.data_mode = DataMode(struct.unpack("B", self.buf[i : i + 1])[0]) i += 1 has_version = struct.unpack_from("?", self.buf, i)[0] i += 1 if has_version: i, self.version = sshtype.parse_mpint_from(self.buf, i) if i == len(self.buf): return self.significant_bits = struct.unpack(">H", self.buf[i : i + 2])[0] i += 2 if i == len(self.buf): return i, self.target_key = sshtype.parse_binary_from(self.buf, i)
def parse(self): super().parse() i = 1 l, self.data = sshtype.parseBinary(self.buf[i:]) i += l self.targeted = struct.unpack_from("?", self.buf, i)[0]
def parse(self): i = 1 l, self.value = sshtype.parseBinary(self.buf)