Hi,
I would like to know if there is any CLI to start, stop and change the password of VNC Server. I want to Start, Stop and Change the Password of VNC Server programatically. Appreciate any help in this regard.
Thanks,
Swapna.
Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: https://forum.uvnc.com/viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864
Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864
Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc
CLI to Start/Stop/Change Password of VNC Server
Re: CLI to Start/Stop/Change Password of VNC Server
Try this batch script. Copy and paste the contents to 'chgvncpwd.cmd'. Then call is with the name or IP of the PC in question. Example: chgvncpwd 10.1.1.15swapnap wrote:Hi,
I would like to know if there is any CLI to start, stop and change the password of VNC Server. I want to Start, Stop and Change the Password of VNC Server programatically. Appreciate any help in this regard.
Thanks,
Swapna.
Code: Select all
@echo off
sc \\%1 stop winvnc
PING localhost>nul
REG ADD \\%1\HKLM\SOFTWARE\ORL\WinVNC3 /v MSLogonRequired /t REG_DWORD /d 0 /f
REG ADD \\%1\HKLM\SOFTWARE\ORL\WinVNC3 /v NewMSLogon /t REG_DWORD /d 0 /f
REG ADD \\%1\HKLM\SOFTWARE\ORL\WinVNC3\Default /v Password /t REG_BINARY /d DBD83CFD727A145844 /f
sc \\%1 start winvnc
Last edited by ColtB45 on 2010-05-26 13:28, edited 1 time in total.
Re: CLI to Start/Stop/Change Password of VNC Server
Don't you want to make the new password a second input argument?
Re: CLI to Start/Stop/Change Password of VNC Server
Isn't the password only stored in the ultravnc.ini file?
http://www.chunkvnc.com - ChunkVNC - Free PC Remote control with the Open Source UltraVNC wrapper InstantSupport!
Re: CLI to Start/Stop/Change Password of VNC Server
Man would I love a Windows version of x11vnc -- check out his command line options!
http://www.karlrunge.com/x11vnc/x11vnc_opts.html
http://www.karlrunge.com/x11vnc/x11vnc_opts.html
x11vnc: a VNC server for real X displays
Here are all of x11vnc command line options:
% x11vnc -opts (see below for -help long descriptions)
x11vnc: allow VNC connections to real X11 displays. 0.9.11 lastmod: 2010-05-22
x11vnc options:
-display disp -auth file -N
-autoport n -rfbport str -6
-no6 -noipv6 -noipv4
-reopen -reflect host:N -id windowid
-sid windowid -appshare -clip WxH+X+Y
-flashcmap -shiftcmap n -notruecolor
-advertise_truecolor -visual n -overlay
-overlay_nocursor -8to24 [opts] -24to32
-scale fraction -geometry WxH -scale_cursor frac
-viewonly -shared -once
-forever -loop -timeout n
-sleepin n -inetd -tightfilexfer
-ultrafilexfer -http -http_ssl
-avahi -mdns -zeroconf
-connect string -connect_or_exit str -proxy string
-vncconnect -novncconnect -allow host1[,host2..]
-localhost -listen6 str -nolookup
-input string -grabkbd -grabptr
-grabalways -viewpasswd string -passwdfile filename
-showrfbauth filename -unixpw
- -unixpw_nis
- -unixpw_cmd cmd -find -finddpy
-listdpy -findauth [disp] -create
-xdummy -xvnc -xvnc_redirect
-xdummy_xvfb -create_xsrv str -svc
-svc_xdummy -svc_xvnc -svc_xdummy_xvfb
-xdmsvc -sshxdmsvc -unixpw_system_greeter
-redirect port -display WAIT:... -vencrypt mode
-anontls mode -sslonly -dhparams file
-nossl -ssl [pem] -ssltimeout n
-sslnofail -ssldir dir -sslverify path
-sslCRL path -sslGenCA [dir] -sslGenCert type name
-sslEncKey pem -sslCertInfo pem -sslDelCert pem
-sslScripts -stunnel [pem] -stunnel3 [pem]
-enc cipher:keyfile -https [port] -httpsredir [port]
-http_oneport -ssh user@host:disp -usepw
-storepasswd pass file -nopw -accept string
-afteraccept string -gone string -users list
-noshm -flipbyteorder -onetile
-solid [color] -blackout string -xinerama
-noxinerama -xtrap -xrandr [mode]
-rotate string -padgeom WxH -o logfile
-flag file -rmflag file -rc filename
-norc -env VAR=VALUE -prog /path/to/x11vnc
-h, -help -?, -opts -V, -version
-license -dbg -q, -quiet
-v, -verbose -bg -modtweak
-nomodtweak -xkb -noxkb
-capslock -skip_lockkeys -noskip_lockkeys
-skip_keycodes string -sloppy_keys -skip_dups
-noskip_dups -add_keysyms -noadd_keysyms
-clear_mods -clear_keys -clear_all
-remap string -norepeat -repeat
-nofb -nobell -nosel
-noprimary -nosetprimary -noclipboard
-nosetclipboard -seldir string -cursor [mode]
-nocursor -cursor_drag -arrow n
-noxfixes -alphacut n -alphafrac fraction
-alpharemove -noalphablend -nocursorshape
-cursorpos -nocursorpos -xwarppointer
-noxwarppointer -buttonmap string -nodragging
-ncache n -ncache_cr -ncache_no_moveraise
-ncache_no_dtchange -ncache_no_rootpixmap -ncache_keep_anims
-ncache_old_wm -ncache_pad n -debug_ncache
-wireframe [str] -nowireframe -nowireframelocal
-wirecopyrect mode -nowirecopyrect -debug_wireframe
-scrollcopyrect mode -noscrollcopyrect -scr_area n
-scr_skip list -scr_inc list -scr_keys list
-scr_term list -scr_keyrepeat lo-hi -scr_parms string
-fixscreen string -debug_scroll -noxrecord
-grab_buster -nograb_buster -debug_grabs
-debug_sel -pointer_mode n -input_skip n
-allinput -input_eagerly -speeds rd,bw,lat
-wmdt string -debug_pointer -debug_keyboard
-defer time -wait time -extra_fbur n
-wait_ui factor -setdefer n -nowait_bog
-slow_fb time -xrefresh time -nap
-nonap -sb time -readtimeout n
-ping n -nofbpm -fbpm
-nodpms -dpms -forcedpms
-clientdpms -noserverdpms -noultraext
-chatwindow -noxdamage -xd_area A
-xd_mem f -sigpipe string -threads
-nothreads -fs f -gaps n
-grow n -fuzz n -debug_tiles
-snapfb -rawfb string -freqtab file
-pipeinput cmd -macnodim -macnosleep
-macnosaver -macnowait -macwheel n
-macnoswap -macnoresize -maciconanim n
-macmenu -macuskbd -gui [gui-opts]
-remote command -query variable -QD variable
-sync -query_retries str -remote_prefix str
-noremote -yesremote -unsafe
-safer -privremote -nocmds
-allowedcmds list -deny_all
LibVNCServer options:
-rfbport port TCP port for RFB protocol
-rfbwait time max time in ms to wait for RFB client
-rfbauth passwd-file use authentication on RFB protocol
(use 'storepasswd' to create a password file)
-rfbversion 3.x Set the version of the RFB we choose to advertise
-permitfiletransfer permit file transfer support
-passwd plain-password use authentication
(use plain-password as password, USE AT YOUR RISK)
-deferupdate time time in ms to defer updates (default 40)
-deferptrupdate time time in ms to defer pointer updates (default none)
-desktop name VNC desktop name (default "LibVNCServer")
-alwaysshared always treat new clients as shared
-nevershared never treat new clients as shared
-dontdisconnect don't disconnect existing clients when a new non-shared
connection comes in (refuse new connection instead)
-httpdir dir-path enable http server using dir-path home
-httpport portnum use portnum for http connection
-enablehttpproxy enable http proxy support
-progressive height enable progressive updating for slow links
-listen ipaddr listen for connections only on network interface with
addr ipaddr. '-listen localhost' and hostname work too.
libvncserver-tight-extension options:
-disablefiletransfer disable file transfer
-ftproot string set ftp root
Last edited by B on 2010-05-25 21:22, edited 3 times in total.
Re: CLI to Start/Stop/Change Password of VNC Server
Sorry guys, I am having an off day. I didn't give this much thought when I put this out there.
That would be significantly more complex if you wanted to define the password as plain text. The password value stored in either the registry or ini file is only a hash of the password. What I used to do in my enviroment is copy a hash of a known value and then use it to overwrite a hash of an unknown value. You could very easily put the hash as a variable from the command line, but that wouldn't be very useful.B wrote:Don't you want to make the new password a second input argument?
In newer versions, yes. This is a script I used to use (years ago) in my enviroment. At some point we switched all of our installations of VNC use MS-Logon so I haven't needed to use this is quite some time. Because of that I never updated it to parse the ini file and make changes there.supercoe wrote:Isn't the password only stored in the ultravnc.ini file?
Re: CLI to Start/Stop/Change Password of VNC Server
Speaking as a nonprogrammer, I'm guessing it would be possible to re-use the hashing code from winvnc itself, so someone could write something to create hashes on the fly (and someone probably has). I've never checked, but always suspected that whatever hashing was being done was not exactly cryptographically strong.
But thanks for sharing what you had in any case.
But thanks for sharing what you had in any case.
Last edited by B on 2010-05-25 21:38, edited 1 time in total.
Re: CLI to Start/Stop/Change Password of VNC Server
Thanks to All for sharing information.B wrote:Speaking as a nonprogrammer, I'm guessing it would be possible to re-use the hashing code from winvnc itself, so someone could write something to create hashes on the fly (and someone probably has). I've never checked, but always suspected that whatever hashing was being done was not exactly cryptographically strong.
But thanks for sharing what you had in any case.
From the posts I understand, for the newer versions of VNC the password is set in ultravnc.ini file. There is a field under admin section in ultravnc.ini with the name UseRegistry=0, can the user change this option to 1 to use the registry instead of INI file.
If in the default case where .ini file is used to save the password, how do I change the password programatically. I need to calculate the hash of the user's input for new password and set it in .ini file. What is the hash algorithm followed?
ColtB45,
When I run the batch script I have got the output as,
C:\Documents and Settings\swapnap\Desktop>winvnc.cmd 192.168.111.10
[SC] OpenService FAILED 1060:
The specified service does not exist as an installed service.
The operation completed successfully
The operation completed successfully
The operation completed successfully
[SC] StartService: OpenService FAILED 1060:
The specified service does not exist as an installed service.
The service is not running as installed service, but the new registry entries are added. When I changed the service name from winvnc to uvnc_service (as the service name is uvnc_service in my system), it worked without failure.
Also, I would like to know what is the password that is set using the command "REG ADD \\%1\HKLM\SOFTWARE\ORL\WinVNC3\Default /v Password /t REG_BINARY /d DBD83CFD727A145844 /f"
Is "DBD83CFD727A145844" hash of some string? How is it calculated?
Thanks,
Swapna.
Last edited by swapnap on 2010-05-27 04:19, edited 1 time in total.
Re: CLI to Start/Stop/Change Password of VNC Server
To see a good example of how it is calculated look here in the source.
UltraVNC Project Root\UltraVNC\uvnc_settings\uvnc_settings\security.cpp
I'll make a simple little console application that can change the VNC password. I'll post it here once I am done. It will probably take a few days as I don't have a ton of spare time.
UltraVNC Project Root\UltraVNC\uvnc_settings\uvnc_settings\security.cpp
I'll make a simple little console application that can change the VNC password. I'll post it here once I am done. It will probably take a few days as I don't have a ton of spare time.
Re: CLI to Start/Stop/Change Password of VNC Server
Crazy, I was looking at the code in vncauth.c
http://ultravnc.svn.sourceforge.net/vie ... iew=markup
Seems the functions are similar if not the same?
I'll try my hand at creating a C++ console app as well.
Some good to know info:
http://ultravnc.svn.sourceforge.net/vie ... iew=markup
Seems the functions are similar if not the same?
I'll try my hand at creating a C++ console app as well.
Some good to know info:
Explanation of VNC DES: http://www.vidarholen.net/contents/junk/vnc.htmlFrom the WinVNC source file "vncauth.c" we see that VNC's DES key is:
unsigned char fixedkey[8] = {23,82,107,6,35,78,88,7};
which is, in hex:
17 52 6B 06 23 4E 58 07
http://www.chunkvnc.com - ChunkVNC - Free PC Remote control with the Open Source UltraVNC wrapper InstantSupport!
-
- Posts: 2
- Joined: 2010-10-15 23:49
- Contact:
Re: CLI to Start/Stop/Change Password of VNC Server
Hi All,
Looks like you guys never got to it. Unfortunately I also needed an answer to this question for a project at work. I was able to cobble together a solution with Python and wrote a blog post about it in hope that it will be useful to the next person with this need. It might be helpful to others using different languages as well.
Without further ado:
http://www.geekademy.com/2010/10/creati ... r-vnc.html
Looks like you guys never got to it. Unfortunately I also needed an answer to this question for a project at work. I was able to cobble together a solution with Python and wrote a blog post about it in hope that it will be useful to the next person with this need. It might be helpful to others using different languages as well.
Without further ado:
http://www.geekademy.com/2010/10/creati ... r-vnc.html
Bidi-Bidi-Bidi: http://www.geekademy.com/