I have embedded a JSCH SSH Java applet in a web page and need to know if it's possible to run a script (of any language like PHP) to automate logging in and running commands. I have heard of expect4j and java robot but cannot see any way to implement it. Keep in mind, I'm not great with Java so I don't know everything about it. Any help is appreciated.
1
There are 1 answers
Related Questions in JAVA
- I need the BIRT.war that is compatible with Java 17 and Tomcat 10
- Creating global Class holder
- No method found for class java.lang.String in Kafka
- Issue edit a jtable with a pictures
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- Does the && (logical AND) operator have a higher precedence than || (logical OR) operator in Java?
- Mixed color rendering in a JTable
- HTTPS configuration in Spring Boot, server returning timeout
- How to use Layout to create textfields which dont increase in size?
- Function for making the code wait in javafx
- How to create beans of the same class for multiple template parameters in Spring
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Accessing Secret Variables in Classic Pipelines through Java app in Azure DevOps
- Postgres && statement Error in Mybatis Mapper?
Related Questions in SSH
- Is there a way to prevent vscode from forwarding ssh agent to remote dev container?
- problem to push files on a repository git
- How to connect to ssh server with domain name
- GIT SKIP EMPTY DIRECTORIES
- Share files from the server without data or internet usage
- Is it possible for `sudo` to fail temporarily with the correct password? Hacking suspected
- How to add a second ssh public key to authorized_keys file in the server?
- Termux: Different scrolling behaviour after "screen"-command
- Remote debugging via SSH Tunnel
- Why can I not login to a new linux system (amazon linux 2023) from an old one (CentOS 6)
- Can't establish ssh connection to IP address but can to git
- Using Maven to feed minikube on a VM
- Connect ssh to cisco switch with ansible
- PowerShell Command via SSH
- How to automate an SSH login with a batch file?
Related Questions in APPLET
- Can't install .cap file on NXP P71D321
- how do I view an old applet?
- How to set priority of a process(that gets inherited by OS threads) in golang for mac?
- How to connect Apple GPU to Jupyter Notebook?
- How to save and restore macOS Launchpad configuration?
- Where is source code of the binding from javascript to C for Cinnamon? Which C objects / methods can be accessed?
- How to change background color of font for Cinnamon TextApplet?
- android.se.omapi.SEService: My app doesn't connect with the OnConnectedListener
- wrong notifications from my applet ( IFTTT ) (Python trading script)
- How to animate a ball grow with NoApplet?
- Creating a PWA for GeoGebra Applets so that they work offline without needing internet connection
- Can I use install for personalization two times for a SD?
- Why is my ACOSJ Javacard applet failing to install?
- Using symmetric key DES to sign and verify a message
- IsEnabled not working when a function is triggered in Java applet
Related Questions in JSCH
- Using Jsch for file transfer from remote to local but file getting deleted on getting input stream
- Unable to solve JSchException: Auth cancel Error
- jsch with groovy 2: No such file
- jsch JSchAlgoNegoFailException Algorithm negotiation fail
- Unable to add jsch-0.1.55.jar to existing Eclipse java project
- Running any exe with Jsch in a AWS windows server not working
- Caught an exception, leaving main loop due to End of IO Stream Read - How to catch it?
- Unable to connect ot remote DB with ssh tunnel
- jcraft jsch throws "inputstream closed" exception
- Caused by: java.lang.SecurityException: Can not initialize cryptographic mechanism at javax.crypto.JceSecurity in JavaCompiler API
- Failed to connect and initialize SSH connection in Jenkins
- SFTP Connection through OPENSSH IdentityFile in Java
- Jsch getting disconnected on trying to connect to SFTP server under AWS Transfer Family
- Connection to SFTP using Jsch throwing NullPointer
- jsch library authentication failure with rsa-sha2-512 preauth failure
Related Questions in EXPECTJ
- Java expectj execute linux command through jump box
- ExpectJ exception on expectinator.spawn
- I get a contextTypes error when I try to test a very simple component
- How to send control chars using ExpectJ in interactive mode?
- read output text on calling spawn.send()
- How to use ExpectJ in Jython?
- ExpectJ: How to leave from "interact" mode?
- expectJ - Reading InputStream from spawn.send()
- how to implement expect "interact" command using java
- How to handle passwords prompts in expectj
- How to use ExpectJ in synchronized way (waiting for answer with unknown content ) ?
- Java library to run multiple unrelated commands on a remote server via ssh
- ExpectJ for Telnet
- How to wrap rsync with interactive login using Java?
- JSCH Java applet
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
JSch is an SSH client library, and by itself only allows programmatically steered connections to another server. The user interaction has to be build around it by users of the library.
The JCTerm applet provided on the website also contains a terminal emulator in form of a Java GUI. If you only want to automatically execute some command (and maybe show its output in the web page), you could do everything on the server side, and don't need the applet with its terminal emulator. (You would need either some PHP-Java bridge on the server side or some Java-enabled webserver with a Servlet or similar, though.)
(If the web server would be the same machine as the server you'll run the command on you wouldn't even need the SSH connection, but could execute the stuff directly.)
If the server can't do anything (i.e. a "static server"), an applet is the way to go, yes. You can either modify JCTerm or create a new applet from scratch (using JCTerm's connection code as an example on how to connect to to the server).
If you don't have to fear any malicious users in your LAN (i.e. between web server and user, the SSH server doesn't matter), you can embedd the password (or preferably a private key for public-key authentication) into the applet's jar file, and pass it to the library for connection. (You should also include the server's public key for easier checking.)
Provide the command(s) to a
ChannelExec(instead of aChannelShell), this makes it easier to provide input (if necessary) and capture the output. Pipe the output in a text area, or simply use a green/red label saying if the command was successfully executed.(I might have a look at this in the next days and try to do it. No promise, though.)