home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / vmsnet / sysmgt / 395 < prev    next >
Encoding:
Text File  |  1992-12-14  |  2.4 KB  |  72 lines

  1. Newsgroups: vmsnet.sysmgt
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!eng.ufl.edu!robot.nuceng.ufl.edu!sysop
  3. From: sysop@robot.nuceng.ufl.edu (Shawn A. Clifford)
  4. Subject: ADDR_CVT.COM - Internet address conversion program
  5. Message-ID: <14DEC199212080841@robot.nuceng.ufl.edu>
  6. News-Software: VAX/VMS VNEWS 1.41    
  7. Sender: news@eng.ufl.edu (Usenet Diskhog System)
  8. Reply-To: sysop@robot.nuceng.ufl.edu
  9. Organization: Nuclear Engineering Sciences - Univ. of Florida
  10. Date: 14 Dec 1992 12:08 EST  
  11. Lines: 59
  12.  
  13. Here is a program that might be useful for tracing security messages concerning
  14. internet access.  The security message gives the address as a longword, and
  15. maybe shows part of the dotted decimal address.  This program will convert the
  16. unsigned longword to dotted decimal (and hex), and vice-versa.
  17.  
  18.  
  19. $! Title:    ADDR_CVT.COM
  20. $! Author:    Shawn A. Clifford
  21. $! Date:    09-DEC-1992
  22. $! Purpose:    Convert longword network addresses (as they appear in SECURITY
  23. $!        intrusion messages) into an internet dotted address, or
  24. $!        vice-versa.
  25. $! Usage:    @ADDR_CVT [longword_address|dotted_address]
  26. $! ----------------------------------------------------------------------------
  27. $! 'f$verify(0)
  28. $ w := write sys$output
  29. $ w ""
  30. $ if (p1.nes."")
  31. $ then
  32. $    $addr$ = p1
  33. $    if (f$type($addr$).eqs."INTEGER") then -
  34.      w "Longword:  ''$addr$'"    ! Print the longword before it gets signed
  35. $ else
  36. $    read/prompt="Enter a dotted or longword internet address:  " sys$command $addr$
  37. $ endif
  38. $ if (f$type($addr$).nes."INTEGER") then goto to_longword
  39. $!
  40. $to_dotted:
  41. $   $addr$=f$integer($addr$)    ! Convert to signed integer
  42. $   hex$=f$fao("!XL",$addr$)    ! Convert the longword to a hex string
  43. $   q1_hex=f$extract(0,2,hex$)    ! Extract the hex quartet
  44. $   q2_hex=f$extract(2,2,hex$)
  45. $   q3_hex=f$extract(4,2,hex$)
  46. $   q4_hex=f$extract(6,2,hex$)
  47. $   q1=%x'q1_hex        ! Convert quartet to integers
  48. $   q2=%x'q2_hex
  49. $   q3=%x'q3_hex
  50. $   q4=%x'q4_hex
  51. $!
  52. $!    Print results
  53. $ w "Internet Address:  ''q1'.''q2'.''q3'.''q4'   or   ''q1_hex'.''q2_hex'.''q3_hex'.''q4_hex'"
  54. $ w ""
  55. $ exit
  56. $!
  57. $to_longword:
  58. $   x=1
  59. $   temp=$addr$
  60. $   loop:
  61. $      q'x'=f$extract(0, f$locate(".",$addr$), $addr$)
  62. $      $addr$=f$extract( f$locate(".",$addr$) + 1, f$length($addr$), $addr$ )
  63. $      x=x+1
  64. $   if (x.le.4) then goto loop
  65. $   $long$=('q1'*256*256*256)+('q2'*256*256)+('q3'*256)+'q4'
  66. $   $long$:='f$fao("!ZL",$long$)
  67. $!
  68. $!    Print results
  69. $ w "Longword form of internet address  ''temp'  is  ''$long$'"
  70. $ w ""
  71. $ exit
  72.