Write data into a file on the Agent's file system.
(self, destination, data, block_size=65536)
| 180 | return self.variables['WD'] |
| 181 | |
| 182 | def writeFile(self, destination, data, block_size=65536): |
| 183 | """ |
| 184 | Write data into a file on the Agent's file system. |
| 185 | """ |
| 186 | |
| 187 | ByteStreamWriter = self.loadClass("common/ByteStreamWriter.apk", "ByteStreamWriter") |
| 188 | |
| 189 | file_io = self.new("java.io.File", destination) |
| 190 | |
| 191 | if (file_io.exists() != True): |
| 192 | file_stream = self.new("java.io.FileOutputStream", destination) |
| 193 | |
| 194 | for c in chunk(data, block_size): |
| 195 | ByteStreamWriter.writeHexStream(file_stream, binascii.hexlify(c).decode()) |
| 196 | |
| 197 | file_stream.close() |
| 198 | |
| 199 | return len(data) |
| 200 | else: |
| 201 | return None |
| 202 |
no test coverage detected