Skip to main content
gamedev.net
🔒 Locked

telnet server question

Started by Nervo 4 replies 900+ views
Original Post
Nervo
Nervo
I wanted to know how I could execute system commands remotely over winsock and have the results sent back to my client over ip. Basically I just wanted to make simple remote shell under XP. I'm unable to find anything on google that would simply outline the basic process or functions to look into. I'll be using C and C++.. Thanks. [edited by - nervo on January 28, 2004 10:52:24 AM]
Well, R2D22U2..
__tunjin__
__tunjin__
ShellExecuteEx()

still if you just wan''t it for personal use: take a look at cygwin+sshd..
moore52
moore52
this is a part of my server program:

r = recv(client,buffer_in,sizeof(buffer_in),0);
if (!(r == 0 || r == SOCKET_ERROR || r>=MAX_BUFFER))
{
*(buffer_in+r)=0;

now in buffer_in you got text you received from one packet, so do as __tunjin__ said:

ShellExecuteEx()
Nervo
Nervo
ah, ShellExecuteEx() is definitely the key thing I needed. Thanks guys.

EDIT: One thing though...ShellExecuteEx() is fine but I don't think it solves this:

Lets say I wanted to telnet to a command prompt and based on input, say a simple one like typing "dir" and sending that to the system, how can that be done so what is being outputted from the system can be sent through to the remote client. i.e. the directory contents. It's simple to send a system() function call to the computer, but getting the output is what is important.

[edited by - nervo on January 28, 2004 2:43:03 PM]
Well, R2D22U2..
intransigent-seal
intransigent-seal
popen might be what you need. If not that, one of the other piping functions.

John B
The best thing about the internet is the way people with no experience or qualifications can pretend to be completely superior to other people who have no experience or qualifications.
Nervo
Nervo
quote:
Original post by JohnBSmall
popen might be what you need. If not that, one of the other piping functions.

John B


Well, I''ll be damned. Thats it alright. I just tested it and works just great. Thanks John.
Well, R2D22U2..

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.