def test_getData(self): smb = SMBConnection('*SMBSERVER', self.machine, preferredDialect = self.dialects) smb.login(self.username, self.password, self.domain) smb.getDialect() smb.getServerName() smb.getRemoteHost() smb.getServerDomain() smb.getServerOS() smb.doesSupportNTLMv2() smb.isLoginRequired() smb.logoff()
def test_getDialect(self): smb = SMBConnection('*SMBSERVER', self.machine, preferredDialect=self.dialects) smb.login(self.username, self.password, self.domain) dialect = smb.getDialect() self.assertTrue(dialect == self.dialects) smb.logoff()
def get_dialect(smb): dialect = smb.getDialect() if dialect == SMB_DIALECT: return "SMBv1" elif dialect == SMB2_DIALECT_002: return "SMBv2.0" elif dialect == SMB2_DIALECT_21: return "SMBv2.1" else: return "SMBv3.0 (%s)" % dialect
def smbVersion(rhost): host = rhost port=445 try: smb = SMBConnection(host, host, sess_port=port) except NetBIOSError: return except socket.error as v: error_code = v[0] if error_code == errno.ECONNREFUSED: return else: return dialect = smb.getDialect() if dialect == SMB_DIALECT: print(host + "\tSMBv1\tXP/Win2003") elif dialect == SMB2_DIALECT_002: print(host + "\tSMBv2.0\tVista/2008") elif dialect == SMB2_DIALECT_21: print(host + "\tSMBv2.1\tWin7/2008") else: print(host + "\tSMBv3.0\tWin10/2012/2016/2019")
def test_getDialect(self): smb = SMBConnection('*SMBSERVER', self.machine, preferredDialect = self.dialects) smb.login(self.username, self.password, self.domain) dialect = smb.getDialect() self.assertTrue( dialect == self.dialects) smb.logoff()
def smbVersion(rhost): host = rhost port = 445 try: smb = SMBConnection(host, host, sess_port=port) except NetBIOSError: return except socket.error, v: error_code = v[0] if error_code == errno.ECONNREFUSED: return else: return dialect = smb.getDialect() if dialect == SMB_DIALECT: print(host + "\tSMBv1 ") elif dialect == SMB2_DIALECT_002: print(host + "\tSMBv2.0 ") elif dialect == SMB2_DIALECT_21: print(host + "\tSMBv2.1 ") else: print(host + "\tSMBv3.0 ") ipc = "" if __name__ == '__main__': print('Ladon Scanner 1.0') parser = argparse.ArgumentParser()