def test_createFile(self): smb = SMBConnection("*SMBSERVER", self.machine, preferredDialect=self.dialects) smb.login(self.username, self.password) tid = smb.connectTree(self.share) fid = smb.createFile(tid, self.file) smb.closeFile(tid, fid) smb.deleteFile(self.share, self.file) smb.disconnectTree(tid) smb.logoff()
def test_createFile(self): smb = SMBConnection('*SMBSERVER', self.machine, preferredDialect = self.dialects) 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()
def test_uploadDownload(self): smb = SMBConnection('*SMBSERVER', self.machine, preferredDialect = self.dialects) 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() smb.deleteFile(self.share, self.file) smb.logoff()
def test_readwriteFile(self): smb = SMBConnection("*SMBSERVER", self.machine, preferredDialect=self.dialects) smb.login(self.username, self.password) 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) smb.deleteFile(self.share, self.file) smb.disconnectTree(tid) smb.logoff()
def test_readwriteFile(self): smb = SMBConnection('*SMBSERVER', self.machine, preferredDialect=self.dialects) smb.login(self.username, self.password) 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) smb.deleteFile(self.share, self.file) smb.disconnectTree(tid) smb.logoff()