Esempio n. 1
0
    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()
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)
Esempio n. 4
0
 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)
Esempio n. 5
0
 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)
Esempio n. 6
0
 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)
Esempio n. 7
0
    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()
Esempio n. 8
0
 def update(has, _total):
     if not self.silent:
         pwn.log.status("%s/%s" % (pwn.size(has), total))
Esempio n. 9
0
 def update(has, _total):
     if not self.silent:
         pwn.log.status("%s/%s" % (pwn.size(has), total))