Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-27-2008, 12:09 PM
darkoth darkoth is offline
Registered User
 
Join Date: Jun 2007
Posts: 29
Password in scripts

I'm working on a script that will go out to an FTP server, enter the users inputted username and password, send it, and then install.

My question is this. How would I "encrypt" their password when they typed their password in the window so that if someone is standing behind them, they won't see what is typed...

Example code below which grabs a pca package off one of our servers and installs it.

Code:
#$language = "VBScript"
#$interface = "1.0"

crt.Screen.Synchronous = True

Sub Main

	' Ask for userid
	User_ID = crt.Dialog.Prompt("Enter your username: ", "" )
	if User_ID = "" then exit sub

	' Ask for password
	User_Pass = crt.Dialog.Prompt("Enter your password: ", "")
	if User_Pass = "" then exit sub

	crt.Screen.Send "cd /usr/tmp/;mkdir pca;cd pca" & chr(13)
	crt.Screen.WaitForString " ]# "
	crt.Screen.Send "ftp server1" & chr(13)
	crt.Screen.WaitForString "): "
	crt.Screen.Send User_ID & chr(13)
	crt.Screen.WaitForString "Password:"
	crt.Screen.Send User_Pass & chr(13)
	crt.Screen.WaitForString "ftp> "
	crt.Screen.Send "bin" & chr(13)
	crt.Screen.WaitForString "ftp> "
	crt.Screen.Send "cd /data/Docs_Apps/SunPackages/pca" & chr(13)
	crt.Screen.WaitForString "ftp> "
	crt.Screen.Send "get pca.tar.gz" & chr(13)
	crt.Screen.WaitForString "ftp> "
	crt.Screen.Send "quit" & chr(13)
	crt.Screen.WaitForString " ]# "
	crt.Screen.Send "gunzip pca.tar.gz;tar -xvf pca.tar.gz" & chr(13)
	crt.Screen.WaitForString " ]# "
	crt.Screen.Send "ls" & chr(13)
	crt.Screen.WaitForString " ]# "
	crt.Screen.Send "tar -xvf pca.tar" & chr(13)
	crt.Screen.WaitForString " ]# "
	crt.Screen.Send "rm pca.tar" & chr(13)
	crt.Screen.WaitForString " ]# "
	crt.Screen.Send "pkgadd -d gcc-3.4.6-sol10-sparc-local" & chr(13)
	crt.Screen.WaitForString "all packages). (default: all) [?,??,q]: "
	crt.Screen.Send chr(13)
	crt.Screen.WaitForString " ]# "
	crt.Screen.Send "pkgadd -d openssl-0.9.8h-sol10-sparc-local" & chr(13)
	crt.Screen.WaitForString "all packages). (default: all) [?,??,q]: "
	crt.Screen.Send chr(13)
	crt.Screen.WaitForString " ]# "
	crt.Screen.Send "pkgadd -d libiconv-1.11-sol10-sparc-local" & chr(13)
	crt.Screen.WaitForString "all packages). (default: all) [?,??,q]: "
	crt.Screen.Send chr(13)
	crt.Screen.WaitForString " ]# "
	crt.Screen.Send "pkgadd -d libintl-3.4.0-sol10-sparc-local" & chr(13)
	crt.Screen.WaitForString "all packages). (default: all) [?,??,q]: "
	crt.Screen.Send chr(13)
	crt.Screen.WaitForString " ]# "
	crt.Screen.Send "pkgadd -d wget-1.11.3-sol10-sparc-local" & chr(13)
	crt.Screen.WaitForString "all packages). (default: all) [?,??,q]: "
	crt.Screen.Send chr(13)
	crt.Screen.WaitForString " ]# "
	crt.Screen.Send "mv pca.conf /etc" & chr(13)
	crt.Screen.WaitForString " ]# "
	crt.Screen.Send "chmod 755 pca;mv pca /usr/sbin" & chr(13)
	crt.Screen.WaitForString " ]# "
	crt.Screen.Send "pca" & chr(13)
End Sub
Reply With Quote
 

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 03:18 AM.