コード例 #1
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()
コード例 #2
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()
コード例 #3
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()
コード例 #4
0
ファイル: test_smb.py プロジェクト: CoreSecurity/impacket
 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()