Hello Good Day / Guten Tag....
I have to login the server and the user profile contains some scripts which need the inputs to be taken from the keyboard.
So I use the method to conn.authenticateWithKeyboardInteractive(username, new InteractiveCallback() {
public String[] replyToChallenge(String name, String instruction, int numPrompts, String[] prompts, ..............
But I can only provide the password and I expect after the password prompt there are two more prompts but it is not coming ,But I could able to connect, but unable to provide some values to the script called
in the profile ( . /apps/prod/ia/bin/.dsdprofile
)
Kindly help whether Im following the right method to connect in this scenario.
Jsch
api have any advanced method for connecting in this scenario? Or can you help me pointing any other api for this?
Im pasting the snippets I used to connect to the remeore unix server from my java program.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
boolean authenticated = conn.authenticateWithKeyboardInteractive(username, new InteractiveCallback() {
public String[] replyToChallenge(String name, String instruction, int numPrompts, String[] prompts,
boolean[] echo) throws Exception {
System.out.println(name);
System.out.println(instruction);
System.out.println(numPrompts);
System.out.println("Prompts are: ");
for (String prompt : prompts) {
System.out.println(prompt);
}
if (numPrompts == 0)
return new String[0];
if ((numPrompts > 0) && (prompts[0].startsWith("Password")))
return new String[] { password };
if ((numPrompts > 0)) {
for (String prompt1 : prompts) {
if (prompt1.contains("Hit return after you have read the message of the day"))
return new String[] { "\n" };
}
for (String prompt1 : prompts) {
if (prompt1.contains("ORACLE_SID"))
return new String[] { "OracleSS" };
}
}
System.out.println(k);
System.err.println(
"Warning/FIX: don't know what to do with keyboard-interactive method with unknown prompts");
/*System.err.println("Prompts are: ");
for (String p : prompts)
System.err.println(p);*/
return new String[0];
}
});
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Thank you very much / Danke Schon ..
-Sanal