'Checks if the command to be executed is safe and it\'s not in the
block list defined by the user. Returns False if the modified
command is ok, True if otherwise.'

def _is_command_malformed(self, original_command, modified_command):

    block_chars = set(['|', '$', '#'])
    if (original_command == modified_command):
        return False
    orig_cmd_args = shlex.split(original_command)
    if (not isinstance(modified_command, basestring)):
        modified_command = ''
    mod_cmd_args = shlex.split(modified_command)
    block_flag = False
    orig_args_len = len(orig_cmd_args)
    for index in xrange(0, len(mod_cmd_args)):
        if ((index < orig_args_len) and (orig_cmd_args[index] == mod_cmd_args[index])):
            continue
        for char in block_chars:
            if (char in mod_cmd_args[index]):
                block_flag = True
                break
    return block_flag
