1
嗨需要使用任何脚本生成一个VNC密码(PHP最好,但任何perl会做)。如何生成VNC密码?
问题是'vncpasswd'需要交互式用户操作(提示输入密码和密码验证)。
有没有一种方法来生成它没有提示?
嗨需要使用任何脚本生成一个VNC密码(PHP最好,但任何perl会做)。如何生成VNC密码?
问题是'vncpasswd'需要交互式用户操作(提示输入密码和密码验证)。
有没有一种方法来生成它没有提示?
从here。
#!/bin/perl
use Crypt::CBC;
my $key = pack("C8", 23, 82, 107, 6, 35, 78, 88, 7);
$cipher = Crypt::CBC->new({
'key'=>$key, 'cipher'=>'DES', 'prepend_iv'=>0, 'regenerate_key'=>0
});
$ciphertext = $cipher->encrypt("This data is hush hush");
$plaintext = $cipher->decrypt($ciphertext);
print "Encrypted: $ciphertext\n";
print "Decrypted: $plaintext\n";
只需要注意:在加密之前,VNC密码会被截短(或填充到)长度8。 – ephemient 2009-10-22 15:23:00