LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-16-2010, 03:35 AM   #1
rinkuburagohain
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Rep: Reputation: 0
remote access using socket programming


i want to open a cmd.exe of a remote machine in my own machine.. i am using c language..its just for educational purpose..can any one give me some idea..
 
Old 12-16-2010, 04:03 AM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
It is possible. First - do you have access to that Windows machine? It means, can you run your own programs on it?
 
Old 12-16-2010, 04:25 AM   #3
rinkuburagohain
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Original Poster
Rep: Reputation: 0
no actually my approach is very simple.. my server code will in one machine and client code will be in the remote machine. now when the client code will be executed its cmd should be open in my machine so that i can access that remote machine..i am able to make connection with the remote machine..
 
Old 12-17-2010, 02:12 AM   #4
rinkuburagohain
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Original Poster
Rep: Reputation: 0
hii eSelix,can you tell me how will i run my own programs on client side..i means my server code should be run on client system..m i right?
 
Old 12-17-2010, 04:52 AM   #5
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Yes, your server application (which run commands, for example cmd.exe) must be on the remote machine. And your client application, your virtual cmd.exe, will connect to that server. You must have access to execute own files on this remote machine and run your server application there. Therefore I ask about that. If you haven't that access you can't do it - maybe by hacking, but this forum is not for that.

To compile programs for Windows, you can do it on the Windows by DevCpp or other compiler, or do it on the Linux under wine, or more uncomfortably using cross compilation. I suggest one of two first.

Last edited by eSelix; 12-17-2010 at 04:53 AM.
 
Old 12-17-2010, 05:34 AM   #6
rinkuburagohain
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Original Poster
Rep: Reputation: 0
sorry i am not getting how to access it.. till now i am just able to open cmd prone in the remote machine from server side... but i have to get the control of that cmd prone in my server machine..dont know how to do it?
can we do something like this, if it is possible to send the cmd.exe file of client machine from client side to server side, and in server side if we can execute it..i dont know whether it is possible or not..
 
Old 12-17-2010, 06:39 PM   #7
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Well, the idea is quite simple. The server listen connection and when client connect it execute cmd.exe through CreateProcess() As I see this function can define handle to standard input, output and error. I think you can connect it to network socket or memory and then send/receive through connection. On the client side (Linux) you do the oposite: standard output of server conect with standard input of client and vice versa.
 
Old 12-18-2010, 02:25 AM   #8
rinkuburagohain
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Original Poster
Rep: Reputation: 0
ok, before i was using system() to open the cmd.exe..now with createprocess() and able to open cmd.exe in remote side.now you are talking about to send the output of createprocess() to my machine.

i think you are talking about "lpProcessInformation" which is a pointer to a PROCESS_INFORMATION structure that receives identification information about the new process, m i right? but the problem is how to send it using send()..because the "processinformation" is not character type..
 
Old 12-18-2010, 10:28 AM   #9
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
PROCESS_INFORMATION structure contain handles do standard output and input. Check if you can pass there handle of socket.
 
Old 12-27-2010, 11:44 PM   #10
rinkuburagohain
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Original Poster
Rep: Reputation: 0
hii eSlix finally i have done this using some different approach..i can now access the remote system from my machine, basically i can execute all the DOS based windows command on the remote machine..thank you for your kind advice..
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
installing linux for remote access programming emma_p Linux - Newbie 4 06-19-2009 01:22 PM
Socket Programming ashley_31 Linux - Software 2 06-05-2006 02:30 AM
socket programming iiit Programming 2 07-05-2005 04:02 PM
want help in socket programming valib4u *BSD 2 09-11-2003 11:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration