Script to bypass the password field

Hello all
Im trying to write a script that can get past the "enter password" field.Coming to the details, Im planning to write a script that can actually check for the validity of certificates in websphere. There is a utility "keytool" that helps provide this information.However if we want to use it in a script everytime when we open a keyfile (say ex:kdb or jceks) it is going to ask for "enter password" which we can bypass by pressing "return/enter" key.Currently I'm struggling to get past this step.ANY Help is greatly appreciated.

[user@server bin]$ ./keytool -list -v -keystore /home1/server.jceks -storetype JCEKS
Enter keystore password: (this is where my script is stopping to take input,however i want to bypass this part which can be done by pressing enter/return key.Is there any way we can automate this one is my question.)

Keystore type: JCEKS
Keystore provider: IBMJCE

Valid from: 07/19/11 4:19 PM until: 07/19/16 4:19 PM

-----

Any help is appreciated guys..

Read the manual page for "expect". It should do what you are asking for.

1 Like

Thank you

does this work for you?

./keytool -list -v -keystore /home1/server.jceks -storetype JCEKS<<EOF
password-here
EOF
1 Like

That worked for me Frank_rizzo!

Spent at least 90 minutes looking around for help with the exact same problem.

My sample bit of perl code to test is below. The Return character after <<EOF is deliberate, and appears to be required:

!/usr/bin/perl
my $result = `keytool -list -v -keystore /usr/appserver/lib/install/templates/cacerts.jks <<EOF
EOF`;
print $result;