File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -371,7 +371,28 @@ def op_console(ctx):
371371 resp_host = data .get ("host" )
372372 if console_host and (not resp_host or resp_host in {"0.0.0.0" , "127.0.0.1" , "::" }):
373373 data ["host" ] = console_host
374- _ok (data )
374+ host = data .get ("host" )
375+ port = data .get ("port" )
376+ password = data .get ("password" )
377+ if not host or not port or not password :
378+ _fail ("Agent response missing host/port/password for console" )
379+ try :
380+ port_int = int (port )
381+ except (TypeError , ValueError ):
382+ _fail (f"Invalid port value returned by agent: { port } " )
383+ console_obj = {
384+ "host" : host ,
385+ "port" : port_int ,
386+ "password" : password ,
387+ "protocol" : "vnc" ,
388+ "passwordonetimeuseonly" : False ,
389+ }
390+ response = {
391+ "status" : data .get ("status" , "success" ),
392+ "message" : data .get ("message" , "Console ready" ),
393+ "console" : console_obj ,
394+ }
395+ _ok (response )
375396
376397# -------------------------- main --------------------------
377398def main ():
You can’t perform that action at this time.
0 commit comments