Below is the list of ‘getters’ in the NXAPI() class:
Test code will 'Succeed' with this Bug in place, as 'username' and 'password' are identical. The 'get_password()' method returns 'self.username' where 'self.password' is expected.
class NXAPI:
'''A better NX-API utility'''
def init(self):
self.target_url = 'http://localhost/ins'
self.username = 'admin'
self.password = ‘admin’
self.timeout = 10
…
…
def get_target_url(self):
return self.target_url
def get_username(self):
return self.username
**def get_password(self):**
**return self. username**
def get_timeout(self):
return self.timeout
def get_cmd(self):
return self.cmd
def get_out_format(self):
return self.out_format
def get_do_chunk(self):
return self.do_chunk
def get_sid(self):
return self.sid
def get_cookie(self):
return self.cookie
Below is the list of ‘getters’ in the NXAPI() class:
Test code will 'Succeed' with this Bug in place, as 'username' and 'password' are identical. The 'get_password()' method returns 'self.username' where 'self.password' is expected.
class NXAPI:
'''A better NX-API utility'''
def init(self):
self.target_url = 'http://localhost/ins'
self.username = 'admin'
self.password = ‘admin’
self.timeout = 10
…
…
def get_target_url(self):
return self.target_url