Exemple #1
0
 def recvuntil(self, delim):
     data = self.recv(len(delim), nolog=True)
     while data[-len(delim):] != delim:
         data += self.recv(1, nolog=True)
     log.debug("Received {} bytes\n{}".format(green(len(data)),
                                              hexdump(data)))
     return data
Exemple #2
0
 def recvall(self):
     data = b""
     try:
         while True:
             data += self.recv(1, nolog=True)
     except:
         log.debug("Received {} bytes\n{}".format(green(len(data)),
                                                  hexdump(data)))
     return data
Exemple #3
0
 def send(self, data):
     self.s.sendall(data)
     log.debug("Sent {} bytes\n{}".format(green(len(data)), hexdump(data)))
Exemple #4
0
 def recv(self, size, nolog=False):
     data = self.s.recv(size)
     if not nolog:
         log.debug("Received {} bytes\n{}".format(green(len(data)),
                                                  hexdump(data)))
     return data
Exemple #5
0
 def recvline(self):
     data = self.p.stdout.readline()
     log.debug("Received {} bytes\n{}".format(green(len(data)),
                                              hexdump(data)))
     return data
Exemple #6
0
 def send(self, data):
     self.p.stdin.write(data)
     log.debug("Sent {} bytes\n{}".format(green(len(data)), hexdump(data)))
     self.p.stdin.flush()