vnc
Execute commands on a remote server via VNC. Uses the vncdotool library.
Note
This command caches all the settings so that they only need to be defined once.
vars:
$SERVER_ADDRESS: 192.42.0.254
$PORT: 5900
$DISPLAY: 1
$PASSWORD: password
commands:
# creates new vnc-connection and session. If creates_session is omitted, a session named "default" is created
- type: vnc
cmd: capture
filename: screenshot.png
hostname: $SERVER_ADDRESS
port: $PORT
display: $DISPLAY
password: $PASSWORD
creates_session: my_session
# reuses existing session "my_session
- type: vnc
cmd: type
input: "echo hello world"
session: my_session
# closes existing session "my_session" and deletes from session store
- type: vnc
cmd: close
session: my_session
- cmd
One of
type,key,capture,move,expectscreen,close,click,rightclick- Type:
str
- hostname
This option sets the hostname or ip-address of the remote ssh-server.
- Type:
str
- port
Port to connect to on the remote host.
- Type:
int
- Default:
5900
- display
Specifies the display to use on the remote machine.
- Type:
str
- Default:
1
- password
Specifies the password to use
- Type:
str
- filename
Path where a screenshot
captureshould be saved, or file to compare a screenshot withexpectscreen.- Type:
str
- maxrms
Metric to compare a screen with
expectscreen. Only continue if the screen matches. Maximum RMS (root mean square) error allowed (set a small value for near-exact match)- Type:
float
- input
text to type with the command
type- Type:
str
- key
key to press with the command
key- Type:
str
- x
x position to move the cursor to with the command
move- Type:
int
- y
y position to move the cursor to with the command
move- Type:
int
- creates_session
A session name that identifies the session that is created when executing this command. This session name can be used by using the option
sessionin another vnc-command. If nocreates_sessionname is defined and no previous session is used a session nameddefaultis created.- Type:
str
- session
Reuse an existing session. This setting works only if another vnc-command was executed with the command-option
creates_session- Type:
str
- connection_timeout
timeout in seconds for the connection to be established
- Type:
int
- Default:
10
- expect_timeout
timeout in seconds for a command to finish. Gets passed as an argument to the client the first time a connection is established.
- Type:
int
- Default:
60
Note
The connection_timeout and expect_timeout` need to be set in the first command that establishes the connection
Note
The vnc connection needs to be closed with the command close explicitely, otherwise attackmate will keep running.