2

I have a VBS script I use at work for automating tasks when connected to Cisco routers and switches, including automating the login process. Not unreasonably people are a little edgy about storing their password in a plain text VBS file, so I provide them with the option to prompt every time for the password or have it stored in the script.

Is there a method by which I could call out to a Windows API which might be able to handle encryption for me? I would need a way to both a) encrypt the original password so it could be safely stored in the script, and b) provide a way of calling the decrypt function for use within my main script so that I can use the plain password. There is no built in function for encryption/decryption in VBS that I can find.

I realise that anyone with access to the script to read the password could also easily add a "WScript.Echo Decrypt(strEncryptedPassword)" type line to the script, but this doesn't seem to worry anyone!

Any help would be appreciated. I'm not great with API programming (in truth I'm a poor VB6 programmer turned network engineer) so please bear this in mind with responses.

Tom Bell
  • 25
  • 1
  • 2
  • 4

1 Answers1

3

Check this article

Also consider the following links:

Encrypt function

Decrypt function

If your are interested in stronger encryption, then check this article

  • 1
    Thanks, I think the last article may be good if I can work out how to convert it to just (un)encrypt strings as opposed to files. Is there a "proper" way of ensuring that someone cannot just snoop the scripts to decyrypt what you have encrypted, or am I missing the point here a little? – Tom Bell Aug 10 '11 at 08:04
  • 1
    VB-script can be compiled to exe file. And it won't be easy to view its contents to get encrypted strings. It is not bullet-proof, because a professional with a debugger may debug exe file and find out what is going on. To find tools for compiling VBS to exe use your favourite search engine. And specify: Free VBS to EXE compiler –  Aug 10 '11 at 09:18
  • 1
    Be aware of malicious software (troyans, malware, etc) when you are finding free vbs to exe compiler. –  Aug 10 '11 at 09:19