Created
March 3, 2011 07:57
-
-
Save rubiojr/852485 to your computer and use it in GitHub Desktop.
start mac vnc server: startvnc.pl password > file.sh
This file contains 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
#!/usr/bin/perl | |
# | |
# | |
#[Macoy] original script taken from: | |
# [Macoy]http://www.macgeekery.com/user/unixgeek | |
# [Macoy] this script revised by macoy [http://macoy.wordpress.com] | |
# Usage: perl vncpasswd.pl [password] | |
# [Macoy]$ perl vncpass_macoy.pl [vnc_password] > startvnc.sh | |
# [Macoy]$ sh startvnc.sh | |
#---------------------------------------------------------------------------------- | |
$plainTextPassword = $ARGV[0] || | |
die "You must specify the password on the command line!"; | |
$plainTextPassword =~ s/^(.{8}).*/$1/; | |
# convert the password to an array | |
@passwordArray = unpack "C*", $plainTextPassword; | |
# XOR key | |
@vncXorKey = unpack "C*", pack "H*", "1734516E8BA8C5E2FF1C39567390ADCA"; | |
# print the kickstart command... | |
# [Macoy] commented line is the original command from unixgeek but it | |
# [Macoy] didn't work w/ my current xserve. thus the script modification. | |
# print "sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/ Contents/Resources/kickstart -configure -clientopts -setvnclegacy -vnclegacy yes -setvncpw -vncpw "; | |
# [Macoy] this is the actual working command in my case: | |
print "sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -activate -access -on -clientopts -setvnclegacy -vnclegacy yes -setvncpw -restart -agent -vncpw "; | |
# print the password | |
foreach $byteValue (@vncXorKey) { | |
printf("%02X",$byteValue ^ (shift @ passwordArray || 0)); | |
} | |
print "\\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment