LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-04-2008, 01:00 AM   #1
aarontwc
Member
 
Registered: Oct 2008
Posts: 66

Rep: Reputation: 15
Automate vncpasswd creation


I can generate a vncpassword file using the vncpasswd command. But I would like to run this form a perl script.

For example: system("vncpassword -q dir/passwd");

But when i do this they will prompt the console for the password. Say i want to set the password to 1234. How do I actually do this so that users do not get prompted to input a password?

If I can't do this due to some limitations, can I actually use something other than xvnc's rfbauth option in order to handle authentication so that I can just pass in a simple plain password?



Thanks in advance.
Aaron
 
Old 11-04-2008, 07:16 PM   #2
aarontwc
Member
 
Registered: Oct 2008
Posts: 66

Original Poster
Rep: Reputation: 15
I found something useful.. but not quite useful

http://www.mail-archive.com/vnc-list.../msg11719.html

I found the following code through the link above:
#!/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";

#########################################################

This pretty much does what I want, which is ultimately be able to generate a vncpasswd myself. My research on vncpasswd so far is that, it is based on DES, and the obfuscation key value is fixed. Theoretically, this being the case, I should be able to backward engineer a perl script from the C++ source code of vncpasswd.

But the passwd file generated by vncpasswd appear to be unreadable text. Rather different from those generated through the code above, I believe I am missing a step here.

And great brains can help on this?

Aaron
 
Old 11-04-2008, 11:52 PM   #3
aarontwc
Member
 
Registered: Oct 2008
Posts: 66

Original Poster
Rep: Reputation: 15
Okay, i still couldn't solve the problem. But i found a workaround to it.

X11vnc actually has an option to generate the password. So instead of having to drill deep into how to program it in PERL and all, what you can do is as follows:
x11vnc -storepassword <password> <directory+filename>

That's it! That should generate the same file as vncpasswd but without pesky prompts.

you can find out more from my blog http://aarontwc.blogspot.com, i will be posting my findings about DES usage in perl shortly.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to program shell script to automate mass user account creation? EsAsher Linux - General 2 06-30-2007 08:41 AM
Automate user account creation bczm8703 Programming 6 06-12-2007 09:20 PM
Rhythmbox- Writing a Program to Automate Playlist Creation RevenantSeraph Linux - Software 1 04-16-2007 02:39 AM
LXer: Speaking Unix, Part 6: Automate, automate, automate! LXer Syndicated Linux News 0 01-04-2007 09:54 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration