Exemplo n.º 1
0
    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
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
    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
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
    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
Exemplo n.º 6
0
    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)
Exemplo n.º 7
0
    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)
Exemplo n.º 8
0
 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
Exemplo n.º 9
0
 def read_until(self, substring):
     data = "\n"
     while substring not in data:
         data += bytes_to_str(self.socket.recv(4096))
     return data
Exemplo n.º 10
0
 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
Exemplo n.º 11
0
 def read_until(self, substring):
     data = "\n"
     while substring not in data:
         data += bytes_to_str(self.socket.recv(4096))
     return data
Exemplo n.º 12
0
 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