File size: 5,572 Bytes
8ecd256 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | ==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
_______________________________________________________________________________
|