none
How to capture a password from a Password-protected excel file in VBS RRS feed

  • Question

  • Hello,

    How can I capture a password  entered in a specific Row/Column ( file is password protected),  in an EXCEL file to my VBScript coding

    Thanks

    Saturday, May 17, 2014 4:58 PM

Answers

  • Below is my script written in VBS. The password is string is Phx1{%}Dec13, which is maintained in a separate password protected excel file. How can I capture this from a Row/Column specific in the excel file.

    It seems you are after a script that can send a password to open a password-protected Excel file which in turn contains a password for your PuTTY session. Embedding a password in a script is an obvious security breach. Furthermore it makes no sense using a script with a clear-text password to read a further password from an Excel file. You might as well put the PuTTY password Phx1{%}Dec13 into your script. The security would be equally bad in both scenarios.

    Note also that your script will be fragile at the best of times. In a multi-tasking OS such as Windows you can never be sure to which process the script will send its SendKey characters. It could be and will be anything process. Any unexpected pop-up dialog box will derail your script. I recommend you take this project back to the drawing board.

    • Marked as answer by Ireshad Sunday, May 18, 2014 4:26 PM
    Sunday, May 18, 2014 3:37 PM

All replies

  • How can I capture a password  entered in a specific Row/Column ( file is password protected),  in an EXCEL file to my VBScript coding?

    Sorry, can't tell unless you post more details.
    Saturday, May 17, 2014 7:03 PM
  • Hi,

    Below is my script written in VBS. The password is string is Phx1{%}Dec13, which is maintained in a separate password protected excel file. How can I capture this from a Row/Column specific in the excel file.

    How can I send the Ctrl + Backspace key combination in VBS ?

    Const iNormalFocus = 1
    Set objShell = WScript.CreateObject("WScript.Shell")
    sl="C:\Program Files\PuTTY\"
    objShell.Run "putty.exe",iNormalFocus
    Wscript.Sleep 600
    objShell.SendKeys "171.16.11.99"
    Wscript.Sleep 600

    objShell.SendKeys "{TAB}"
    Wscript.Sleep 600
    objShell.SendKeys "{TAB}"
    Wscript.Sleep 600
    objShell.SendKeys "{TAB}"
    Wscript.Sleep 600
    objShell.SendKeys "{TAB}"
    Wscript.Sleep 600
    objShell.SendKeys "{TAB}"
    Wscript.Sleep 600
    objShell.SendKeys "{ENTER}"
    Wscript.Sleep 600
    objShell.SendKeys "sybase15"
    Wscript.Sleep 3000
    objShell.SendKeys "{ENTER}"
    Wscript.Sleep 3000
    objShell.SendKeys "Phx1{%}Dec13"
    Wscript.Sleep 3000
    objShell.SendKeys "{ENTER}"
    Wscript.Sleep 3000
    objShell.SendKeys "cd /phxdump15"
    Wscript.Sleep 2000
    objShell.SendKeys "{ENTER}"
    Wscript.Sleep 2000
    objShell.SendKeys "scp -P 20100 -o NoneEnabled=yes -o NoneSwitch=yes -o HPNDisabled=no /phxdump15/Cbdbase-A.dmp sybase15\@172.25.99.11:/phxdump15/"
    Wscript.Sleep 2000
    objShell.SendKeys "{ENTER}"
    Wscript.Sleep 2000
    objShell.SendKeys "Phx3{%}Dec13"
    Rem objShell.SendKeys "{ENTER}"


    REM ---------------------------------------------------------------------------------------------------------------
    REM objShell.SendKeys "{CTRL}{"BACKSPACE"}
    REM Wscript.Sleep 6000
    REM objShell.SendKeys "{ENTER}"

    THANKS

     

    Sunday, May 18, 2014 1:27 PM
  • Below is my script written in VBS. The password is string is Phx1{%}Dec13, which is maintained in a separate password protected excel file. How can I capture this from a Row/Column specific in the excel file.

    It seems you are after a script that can send a password to open a password-protected Excel file which in turn contains a password for your PuTTY session. Embedding a password in a script is an obvious security breach. Furthermore it makes no sense using a script with a clear-text password to read a further password from an Excel file. You might as well put the PuTTY password Phx1{%}Dec13 into your script. The security would be equally bad in both scenarios.

    Note also that your script will be fragile at the best of times. In a multi-tasking OS such as Windows you can never be sure to which process the script will send its SendKey characters. It could be and will be anything process. Any unexpected pop-up dialog box will derail your script. I recommend you take this project back to the drawing board.

    • Marked as answer by Ireshad Sunday, May 18, 2014 4:26 PM
    Sunday, May 18, 2014 3:37 PM