From e60d4ff8098bb88d93fb893b8027434e848427a5 Mon Sep 17 00:00:00 2001 From: Andris Raugulis Date: Thu, 13 Oct 2016 17:53:39 +0300 Subject: [PATCH] Add kex/pkm payload generation. --- ssh-audit.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/ssh-audit.py b/ssh-audit.py index 221f341..422abc3 100755 --- a/ssh-audit.py +++ b/ssh-audit.py @@ -247,6 +247,27 @@ class SSH2(object): def unused(self): return self.__unused + def write(self, wbuf): + wbuf.write(self.cookie) + wbuf.write_list(self.kex_algorithms) + wbuf.write_list(self.key_algorithms) + wbuf.write_list(self.client.encryption) + wbuf.write_list(self.server.encryption) + wbuf.write_list(self.client.mac) + wbuf.write_list(self.server.mac) + wbuf.write_list(self.client.compression) + wbuf.write_list(self.server.compression) + wbuf.write_list(self.client.languages) + wbuf.write_list(self.server.languages) + wbuf.write_bool(self.follows) + wbuf.write_int(self.__unused) + + @property + def payload(self): + wbuf = WriteBuf() + self.write(wbuf) + return wbuf.write_flush() + @classmethod def parse(cls, payload): buf = ReadBuf(payload) @@ -403,6 +424,24 @@ class SSH1(object): auths.append(SSH1.AUTHS[i]) return auths + def write(self, wbuf): + wbuf.write(self.cookie) + wbuf.write_int(self.server_key_bits) + wbuf.write_mpint1(self.server_key_public_exponent) + wbuf.write_mpint1(self.server_key_public_modulus) + wbuf.write_int(self.host_key_bits) + wbuf.write_mpint1(self.host_key_public_exponent) + wbuf.write_mpint1(self.host_key_public_modulus) + wbuf.write_int(self.protocol_flags) + wbuf.write_int(self.supported_ciphers_mask) + wbuf.write_int(self.supported_authentications_mask) + + @property + def payload(self): + wbuf = WriteBuf() + self.write(wbuf) + return wbuf.write_flush() + @classmethod def parse(cls, payload): buf = ReadBuf(payload)