expectit

How to get the Java stream for ExpectIt to drive Telnet

不想你离开。 提交于 2020-01-06 16:53:25
问题 How do I get the Java stream for telnet to use with the ExpectIt? Instead of using a Java library, such as Apache Telnet as below, using the actual Telnet client on Linux. This is in the context of the man page from expect: Expect is a program that "talks" to other interactive programs according to a script. followup question with a much more narrow scope to a previous, vague, overly broad question where the following comment was made: The library, as all the other Java libraries, uses

ExpectIt : Trouble implementing a sudo -i

北战南征 提交于 2019-12-04 05:03:18
问题 I'm creating a web shell client and successfully created a simple terminal. I can do basic commands, but I need to do a sudo -i and pass a password. After send the "sudo -i" command, I "expect" the new user (as root) prompt, but the "expect" waits forever. I can see the prompt is as expected. This code is only for the 'sudo' opperation and works fine. Common commands are made at separated method. expect.sendLine( "sudo -i" ); expect.expect( Matchers.contains( ":" ) ); expect.sendLine(

ExpectIt : Trouble implementing a sudo -i

本小妞迷上赌 提交于 2019-12-02 07:09:55
I'm creating a web shell client and successfully created a simple terminal. I can do basic commands, but I need to do a sudo -i and pass a password. After send the "sudo -i" command, I "expect" the new user (as root) prompt, but the "expect" waits forever. I can see the prompt is as expected. This code is only for the 'sudo' opperation and works fine. Common commands are made at separated method. expect.sendLine( "sudo -i" ); expect.expect( Matchers.contains( ":" ) ); expect.sendLine( password ); // Old prompt was user prompt : user + "@" // Now I need the root prompt : user + ":" PROMPT =