home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / zines / phrack1 / phrack30.006 < prev    next >
Encoding:
Text File  |  2003-06-11  |  5.1 KB  |  93 lines

  1.  
  2.                 ==Phrack Inc.==
  3.  
  4.              Volume Three, Issue 30, File #6 of 12
  5.  
  6.            Decnet Hackola : Remote Turist TTY (RTT)
  7.            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  8.  
  9.                A Late-Night Creation Of
  10.  
  11.                    *Hobbit*
  12.  
  13. This VMS network frob is yet another "tell"-type thing.  This one has an
  14. uncommon feature though:  recursion (i.e. you can be connected to some host and
  15. open *another* connection to a third host and it will [attempt to!] "do the
  16. right thing").  Also, you can ^Y out and if you run it again, it will return to
  17. the open connection instead of starting a new one.
  18.  
  19. _H*
  20.  
  21.  
  22. *************************************************************************
  23. $! RTT -- Remote Turist TTY interface.    Do @RTT hostname or @RTT area.node
  24. $! to start; this file must exist in the remote machine's default area.
  25. $! You can ^Y out and the network channel will stick around; invoking RTT
  26. $! again will resume the extant process and ignore arguments.
  27. $! If we are a network object, play server, if not, we must be the client.
  28. $! If we are called while already playing server, recurse to the end host.
  29. $! This recursion in theory can happen infinite times.    Make damn sure
  30. $! what you call this file and the "task=" spec jive, and that they are the
  31. $! same file, or you will fall victim to very vicious timing screws.
  32. $!
  33. $! Another result of *Hobbit* abusing network file jobs until well past dawn.
  34. $!
  35. $! _H* $set noon $if f$mode().eqs."NETWORK".and.p1.eqs."" then $goto srv
  36. $! Talking to a luser, go find the net job $magic=0
  37.  ! assume top level $if f$trnlnm("nf",,,,,"table_name").nes."" then $goto lread
  38. $sl=f$len(p1) $dot=f$locate(".",p1)           ! area.node $if sl.eq.dot then
  39. $goto nopen  ! no dot, treat normally $q=f$loc("""",p1)
  40. ! access control?? $node=f$ext(0,dot,p1)       ! area
  41. $dot=dot+1            ! point past it now
  42. $node=node*1024+f$ext(dot,q-dot,p1)  ! and pull out the complete node
  43. $rest=""""+f$ext(q,80,p1)+""""  ! superquotify the quotes [yeccchh!]
  44. $p1="''node'''rest'"            ! add remains in stringwise [ack barf]
  45. $! We were called with an argument; but if we're network mode, we're *already*
  46. $! a server, so do special things. $nopen: $if f$mode().eqs."NETWORK" then
  47. $magic=1 $! Top-level user process or recursed here: client connect
  48. $open/read/write/err=yuk nf 'p1'::"0=rtt" $read/time=5/err=yuk nf hprm
  49. ! let other end tell us where we got $prm==hprm              ! global
  50. prompt str so we resume correctly $write sys$output "Connection open" $if magic
  51. then $goto m_setup $lread: $read/prompt="''prm'$ "/end=lclose sys$command line
  52. $write nf line            ! send the sucker and go get the stuff $ltype:
  53. $read/time=8/err=tmo/end=lclose nf line $if line.eqs."%%eoc%%" then $goto lread
  54. $if line.eqs."%%magic%%" then $goto newprm $write sys$output line $goto ltype
  55. $newprm: $read nf hprm        ! new prompt gets piped in from servers
  56. $prm==hprm            ! let us find it $read nf
  57. line               ! garbola %%eoc%% -- avoid timing fuckup $if
  58. line.nes."%%eoc%%" then $goto hpe  !! oops !! $goto lread $tmo: $write
  59. sys$output "[Timed out]"   ! supposed to bail out on a fuckup $goto
  60. lread                  ! it doesn't always work, though. $! $! Do a
  61. special dance when we're recursing $m_setup: $write nnn "%%magic%%" $write nnn
  62. prm             ! notify client end of new connection
  63. $signal             ! flush the inbetweens $goto
  64. rread              ! and drop to magic server $!
  65. $srv:                ! Normal remote task half $! This is an
  66. unbelievable kludge.  You can't just open sys$net: and then $! have program
  67. output go there as well as the control thingies, but you $! *can* pipe
  68. everything to your sys$net-opened-device: and it *works*!
  69. $open/read/write/err=yuk nnn sys$net: $close sys$output           !
  70. netserver.log? $close sys$error $magic=0            ! not recursing
  71. yet
  72. $! Some handy symbols for the far end $rtt:==@sys$login:rtt          ! make
  73. further connects easier $ncp:==$ncp            ! for hacking the
  74. network $signal:==write nnn """%%eoc%%""" ! magic sync string $write nnn
  75. f$trnl("sys$node","lnm$system_table")        ! HELO... $def/pr sys$output
  76. nnn:         ! the awful kludge is invoked $def/pr sys$error nnn:       !
  77. for error handling too $! $! Server loop $rread: $read/end=rclose nnn line $if
  78. magic then $goto passing $'line' $m_cmd_end: $signal             ! signal for
  79. all completions $goto rread $! If we're magically in the middle, handle
  80. differently $passing: $write nf line $mtype: $read/time=5/err=mclose/end=mclose
  81. nf line $if line.eqs."%%eoc%%" then $goto m_cmd_end $write nnn line $goto mtype
  82. $!
  83. $! Closure and error handlers $! General protocol error catch $yuk: $write
  84. sys$output "Couldn't open network!" $exit $! Here if the luser typed ^Z
  85. $lclose: $close nf        ! should signal eof at far end $exit
  86. $! Here if we got hung up on by the client $rclose: $if magic then $close nf
  87. $close nnn $stop/id=0 $! Here if we're magic and our remote server exited: tell
  88. client whats flying $mclose: $close nf $magic=0 $write nnn "%%magic%%" $write
  89. nnn f$trnl("sys$node","lnm$system_table") $signal $goto rread
  90. $! Here if we recursed down the line there and didn't see the right things
  91. $hpe: $write sys$output "!!Hairy protocol error!!" $close nf $exit
  92. _______________________________________________________________________________
  93.