mirror of
				https://github.com/jtesta/ssh-audit.git
				synced 2025-11-03 18:52:15 +01:00 
			
		
		
		
	Added debugging output for key exchanges.
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
			
		||||
"""
 | 
			
		||||
   The MIT License (MIT)
 | 
			
		||||
 | 
			
		||||
   Copyright (C) 2017-2020 Joe Testa (jtesta@positronsecurity.com)
 | 
			
		||||
   Copyright (C) 2017-2024 Joe Testa (jtesta@positronsecurity.com)
 | 
			
		||||
   Copyright (C) 2017 Andris Raugulis (moo@arthepsy.eu)
 | 
			
		||||
 | 
			
		||||
   Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
@@ -132,3 +132,16 @@ class SSH2_Kex:
 | 
			
		||||
        srv = SSH2_KexParty(srv_enc, srv_mac, srv_compression, srv_languages)
 | 
			
		||||
        kex = cls(outputbuffer, cookie, kex_algs, key_algs, cli, srv, follows, unused)
 | 
			
		||||
        return kex
 | 
			
		||||
 | 
			
		||||
    def __str__(self) -> str:
 | 
			
		||||
        ret = "----\nSSH2_Kex object:"
 | 
			
		||||
        ret += "\nHost keys: "
 | 
			
		||||
        ret += ", ".join(self.__key_algs)
 | 
			
		||||
        ret += "\nKey exchanges: "
 | 
			
		||||
        ret += ", ".join(self.__kex_algs)
 | 
			
		||||
        ret += "\nClient SSH2_KexParty:"
 | 
			
		||||
        ret += "\n" + str(self.__client)
 | 
			
		||||
        ret += "\nServer SSH2_KexParty:"
 | 
			
		||||
        ret += "\n" + str(self.__server)
 | 
			
		||||
        ret += "\n----"
 | 
			
		||||
        return ret
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
"""
 | 
			
		||||
   The MIT License (MIT)
 | 
			
		||||
 | 
			
		||||
   Copyright (C) 2024 Joe Testa (jtesta@positronsecurity.com)
 | 
			
		||||
   Copyright (C) 2017 Andris Raugulis (moo@arthepsy.eu)
 | 
			
		||||
 | 
			
		||||
   Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
@@ -48,3 +49,10 @@ class SSH2_KexParty:
 | 
			
		||||
    @property
 | 
			
		||||
    def languages(self) -> List[str]:
 | 
			
		||||
        return self.__languages
 | 
			
		||||
 | 
			
		||||
    def __str__(self) -> str:
 | 
			
		||||
        ret = "Ciphers: " + ", ".join(self.__enc)
 | 
			
		||||
        ret += "\nMACs: " + ", ".join(self.__mac)
 | 
			
		||||
        ret += "\nCompressions: " + ", ".join(self.__compression)
 | 
			
		||||
        ret += "\nLanguages: " + ", ".join(self.__languages)
 | 
			
		||||
        return ret
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
"""
 | 
			
		||||
   The MIT License (MIT)
 | 
			
		||||
 | 
			
		||||
   Copyright (C) 2017-2023 Joe Testa (jtesta@positronsecurity.com)
 | 
			
		||||
   Copyright (C) 2017-2024 Joe Testa (jtesta@positronsecurity.com)
 | 
			
		||||
   Copyright (C) 2017 Andris Raugulis (moo@arthepsy.eu)
 | 
			
		||||
 | 
			
		||||
   Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
@@ -1317,6 +1317,7 @@ def audit(out: OutputBuffer, aconf: AuditConf, sshv: Optional[int] = None, print
 | 
			
		||||
    elif sshv == 2:
 | 
			
		||||
        try:
 | 
			
		||||
            kex = SSH2_Kex.parse(out, payload)
 | 
			
		||||
            out.d(str(kex))
 | 
			
		||||
        except Exception:
 | 
			
		||||
            out.fail("Failed to parse server's kex.  Stack trace:\n%s" % str(traceback.format_exc()))
 | 
			
		||||
            return exitcodes.CONNECTION_ERROR
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user