Fix garbage output on remote and vm plugins.

When using the remote or vm plugins, the JSON (or XML) result from the remote server is coming with garbage at the end. This commit fix this by filtering the result.

Signed-off-by: Rudá Moura <rmoura@redhat.com>