home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / PLINESYS.ZIP / REMOTE.CMD < prev    next >
Encoding:
Text File  |  1991-03-15  |  7.3 KB  |  348 lines

  1. *
  2. * REMOTE.CMD
  3. *
  4. * Command File to do Remote System Access
  5. *    This is a sample PereLine Script that poses as a Remote Dial Up.
  6. *    While this is running users can dial into your system and they
  7. *    will be required to enter a login ID and Password.
  8. *    They will also have to enter commands via a menu interface.
  9. *
  10. *   Note: This whole file will execute somewhat faster if you remove
  11. *   some of these explanatory notes.
  12.  
  13. Define LAST_ON VT_AVAIL VT_SHORT VT_LONG
  14.  
  15. If Exist &SYSTEM\VHOST.EXE
  16.     Assign VT_AVAIL 1
  17.     Assign VT_SHORT ", Vterm"
  18.     Assign VT_LONG "Vterm       Virtual Terminal Option       Vterm [FileName.EXE Arg1 ... Arg0]"
  19. Else
  20.     Assign VT_AVAIL 0
  21.     Assign VT_SHORT ""
  22.     Assign VT_LONG ""
  23. EndIf
  24.     
  25. Get Global
  26. OnError Goto GetUser
  27. Goto Start
  28.  
  29. * Exiting Because Operator Pressed Esc 
  30. :Exit
  31. OnError Ignore
  32. Set Global
  33. Message Operator Canceled - Exiting ...
  34. If Not "&ISCONNECT"
  35.     Phone Answer 0
  36. EndIf
  37. Clear
  38. Exit OK
  39.  
  40. * Get out of here (I mean it !)
  41. :.G
  42. * Perform Quit
  43. Perform Quit
  44. Goto Start
  45.  
  46. * Virtual Terminal
  47. :.V
  48. If &VT_AVAIL = 1
  49.     Vhost &2 &3 &4 &5 &6 &7
  50.     FlushBuf
  51. EndIf
  52. Goto GetInput
  53.  
  54. * Send Help to the User
  55. :.H
  56.  
  57.     Transmit
  58.  ╔═[ PereLine Remote Help ]════════════════════════════════════════════════╗
  59.  ║ You must enter a complete PereLine Command to execute from the remote.  ║
  60.  ║ Enter Help for a List of Valid Commands.                                ║
  61.  ║ Enter the Command Goodbye when you are through.                         ║
  62.  ╚═════════════════════════════════════════════════════════════════════════╝
  63.  Command     Description                   Execution
  64.  ═══════════════════════════════════════════════════════════════════════════
  65.  Access      Access [Parms or Files]       Access Parms or Access Files
  66.  Change      Change Parameters             Change OPtion Parameter
  67.  Goodbye     Hang up the Phone             Goodbye
  68.  Help        Display this Help Message     Help
  69.  Message     Leave a message               Message
  70.  Protocol    Change the Current Protocol   Protocol [Type]
  71.  Receive     Transfer file from YOU to US  Receive [FileName if Not Batch]
  72.  Send        Transfer file from US to YOU  Send FileName ...
  73.  Talk        Talk with Remote Operator     Talk  
  74.  &VT_LONG
  75. EndTransmit
  76.  
  77. Goto GetInput
  78.  
  79. * Let them enter a message for the Remote Operator
  80. :.M
  81. Execute Message
  82. '
  83. Goto GetInput
  84.  
  85. * Set the Protocol
  86. :.P
  87. Save 9
  88. Args &0
  89. Restore 9
  90. If Not "&2"
  91.     Transmit
  92.     What Protocol?
  93.     ASC) ASCII (XON/XOFF)
  94.     XMD) XMODEM
  95.     XMC) XMODEM Checksum
  96.     XMB) XMODEM Batch
  97.     TEL) Telink
  98.     YMD) YMODEM
  99.     YMB) YMODEM Batch
  100.     YMG) YMODEM-G
  101.     KER) Kermit
  102.     ZMD) ZMODEM (DSZ)
  103.     EndTransmit
  104.     Enter Remote 2 Which? 
  105. EndIf
  106. If "&2"
  107.     If Not Change TRansfer &2
  108.         Transmit
  109. Protocols have to be one of the three character choices from the list.
  110.         EndTransmit
  111.     EndIf
  112. EndIf
  113. Goto GetInput
  114.  
  115. * Receive a File
  116. :.R
  117. Args &0
  118. If Not "&ISBATCH"
  119.     If Not "&2"
  120.         '
  121.         Enter Remote 2 Receive File Name? 
  122.     EndIf
  123.     '
  124.     'Ready to Receive using &PROTOCOL
  125.     '
  126.     ' On YOUR System:
  127.     '   Press [ALT+S] and SELECT &PROTOCOL
  128.     '      then
  129.     '   Select the file you want to SEND to US
  130.     Perform Receive &2
  131. Else
  132.     '
  133.     'Ready to Receive using &PROTOCOL
  134.     '
  135.     ' On YOUR System:
  136.     '   Press [ALT+S] and SELECT &PROTOCOL
  137.     '      then
  138.     '   Select the file you want to SEND to US
  139.     Perform Receive
  140. EndIf
  141. WaitFor Delay 2
  142. WaitFor Transfer
  143. WaitFor Delay 2
  144. FlushBuf
  145. Goto GetInput
  146.  
  147. * Send a File
  148. :.S
  149. Args &0
  150. If Not "&2"
  151.     '
  152.     Enter Remote 2 Send File Name? 
  153. EndIf
  154. '
  155. 'Ready to Send using &PROTOCOL
  156. '
  157. If "&ISBATCH"
  158.     ' On YOUR System:
  159.     '   Press [ALT+R] and SELECT &PROTOCOL
  160. Else
  161.     ' On YOUR System:
  162.     '   Press [ALT+R] and SELECT &PROTOCOL
  163.     '      then
  164.     'Select the NAME you want to call the file on YOUR system
  165. EndIf
  166. Perform Send &2 &3 &4 &5 &6 &7 &8 &9
  167. WaitFor Transfer
  168. Goto GetInput
  169.  
  170. * See if the Remote Operator Wants to Talk
  171. :.T
  172. OnError Goto NoTalk
  173.  
  174. Transmit
  175.  
  176. Trying to Find the Remote Operator Please Wait  (Press [Esc] to Abort ) ...
  177. EndTransmit
  178. Talk Page
  179. Transmit
  180.  
  181. Returning to Command Menu ...
  182.  
  183. EndTransmit
  184. Goto GetInput
  185.  
  186. * Nobody There or Aborted ...
  187. :NoTalk
  188. Transmit
  189.  
  190. Remote Operator is Not Responding ...
  191.  
  192. EndTransmit
  193. Goto GetInput
  194.  
  195. * Lost Connection
  196. * Restore Parameters and Go back and Wait
  197. :Done
  198. OnError Ignore
  199. Set
  200. Message Connection Lost ...
  201.  
  202. :Start
  203. Clear
  204. Display
  205.  
  206.  
  207.    ══════════════════════════════════════════════════════════════════════════
  208.  
  209.      ^RPereLine Remote Mode^N waiting for caller at Speed: &BAUD
  210.  
  211.          If you want to cancel Remote Mode press the ^R[Esc]^N key.
  212.  
  213.      Status:
  214. EndDisplay
  215.  
  216. If Exist \PL\MSG\SYSOP.MSG
  217.     Display \          ^BMail Waiting ...
  218. Else
  219.     Display \          No Mail Waiting ...
  220. Endif
  221.  
  222. If "&LAST_ON"
  223.     Display \          Last User Was: ^R&LAST_ON
  224. Else
  225.     Display \          No One Has Called Yet ...
  226. EndIf
  227.  
  228. Display
  229.  
  230.  
  231.    ══════════════════════════════════════════════════════════════════════════
  232. EndDisplay
  233.  
  234. * Wait for a Connection
  235. :GetUser
  236.  
  237. * Just a few little changes ... Couldn't hurt right?
  238. Change ALine Local ECho Local MAsk Off EMulate TTY
  239. Change ENter ^M NLine ^D CHar 0 REturn 0 TImer 20
  240. Get
  241. If Not "&ISCONNECT"
  242.     Phone HangUp
  243.     Phone Answer ON
  244. EndIf
  245.  
  246. OnError Goto Exit
  247. FlushBuf
  248. WaitFor Connection
  249. Clear
  250. * Got one ...
  251. * Find out who they are
  252. Change ALine Both
  253. Change ECho Both
  254.  
  255. OnError Goto Done
  256. FlushBuf
  257. SignOn
  258. FlushBuf
  259.  
  260. * Say Hello to the nice person ...
  261. Transmit
  262.  
  263.     Welcome -- &USER --
  264.     Today Is: &DATE &TIME 
  265.     Current File Transfer Protocol: &PROTOCOL
  266.     Security Set To: &XTERNAL
  267.  
  268.     Checking for Messages ... Please Wait ...
  269.  
  270. EndTransmit
  271.  
  272. OnError Goto GetInput
  273. * Any Message Files ???
  274. If Exist \PL\MSG\MESSAGE
  275.     'To Control the Display of Messages
  276.     'Enter [Ctrl+S] to Stop, [Ctrl+Q] to Start again, and [Ctrl+X] to Abort
  277.     '
  278.     Execute Type \PL\MSG\MESSAGE
  279.     Anykey Remote Press Any Key to Continue ...
  280.     '
  281. EndIf
  282.  
  283. If Exist \PL\MSG\\&USER.MSG
  284.     'To Control the Display of Messages
  285.     'Enter [Ctrl+S] to Stop, [Ctrl+Q] to Start again, and [Ctrl+X] to Abort
  286.     '
  287.     Execute Type \PL\MSG\\&USER.MSG
  288.     '
  289.     Anykey Remote Want to Delete the Messages? (y/N) 
  290.     '
  291.     If Key Y
  292.         DEL \PL\MSG\\&USER.MSG
  293.         '
  294.         'Messages for &USER Deleted ...
  295.         '
  296.     EndIf
  297. EndIf
  298.  
  299. * Sounds bad I know, but what are you gonna do?
  300. Goto .H
  301. *Skip to the Get User Stuff
  302. Goto GetUser
  303.  
  304. * --------------------------------------------------------------------------
  305. * Interactive Stuff (Remote User can Enter Commands)
  306. * First Check To see if there is a connection still.
  307. * Then prompt the remote user and get a command.
  308. :GetInput
  309. OnError Goto GetInput
  310. * Save the name of the last user
  311. If Not "&ISCONNECT"
  312.     Goto Done
  313. EndIf
  314.  
  315. Assign LAST_ON &USER at &TIME &DATE
  316.  
  317. Transmit
  318.  
  319. User (&USER)  Security (&XTERNAL)
  320. Current Protocol: &PROTOCOL
  321. Current Directory: &DIRECTORY
  322.  
  323. EndTransmit
  324.  
  325. If &VT_AVAIL = 1
  326.     Transmit
  327. Access, Change, Help, Goodbye, Message, Protocol, Receive, Send, Talk&VT_SHORT
  328.     EndTransmit
  329. Else
  330.     Transmit
  331. Access, Change, Help, Goodbye, Message, Protocol, Receive, Send, Talk
  332.     EndTransmit
  333. EndIf
  334.  
  335. Enter Remote 0 Command? 
  336.  
  337. * The following will find the label starting from the top of the 
  338. * Command File.  Let's only look at the first character.
  339. Assign 1 &LEFT(1 &0)
  340. Goto .&1
  341.  
  342. * If the .&1 Label was not found fall thru and
  343. * try to execute the string.
  344. :.&1
  345. Perform &0
  346. Goto GetInput
  347.  
  348.