def read(self, nb_of_recv=1): """ Read from the server :param nb_of_recv: Number of message to try to receive :returns: The received data """ data = "\n" for x in range(0, nb_of_recv): data += bytes_to_str(self.socket.recv(4096)) return data
def read(self, nb_of_recv=1): """ Read from the server :param nb_of_recv: Number of message to try to receive :returns: The received data """ data = "\n" for x in range(0, nb_of_recv): data += bytes_to_str(self.tn.read_some()) return data
def read(self, nb_of_recv=1): ''' Read from the server :param nb_of_recv: Number of message to try to receive :returns: The received data ''' data = "\n" for x in range(0, nb_of_recv): data += bytes_to_str(self.socket.recv(4096)) return data
def read_until(self, substring): """ Read until 'substring' is found :param substring: The string to look for :returns: The received data """ data = "\n" while substring not in data: data += bytes_to_str(self.socket.recv(4096)) return data
def read_until(self, substring): ''' Read until 'substring' is found :param substring: The string to look for :returns: The received data ''' data = "\n" while substring not in data: data += bytes_to_str(self.socket.recv(4096)) return data
def restore_file(self, file_name, source=None): if source: f = open(source, "r") to_restore = f.read() f.close() else: to_restore = self.bytes_dump try: f = open(file_name, "w") f.write(bytes_to_str(hexdump.restore(to_restore))) f.close() except FileNotFoundError as e: debug(e)
def read(self, nb_of_recv=1): data = "\n" for x in range(0, nb_of_recv): data += bytes_to_str(self.tn.read_some()) return data
def read_until(self, substring): data = "\n" while substring not in data: data += bytes_to_str(self.socket.recv(4096)) return data
def read(self, nb_of_recv=1): data = "\n" for x in range(0, nb_of_recv): data += bytes_to_str(self.socket.recv(4096)) return data