==Phrack Inc.== Volume Three, Issue 30, File #6 of 12 Decnet Hackola : Remote Turist TTY (RTT) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% A Late-Night Creation Of *Hobbit* This VMS network frob is yet another "tell"-type thing. This one has an uncommon feature though: recursion (i.e. you can be connected to some host and open *another* connection to a third host and it will [attempt to!] "do the right thing"). Also, you can ^Y out and if you run it again, it will return to the open connection instead of starting a new one. _H* ************************************************************************* $! RTT -- Remote Turist TTY interface. Do @RTT hostname or @RTT area.node $! to start; this file must exist in the remote machine's default area. $! You can ^Y out and the network channel will stick around; invoking RTT $! again will resume the extant process and ignore arguments. $! If we are a network object, play server, if not, we must be the client. $! If we are called while already playing server, recurse to the end host. $! This recursion in theory can happen infinite times. Make damn sure $! what you call this file and the "task=" spec jive, and that they are the $! same file, or you will fall victim to very vicious timing screws. $! $! Another result of *Hobbit* abusing network file jobs until well past dawn. $! $! _H* $set noon $if f$mode().eqs."NETWORK".and.p1.eqs."" then $goto srv $! Talking to a luser, go find the net job $magic=0 ! assume top level $if f$trnlnm("nf",,,,,"table_name").nes."" then $goto lread $sl=f$len(p1) $dot=f$locate(".",p1) ! area.node $if sl.eq.dot then $goto nopen ! no dot, treat normally $q=f$loc("""",p1) ! access control?? $node=f$ext(0,dot,p1) ! area $dot=dot+1 ! point past it now $node=node*1024+f$ext(dot,q-dot,p1) ! and pull out the complete node $rest=""""+f$ext(q,80,p1)+"""" ! superquotify the quotes [yeccchh!] $p1="''node'''rest'" ! add remains in stringwise [ack barf] $! We were called with an argument; but if we're network mode, we're *already* $! a server, so do special things. $nopen: $if f$mode().eqs."NETWORK" then $magic=1 $! Top-level user process or recursed here: client connect $open/read/write/err=yuk nf 'p1'::"0=rtt" $read/time=5/err=yuk nf hprm ! let other end tell us where we got $prm==hprm ! global prompt str so we resume correctly $write sys$output "Connection open" $if magic then $goto m_setup $lread: $read/prompt="''prm'$ "/end=lclose sys$command line $write nf line ! send the sucker and go get the stuff $ltype: $read/time=8/err=tmo/end=lclose nf line $if line.eqs."%%eoc%%" then $goto lread $if line.eqs."%%magic%%" then $goto newprm $write sys$output line $goto ltype $newprm: $read nf hprm ! new prompt gets piped in from servers $prm==hprm ! let us find it $read nf line ! garbola %%eoc%% -- avoid timing fuckup $if line.nes."%%eoc%%" then $goto hpe !! oops !! $goto lread $tmo: $write sys$output "[Timed out]" ! supposed to bail out on a fuckup $goto lread ! it doesn't always work, though. $! $! Do a special dance when we're recursing $m_setup: $write nnn "%%magic%%" $write nnn prm ! notify client end of new connection $signal ! flush the inbetweens $goto rread ! and drop to magic server $! $srv: ! Normal remote task half $! This is an unbelievable kludge. You can't just open sys$net: and then $! have program output go there as well as the control thingies, but you $! *can* pipe everything to your sys$net-opened-device: and it *works*! $open/read/write/err=yuk nnn sys$net: $close sys$output ! netserver.log? $close sys$error $magic=0 ! not recursing yet $! Some handy symbols for the far end $rtt:==@sys$login:rtt ! make further connects easier $ncp:==$ncp ! for hacking the network $signal:==write nnn """%%eoc%%""" ! magic sync string $write nnn f$trnl("sys$node","lnm$system_table") ! HELO... $def/pr sys$output nnn: ! the awful kludge is invoked $def/pr sys$error nnn: ! for error handling too $! $! Server loop $rread: $read/end=rclose nnn line $if magic then $goto passing $'line' $m_cmd_end: $signal ! signal for all completions $goto rread $! If we're magically in the middle, handle differently $passing: $write nf line $mtype: $read/time=5/err=mclose/end=mclose nf line $if line.eqs."%%eoc%%" then $goto m_cmd_end $write nnn line $goto mtype $! $! Closure and error handlers $! General protocol error catch $yuk: $write sys$output "Couldn't open network!" $exit $! Here if the luser typed ^Z $lclose: $close nf ! should signal eof at far end $exit $! Here if we got hung up on by the client $rclose: $if magic then $close nf $close nnn $stop/id=0 $! Here if we're magic and our remote server exited: tell client whats flying $mclose: $close nf $magic=0 $write nnn "%%magic%%" $write nnn f$trnl("sys$node","lnm$system_table") $signal $goto rread $! Here if we recursed down the line there and didn't see the right things $hpe: $write sys$output "!!Hairy protocol error!!" $close nf $exit _______________________________________________________________________________  Downloaded From P-80 International Information Systems 304-744-2253 12yrs+