Somesimes I must work with remote host which have telnet connection but no either ftp or ssh (to use scp) also there are no netcat. Also there are no gcc (to compile netcat for example).
Does anybody know how to transfer file(s) using telnet connection (using some kind of hack)?
(I know that it's not very appropriate protocol for souch a things.)
Are you using Windows or Linux (*NIX)? The good old BBS type of file transfers work perfectly under telnet. You need to get the programs thought, and compile them. See zmodem and xmodem.
You should be able to use Kermit to transfer files over telnet, you can use C-Kermit as the telnet client to do so. Its only availible for Unix/Linux based systems though.
The
kermit
client application supports connections over telnet protocol, and AFAICR supportsxmodem
andzmodem
, as well as its own file transfer protocol.As far as I can recall, and it's many years since I've done this:
If you have nothing but a bare-bones Unix system at the remote end, you could encode with (gzip and) uuencode then copy/paste into uudecode (and gunzip).
If you don't have uudecode, but do have a shell, you could use shar to compose your first lump of transmitted data.
If policy allows you install executables, you can use these simple upload methods as bootstraps to install a kermit/zmodem remote, or wget, or curl, or nc.
I know you said there's no netcat, but have you tried cross-compiling?
Busybox also includes a netcat client, which I've used on many ARM and MIPS embedded systems.
you can use curl
"curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, FILE and LDAP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos...), file transfer resume, proxy tunneling and a busload of other useful tricks."