when debugging code with name mangling, I came across this behavior
(Pdb) l 2404 # To start an ED25519 kex, we simply send a random 256-bit number as the 2405 # public key. 2406 def send_init(self, s, init_msg=SSH.Protocol.MSG_KEXDH_INIT): 2407 self.__ed25519_pubkey = os.urandom(32) 2408 breakpoint() 2409 -> s.write_byte(init_msg) 2410 s.write_string(self.__ed25519_pubkey) 2411 s.send_packet() 2412 2413 2414 class KexNISTP256(KexDH): (Pdb) self.__ed25519_pubkey *** AttributeError: 'KexCurve25519_SHA256' object has no attribute '__ed25519_pubkey' (Pdb) self._KexCurve25519_SHA256__ed25519_pubkey b'\x1f\tK\x96s5\xf1\x9e\xc4|\x87\x96B\xcbI\xb4\x06\xbfe\xa2\xa0\x0e\xd0>\x92\xf9h\x8e\xdarQX' (Pdb)
While I know you cannot access a mangled attribute from outside with its “real name”, only with its mangled one, accessing it via
self.__name seems pretty… inner
Is this a limitation of pdb or even a bug, or is this working as intended?
Or in other words…
Why is my
self.__ed25519_pubkey in pdb failing, but just the next line (2410) it is working?
Thanks for any help!