Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- apt-get install jq -y
- ps axu | grep -oe "unix:[a-z0-9\.:\/\-]*.qmp" | while read QMP; do
- echo $QMP;
- LISTEN=$(echo -e '{"execute":"qmp_capabilities"}\n{"execute": "query-vnc"}' | socat - ${QMP} | tail -n1 | jq -r .return.host);
- echo $LISTEN
- if [ "$LISTEN" != "127.0.0.1" ]; then
- PORT=$[$(echo -e '{"execute":"qmp_capabilities"}\n{"execute": "query-vnc"}' | socat - ${QMP} | tail -n1 | jq -r .return.service)-5900]
- echo -e '{"execute":"qmp_capabilities"}\n{"execute": "change", "arguments": { "device": "vnc", "target": "127.0.0.1:'$PORT'" } }' | socat - ${QMP};
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement