示例#1
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)
     smb.connectTree(UNC)
     smb.logoff()
示例#2
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)
     smb.connectTree(UNC)
     smb.logoff()
示例#3
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()
示例#4
0
 def test_loginKerberos(self):
     smb = self.create_connection()
     smb.kerberosLogin(self.username, self.password, self.domain, '', '',
                       '')
     credentials = smb.getCredentials()
     self.assertTrue(credentials == (self.username, self.password,
                                     self.domain, '', '', '', None, None))
     UNC = '\\\\%s\\%s' % (self.machine, self.share)
     tid = smb.connectTree(UNC)
     smb.logoff()
示例#5
0
 def test_reconnectKerberosHashes(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()
     smb.reconnect()
     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()
示例#6
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()
示例#7
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()
示例#8
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()
示例#9
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 = b''
        offset = 0
        remaining = 65535
        while remaining > 0:
            data += smb.readFile(tid, fid, offset, remaining)
            remaining = 65535 - len(data)
        self.assertTrue(len(data) == 65535)
        self.assertTrue(data == b"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()
示例#10
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 = b''
     offset = 0
     remaining = 65535
     while remaining>0:
         data += smb.readFile(tid,fid, offset, remaining)
         remaining = 65535 - len(data)
     self.assertTrue(len(data) == 65535)
     self.assertTrue(data == b"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()
示例#11
0
 def test_connectTree(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     smb.connectTree(self.share)
     UNC = '\\\\%s\\%s' % (self.machine, self.share)
     smb.connectTree(UNC)
示例#12
0
 def test_connectTree(self):
     smb = self.create_connection()
     smb.login(self.username, self.password, self.domain)
     smb.connectTree(self.share)
     UNC = '\\\\%s\\%s' % (self.machine, self.share)
     smb.connectTree(UNC)