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
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
def send(self, data): self.s.sendall(data) log.debug("Sent {} bytes\n{}".format(green(len(data)), hexdump(data)))
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
def recvline(self): data = self.p.stdout.readline() log.debug("Received {} bytes\n{}".format(green(len(data)), hexdump(data))) return data
def send(self, data): self.p.stdin.write(data) log.debug("Sent {} bytes\n{}".format(green(len(data)), hexdump(data))) self.p.stdin.flush()