i want to write remote console server
i conenct to it and get the shell. windows and unix.
easy approach is to redirect std in/out/err to socket file, but that sucks. I would like to have control signals, like ctrl+c. So if it hang, i would be able to reset without reconnecting.
Any ideas? And i want to be able to connect from this server to other, then other and make chain if needed. What approach should i take? ctrl+c and such events should be redirected, or not? or maybe a nest level? or bad idea.
im counting on your exp in this matter.
im using stnadard dlls on windows (or maybe i also do it on syscalls), and syscalls on linux.
remote console
Started by
Guest_h4x_*
, Oct 06 2009 11:15 AM
7 replies to this topic
#1
Guest_h4x_*
Posted 06 October 2009 - 11:15 AM
Guest_h4x_*
|
|
|
#2
Posted 09 October 2009 - 12:00 AM
Just set handlers for control codes (check out signal.h at the very least) and just send the control codes from there to the socket. For example:
/*initialize this in main() or something*/
int g_socket;
int ctrl_c_handler(int unused) {
write(g_socket,"\003",1);
}
sudo rm -rf /
#3
Guest_h4x_*
Posted 09 October 2009 - 07:32 AM
Guest_h4x_*
ok, but if i run something from this console?
for example
conenct>consile>console>console>console>send ctrl+c.
wich one should process it?
if i forward it to the last, i risk deadlock in chain.
if i wont forward - only first will processm killing chain.
for example
conenct>consile>console>console>console>send ctrl+c.
wich one should process it?
if i forward it to the last, i risk deadlock in chain.
if i wont forward - only first will processm killing chain.
#4
Posted 09 October 2009 - 11:32 AM
Deadlock avoidance/detection algorithms, perhaps? What kind of deadlock are you thinking?
sudo rm -rf /
#5
Guest_h4x_*
Posted 10 October 2009 - 07:30 AM
Guest_h4x_*
i told you.
i redirect stdin to child, and it will permanently loop to write.
its deadlock, i can do nothing but disconnect and wait untill connection timeout will terminate parent and its children.
i want to send ctrl+c to kill process if i no longer need it.
but i dont know how, i could write server and protocol for it, like 0x00 = command to forward, 0x01 = control, check and take action (like kill or switch to background).
i have no experience in doing that.
i redirect stdin to child, and it will permanently loop to write.
its deadlock, i can do nothing but disconnect and wait untill connection timeout will terminate parent and its children.
i want to send ctrl+c to kill process if i no longer need it.
but i dont know how, i could write server and protocol for it, like 0x00 = command to forward, 0x01 = control, check and take action (like kill or switch to background).
i have no experience in doing that.
#6
Posted 10 October 2009 - 11:23 AM
0x03 is CTRL-C. I would definitely rethink how you're doing this, as you're correct, there is a potential for deadlock. Plus CTRL-C won't always kill a process, sometimes you need the kill signal (0x09 if I remember correctly).
sudo rm -rf /
#7
Guest_h4x_*
Posted 11 October 2009 - 03:14 AM
Guest_h4x_*
ok nvm.
do you know how signals are delivered?
do they go via stdin, or kernel send them to inner function?
fir example, ctrl+c.
can i just send it via stdin, or console windows recive message that key was pressed and call kill() function, wich tell kernel to send signal to process actually attached to console.
do you know how signals are delivered?
do they go via stdin, or kernel send them to inner function?
fir example, ctrl+c.
can i just send it via stdin, or console windows recive message that key was pressed and call kill() function, wich tell kernel to send signal to process actually attached to console.
#8
Posted 11 October 2009 - 11:49 AM
Probably the second; I don't know the inner workings of the Linux kernel very well.
sudo rm -rf /


Sign In
Create Account

Back to top









