Example #1
0
 def test_getServerDomain(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     serverDomain = smb.getServerDomain()
     self.assertTrue(
         serverDomain.upper() == self.domain.upper().split('.')[0])
     smb.logoff()
Example #2
0
 def test_connection(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     credentials = smb.getCredentials()
     self.assertTrue( credentials == (self.username, self.password, self.domain, '','','', None, None))
     smb.logoff()
     del(smb)
Example #3
0
 def test_loginHashes(self):
     lmhash, nthash = self.hashes.split(':')
     smb = self.create_connection()
     smb.login(self.username, '', self.domain, lmhash, nthash)
     credentials = smb.getCredentials()
     self.assertTrue( credentials == (self.username, '', self.domain, unhexlify(lmhash), unhexlify(nthash), '', None, None) )
     smb.logoff()
Example #4
0
 def test_loginKerberosAES(self):
     smb = self.create_connection()
     smb.kerberosLogin(self.username, '', self.domain, '', '', self.aesKey)
     credentials = smb.getCredentials()
     self.assertTrue( credentials == (self.username, '', self.domain, '','',self.aesKey, None, None) )
     UNC = '\\\\%s\\%s' % (self.machine, self.share)
     tid = smb.connectTree(UNC)
     smb.logoff()
Example #5
0
 def test_connection(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     credentials = smb.getCredentials()
     self.assertTrue(credentials == (self.username, self.password,
                                     self.domain, '', '', '', None, None))
     smb.logoff()
     del (smb)
Example #6
0
 def test_loginHashes(self):
     lmhash, nthash = self.hashes.split(':')
     smb = self.create_connection()
     smb.login(self.username, '', self.domain, lmhash, nthash)
     credentials = smb.getCredentials()
     self.assertTrue(credentials == (self.username, '', self.domain,
                                     unhexlify(lmhash), unhexlify(nthash),
                                     '', None, None))
     smb.logoff()
Example #7
0
 def test_loginKerberosAES(self):
     smb = self.create_connection()
     smb.kerberosLogin(self.username, '', self.domain, '', '', self.aesKey)
     credentials = smb.getCredentials()
     self.assertTrue(credentials == (self.username, '', self.domain, '', '',
                                     self.aesKey, None, None))
     UNC = '\\\\%s\\%s' % (self.machine, self.share)
     tid = smb.connectTree(UNC)
     smb.logoff()
Example #8
0
 def test_loginKerberosHashes(self):
     lmhash, nthash = self.hashes.split(':')
     smb = self.create_connection()
     smb.kerberosLogin(self.username, '', self.domain, lmhash, nthash, '')
     credentials = smb.getCredentials()
     self.assertTrue( credentials == (self.username, '', self.domain, unhexlify(lmhash), unhexlify(nthash), '', None, None) )
     UNC = '\\\\%s\\%s' % (self.machine, self.share)
     tid = smb.connectTree(UNC)
     smb.logoff()
Example #9
0
 def test_createFile(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     tid = smb.connectTree(self.share)
     fid = smb.createFile(tid, self.file)
     smb.closeFile(tid,fid)
     smb.rename(self.share, self.file, self.file + '.bak')
     smb.deleteFile(self.share, self.file + '.bak')
     smb.disconnectTree(tid)
     smb.logoff()
Example #10
0
 def test_createFile(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     tid = smb.connectTree(self.share)
     fid = smb.createFile(tid, self.file)
     smb.closeFile(tid, fid)
     smb.rename(self.share, self.file, self.file + '.bak')
     smb.deleteFile(self.share, self.file + '.bak')
     smb.disconnectTree(tid)
     smb.logoff()
Example #11
0
 def test_loginKerberosHashes(self):
     lmhash, nthash = self.hashes.split(':')
     smb = self.create_connection()
     smb.kerberosLogin(self.username, '', self.domain, lmhash, nthash, '')
     credentials = smb.getCredentials()
     self.assertTrue(credentials == (self.username, '', self.domain,
                                     unhexlify(lmhash), unhexlify(nthash),
                                     '', None, None))
     UNC = '\\\\%s\\%s' % (self.machine, self.share)
     tid = smb.connectTree(UNC)
     smb.logoff()
Example #12
0
 def test_getData(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     smb.getDialect()
     smb.getServerName()
     smb.getRemoteHost()
     smb.getServerDomain()
     smb.getServerOS()
     smb.doesSupportNTLMv2()
     smb.isLoginRequired()
     smb.logoff()
Example #13
0
 def test_getData(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     smb.getDialect()
     smb.getServerName()
     smb.getRemoteHost()
     smb.getServerDomain()
     smb.getServerOS()
     smb.doesSupportNTLMv2()
     smb.isLoginRequired()
     smb.logoff()
Example #14
0
 def test_uploadDownload(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     f = open(self.upload)
     smb.putFile(self.share, self.file, f.read)
     f.close()
     f = open(self.upload + '2', 'w+')
     smb.getFile(self.share, self.file, f.write)
     f.close()
     os.unlink(self.upload + '2')
     smb.deleteFile(self.share, self.file)
     smb.logoff()
Example #15
0
 def test_uploadDownload(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     f = open(self.upload)
     smb.putFile(self.share, self.file, f.read)
     f.close()
     f = open(self.upload + '2', 'w+')
     smb.getFile(self.share, self.file, f.write)
     f.close()
     os.unlink(self.upload + '2')
     smb.deleteFile(self.share, self.file)
     smb.logoff()
Example #16
0
    def test_readwriteFile(self):
        smb = self.create_connection()
        smb.login(self.username, self.password, self.domain)
        tid = smb.connectTree(self.share)
        fid = smb.createFile(tid, self.file)
        smb.writeFile(tid, fid, "A" * 65535)
        data = smb.readFile(tid, fid, 0, 65535)
        self.assertTrue(len(data) == 65535)
        self.assertTrue(data == "A" * 65535)
        smb.closeFile(tid, fid)
        fid = smb.openFile(tid, self.file)
        smb.closeFile(tid, fid)
        smb.deleteFile(self.share, self.file)
        smb.disconnectTree(tid)

        smb.logoff()
Example #17
0
 def test_readwriteFile(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     tid = smb.connectTree(self.share)
     fid = smb.createFile(tid, self.file)
     smb.writeFile(tid, fid, "A"*65535)
     data = smb.readFile(tid,fid, 0, 65535)
     self.assertTrue(len(data) == 65535)
     self.assertTrue(data == "A"*65535)
     smb.closeFile(tid,fid)
     fid = smb.openFile(tid, self.file)
     smb.closeFile(tid, fid)
     smb.deleteFile(self.share, self.file)
     smb.disconnectTree(tid)
     
     smb.logoff()
Example #18
0
 def test_createdeleteDirectory(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     smb.createDirectory(self.share, self.directory)
     smb.deleteDirectory(self.share, self.directory)
     smb.logoff()
Example #19
0
 def test_getServerName(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     serverName = smb.getServerName()
     self.assertTrue(serverName == self.serverName)
     smb.logoff()
Example #20
0
 def test_getRemoteHost(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     remoteHost = smb.getRemoteHost()
     self.assertTrue(remoteHost == self.machine)
     smb.logoff()
Example #21
0
 def test_getDialect(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     dialect = smb.getDialect()
     self.assertTrue( dialect == self.dialects)
     smb.logoff()
Example #22
0
 def test_getServerDomain(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     serverDomain = smb.getServerDomain()
     self.assertTrue( serverDomain.upper() == self.domain.upper().split('.')[0])
     smb.logoff()
Example #23
0
 def test_getServerName(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     serverName = smb.getServerName()
     self.assertTrue( serverName == self.serverName )
     smb.logoff()
Example #24
0
 def test_createdeleteDirectory(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     smb.createDirectory(self.share, self.directory)
     smb.deleteDirectory(self.share, self.directory) 
     smb.logoff()
Example #25
0
 def test_getDialect(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     dialect = smb.getDialect()
     self.assertTrue(dialect == self.dialects)
     smb.logoff()
Example #26
0
 def test_listPath(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     smb.listPath(self.share, '*')
     smb.logoff()
Example #27
0
 def test_getRemoteHost(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     remoteHost = smb.getRemoteHost()
     self.assertTrue( remoteHost == self.machine)
     smb.logoff()
Example #28
0
 def test_listShares(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     smb.listShares()
     smb.logoff()