def _download_raw(self, remote, local): self._initialize_sftp() total, _ = self.run_simple('wc -c "$(echo %s|base64 -d)"' % pwn.b64(remote)) total = pwn.size(int(total.split()[0])) if not self.silent: pwn.log.waitfor('Downloading %s' % remote) def update(has, _total): if not self.silent: pwn.log.status("%s/%s" % (pwn.size(has), total)) if self._supports_sftp: self._sftp.get(remote, local, update) else: dat = '' s = self.run('cat "$(echo %s|base64 -d)"' % pwn.b64(remote), silent=True) while s.connected(): update(len(dat), 0) dat += s.recv() pwn.write(local, dat) if not self.silent: pwn.log.succeeded()
def recvall(self): log.waitfor('Recieving all data') r = [] l = 0 while True: s = self.recv() if s == '': break r.append(s) l += len(s) log.status(pwn.size(l)) self.close() return ''.join(r)
def recvall(self): if not self.silent: pwn.log.waitfor('Recieving all data') r = [] l = 0 while True: s = self.recv() if s == '': break r.append(s) l += len(s) if not self.silent: pwn.log.status(pwn.size(l)) if not self.silent: pwn.log.succeeded() return ''.join(r)
def recvall(self): ''' Receives data until a socket is closed. ''' if not self.silent: pwn.log.waitfor('Recieving all data') r = [] l = 0 while True: s = self.recv() if s == '': break r.append(s) l += len(s) if not self.silent: pwn.log.status(pwn.size(l)) if not self.silent: pwn.log.succeeded() return ''.join(r)
def recvall(self): """ Receives data until a socket is closed. """ if not self.silent: pwn.log.waitfor("Recieving all data") r = [] l = 0 while True: s = self.recv() if s == "": break r.append(s) l += len(s) if not self.silent: pwn.log.status(pwn.size(l)) if not self.silent: pwn.log.succeeded() return "".join(r)
def _download_raw(self, remote, local): self._initialize_sftp() total, _ = self.run_simple('wc -c "$(echo %s|base64 -d)"' % pwn.b64(remote)) total = pwn.size(int(total.split()[0])) if not self.silent: pwn.log.waitfor('Downloading %s' % remote) def update(has, _total): if not self.silent: pwn.log.status("%s/%s" % (pwn.size(has), total)) if self._supports_sftp: self._sftp.get(remote, local, update) else: dat = '' s = self.run('cat "$(echo %s|base64 -d)"' % pwn.b64(remote), silent = True) while s.connected(): update(len(dat), 0) dat += s.recv() pwn.write(local, dat) if not self.silent: pwn.log.succeeded()
def update(has, _total): if not self.silent: pwn.log.status("%s/%s" % (pwn.size(has), total))