0 votes
ago by (400 points)

Hello, I have different behavior when working with my network devices (Eltex MES/ESR):

SendShellCommand("enable 15");
//expecting password promt
SendShellData("mypass");
SendShellData(new ConsoleKeyInfo((char)FunctionKey.Enter, ConsoleKey.Enter, false, false, false));

When used this way I have stable device behavior when escalating privileges.

SendShellCommand("enable 15");
//expecting password promt
SendShellData("mypass");
SendShellData(FunctionKey.Enter);

But when used this way, about 50% of the time I receive a message from the device: "error - can't enable privileged mode, authentication failed".

0000 |65-72-72-6F-72-20-2D-20 63-61-6E-27-74-20-65-6E| error - can't en
0010 |61-62-6C-65-20-70-72-69 76-69-6C-65-67-65-64-20| able privileged 
0020 |6D-6F-64-65-2C-20-61-75 74-68-65-6E-74-69-63-61| mode, authentica
0030 |74-69-6F-6E-20-66-61-69 6C-65-64-2E-0D-0A      | tion failed...

Can you please clarify the difference between using FunctionKey and ConsoleKeyInfo. I would really like to understand for myself the reason for the different behavior.

Thank you.

Please log in or register to answer this question.

...