home *** CD-ROM | disk | FTP | other *** search
/ Hacker Chronicles 1 / HACKER1.ISO / phrk3 / ph307.txt < prev    next >
Text File  |  1992-09-26  |  7KB  |  245 lines

  1.                                 ==Phrack Inc.=
  2.  
  3.                      Volume Three, Issue 30, File #7 of 12
  4.  
  5.                              =-------------------=
  6.  
  7.                                VAX/VMS Fake Mail
  8.  
  9.                                 by Jack T. Tab
  10.  
  11.                              =-------------------=
  12.  
  13.  
  14. In the August 1986 issue of VAX PROFESSIONAL, the BASIC subroutine that appears
  15. at the end of this text was published.  It was not until more than two years
  16. later that DEC included a callable mail interface with VMS 5.x.  While the
  17. official version is much more extensive, the routine included here has one
  18. important feature.  The ability to have a mail message appear to be from
  19. someone else is a good addition to most "toolkits."
  20.  
  21. VMS Mail works in two manners.  The first is the familiar interactive.  The
  22. second is as a network object.  In this method, MAIL is invoked by the
  23. NETSERVER.COM command procedure in response to an incoming connect request.
  24. MAIL.EXE is activated as network object 27.  The other network objects can be
  25. viewed by using the NCP command SHOW KNOWN OBJECTS.  In this mode, MAIL.EXE
  26. operates as a slave process, receiving instructions from the master process.
  27. The master, in most cases, is another process running MAIL.EXE interactively.
  28. The slave process can handle requests to deliver mail to as many recipients as
  29. necessary.  Addresses that are not on the same node as the slave process are
  30. forwarded by activating yet another slave process on the target node.  The
  31. information sent by the master MAIL to the slave MAIL is quite simple and
  32. straightforward, consisting of a series of strings.
  33.  
  34. The first string is for the FROM name.  This is what makes the subroutine
  35. useful, as it can be anything (i.e. the_Easter_Bunny).  The next set of strings
  36. are to whom the mail is to be sent.  One address per string, with a null
  37. string, chr(0), terminating the list.  The third item is what the receiver(s)
  38. sees in their TO: field.  This also can be anything.  VMS MAIL can use this
  39. option for its .DIS distribution lists.  The final information is the body of
  40. the message.  It too is terminated by another null string.  The subject of the
  41. mail message is taken from the first line of this text.
  42.  
  43. The MAIL slave will send back appropriate status messages indicating problems
  44. if they occur.  Such as "Addressee Unknown" or VMS and DECnet errors like "Disk
  45. Quota Exceeded" or "Remote Node Not Reachable").
  46.  
  47. The only privilege that seems necessary is NETMBX.  Without it the subroutine
  48. cannot call MAIL as a network object.  Our beloved system management resolved
  49. the problem of people pretending to be SYSTEM by installing MAIL with NETMBX
  50. and removing the priv from the student accounts.  The subroutine works just as
  51. well with JNET and BITNET as it does with DECNET addresses.
  52.  
  53.  
  54. ***********************************CUT HERE************************************
  55. 1  %TITLE 'MAIL SUBROUTINE'
  56.  
  57.    SUB MAILT( STRING NODE, &
  58.        STRING FROM_NAME, &
  59.        STRING TO_LIST(), &
  60.        STRING TO_SHOW, &
  61.        STRING SUBJECT, &
  62.        STRING TEXT() )
  63.  
  64.    OPTION TYPE = INTEGER
  65.  
  66.    DECLARE INTEGER FUNCTION &
  67.      PUT_MSG
  68.  
  69.    DECLARE STRING FUNCTION &
  70.      GET_MSG, &
  71.      GET_INPUT
  72.  
  73.    DECLARE INTEGER CONSTANT &
  74.      TRUE = -1, &
  75.      FALSE = 0
  76.    Net_Link_Open = FALSE
  77.  
  78.    Z = POS( NODE + ":" , ":" , 1)
  79.    NODE_NAME$ = LEFT$( NODE , Z - 1 )
  80.    ON ERROR GOTO Mail_Net_Error
  81.    MAIL_CHANNEL = 12
  82.    OPEN NODE_NAME$ + '::"27="' AS FILE MAIL_CHANNEL
  83.  
  84.    Net_Link_Open = TRUE
  85.  
  86.    STS = PUT_MSG( FROM_NAME )
  87.    IF STS <> 0 THEN
  88.      GOTO ERROR_DONE
  89.    END IF
  90.    RECEIVERS = 0
  91.    TO_COUNT = 1
  92.  
  93. Mail_Recipients:
  94.    IF TO_LIST( TO_COUNT ) = "" THEN
  95.      GOTO End_Of_Line
  96.    END IF
  97.    STS = PUT_MSG( EDIT$( TO_LIST( TO_COUNT ) , 32 ) )
  98.    IF STS <> 0 THEN
  99.      GOTO Error_Done
  100.    END IF
  101.    GOSUB Errchk
  102.    IF LINK_ERR <> 0 THEN
  103.      GOTO Error_Done
  104.    END IF
  105.  
  106.    IF ( ERRSTS AND 1 ) = 0 THEN
  107.      GOTO Error_Done
  108.    END IF
  109.  
  110.    TO_COUNT = TO_COUNT + 1
  111.    GOTO Mail_Recipients
  112.  
  113. END_OF_LINE:
  114.    STS = PUT_MSG( CHR$(0) )
  115.    IF STS <> 0 THEN
  116.      GOTO Error_Done
  117.    END IF
  118.    IF RECEIVERS = 0 THEN
  119.      GOTO Mail_Done
  120.    END IF
  121.  
  122.    STS = PUT_MSG( TO_SHOW )
  123.    IF STS <> 0 THEN
  124.      GOTO Error_Done
  125.    END IF
  126.  
  127.    STS = PUT_MSG( SUBJECT )
  128.    IF STS <> 0 THEN
  129.      GOTO Error_Done
  130.    END IF
  131.  
  132.    FOR I = 1 UNTIL TEXT(I) = CHR$(255)
  133.      STS = PUT_MSG( TEXT(I) )
  134.      IF STS <> 0 THEN
  135.        GOTO Error_Done
  136.      END IF
  137.    NEXT I
  138.  
  139.    STS = PUT_MSG( CHR$(0) )
  140.    IF STS <> 0 THEN
  141.      GOTO Error_Done
  142.    END IF
  143.    SAVE_COUNT = RECEIVERS
  144.    INDEX = 0
  145.  
  146. Delivery_Check:
  147.    GOSUB Errchk
  148.    IF LINK_ERR <> 0 THEN
  149.      GOTO Error_Done
  150.    END IF
  151.    INDEX = INDEX + 1
  152.    IF INDEX <> SAVE_COUNT THEN
  153.      GOTO Delivery_Check
  154.    END IF
  155.    GOTO Mail_Done
  156.  
  157. Errchk:
  158.    MAIL_STS = ASCII( GET_MSG )
  159.    IF LINK_ERR <> 0 THEN
  160.      ERRSTS = LINK_ERR
  161.      RETURN
  162.    END IF
  163.    IF ( MAIL_STS AND 1 ) = 1 THEN
  164.      Receivers = Receivers + 1
  165.      ERRSTS = MAIL_STS
  166.      RETURN
  167.    END IF
  168.  
  169. Errmsg:
  170.    MAIL_ERR$ = GET_MSG
  171.    IF LINK_ERR <> 0 THEN
  172.      ERRSTS = LINK_ERR
  173.      RETURN
  174.    END IF
  175.    IF LEN( MAIL_ERR$ ) <> 1 THEN
  176.      PRINT MAIL_ERR$
  177.      GOTO Errmsg
  178.    END IF
  179.    IF ASCII( MAIL_ERR$ ) = 0 THEN
  180.      RETURN
  181.    ELSE
  182.      GOTO Errmsg
  183.    END IF
  184.  
  185.    DEF INTEGER PUT_MSG( STRING M )
  186.    ON ERROR GOTO 1550
  187.    MLEN = LEN( M )
  188.    MOVE TO # MAIL_CHANNEL , M = MLEN
  189.    PUT # MAIL_CHANNEL, COUNT MLEN
  190.    PUT_MSG = 0
  191.    EXIT DEF
  192.  
  193. 1550 RESUME 1555
  194.  
  195. 1555 PUT_MSG = ERR
  196.      END DEF
  197.  
  198.    DEF STRING GET_INPUT( INTEGER C )
  199.    EOF = FALSE
  200.    ON ERROR GOTO 1650
  201.    GET # C
  202.    R = RECOUNT
  203.    MOVE FROM #C , TEMP$ = R
  204.    GET_INPUT = TEMP$
  205.    EXIT DEF
  206.  
  207. 1650 RESUME 1655
  208.  
  209. 1655 EOF = TRUE
  210.      END DEF
  211.  
  212.    DEF STRING GET_MSG
  213.    ON ERROR GOTO 1750
  214.    GET # MAIL_CHANNEL
  215.    R = RECOUNT
  216.    MOVE FROM # MAIL_CHANNEL , TEMP$ = R
  217.    GET_MSG = TEMP$
  218.    LINK_ERR = 0
  219.    EXIT DEF
  220.  
  221. 1750 RESUME
  222.  
  223. 1755 LINK_ERR = ERR
  224.      END DEF
  225.  
  226. Mail_Net_Error:
  227.   RESUME 1900
  228.  
  229. 1900 PRINT "%Network communications error."
  230.  
  231. Error_Done:
  232.  
  233. Mail_Done:
  234.    IF Net_Link_Open THEN
  235.      CLOSE MAIL_CHANNEL
  236.    END IF
  237.  
  238.    END SUB
  239. ***********************************CUT HERE************************************
  240. _______________________________________________________________________________
  241.  
  242. 
  243.  
  244. Downloaded From P-80 International Information Systems 304-744-2253 12yrs+
  245.