Last active
June 24, 2022 23:51
-
-
Save mainframed/f36df1cf2dc26a38a7ffdd2e82dd74c7 to your computer and use it in GitHub Desktop.
Powershell in Horizon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#set -x | |
WID=$(xdotool search --class "vmware"|tail -1) | |
echo "[+] Found WID of Horizon client $WID" | |
xdotool windowactivate $WID | |
POS=$(xdotool getwindowgeometry $WID | awk -F "[, ]" 'NR==2{print $4 " " $5}') | |
GEO=$(xdotool getwindowgeometry $WID | awk -F "[x]" 'NR==3{print $1 " " $2}') | |
GEO=${GEO:13} | |
echo "[+] Horizon Client Geometry $GEO" | |
echo "[+] Horizon Client Position $POS" | |
G_X=$(echo $GEO | cut -f1 -d" ") | |
G_Y=$(echo $GEO | cut -f2 -d" ") | |
P_X=$(echo $POS | cut -f1 -d" ") | |
P_Y=$(echo $POS | cut -f2 -d" ") | |
Y=$(($G_Y + $P_Y - 100)) | |
X=$(($P_X + 5)) | |
echo "[+] Moving mouse to $X $Y" | |
xdotool mousemove $X $Y | |
echo "[+] Sendind <Super_L> + R" | |
xdotool key Super_L+R | |
sleep 1 | |
echo "[+] Launching powershell" | |
xdotool type "powershell" | |
xdotool key Return | |
sleep 1 | |
xdotool type "echo \"...\"" | |
xdotool key Return | |
echo "[+] Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment