Article View: vmsnet.sysmgt
Article #71ADDR_CVT.COM - Internet address conversion program
From: Shawn A. Clifford
Date: Mon, 14 Dec 1992 17:08
Date: Mon, 14 Dec 1992 17:08
59 lines
2531 bytes
2531 bytes
Here is a program that might be useful for tracing security messages concerning
internet access. The security message gives the address as a longword, and
maybe shows part of the dotted decimal address. This program will convert the
unsigned longword to dotted decimal (and hex), and vice-versa.
$! Title: ADDR_CVT.COM
$! Author: Shawn A. Clifford
$! Date: 09-DEC-1992
$! Purpose: Convert longword network addresses (as they appear in SECURITY
$! intrusion messages) into an internet dotted address, or
$! vice-versa.
$! Usage: @ADDR_CVT [longword_address|dotted_address]
$! ----------------------------------------------------------------------------
$! 'f$verify(0)
$ w := write sys$output
$ w ""
$ if (p1.nes."")
$ then
$ $addr$ = p1
$ if (f$type($addr$).eqs."INTEGER") then -
w "Longword: ''$addr$'" ! Print the longword before it gets signed
$ else
$ read/prompt="Enter a dotted or longword internet address: " sys$command $addr$
$ endif
$ if (f$type($addr$).nes."INTEGER") then goto to_longword
$!
$to_dotted:
$ $addr$=f$integer($addr$) ! Convert to signed integer
$ hex$=f$fao("!XL",$addr$) ! Convert the longword to a hex string
$ q1_hex=f$extract(0,2,hex$) ! Extract the hex quartet
$ q2_hex=f$extract(2,2,hex$)
$ q3_hex=f$extract(4,2,hex$)
$ q4_hex=f$extract(6,2,hex$)
$ q1=%x'q1_hex ! Convert quartet to integers
$ q2=%x'q2_hex
$ q3=%x'q3_hex
$ q4=%x'q4_hex
$!
$! Print results
$ w "Internet Address: ''q1'.''q2'.''q3'.''q4' or ''q1_hex'.''q2_hex'.''q3_hex'.''q4_hex'"
$ w ""
$ exit
$!
$to_longword:
$ x=1
$ temp=$addr$
$ loop:
$ q'x'=f$extract(0, f$locate(".",$addr$), $addr$)
$ $addr$=f$extract( f$locate(".",$addr$) + 1, f$length($addr$), $addr$ )
$ x=x+1
$ if (x.le.4) then goto loop
$ $long$=('q1'*256*256*256)+('q2'*256*256)+('q3'*256)+'q4'
$ $long$:='f$fao("!ZL",$long$)
$!
$! Print results
$ w "Longword form of internet address ''temp' is ''$long$'"
$ w ""
$ exit
Technical Details
Message-ID:
<14DEC199212080841@robot.nuceng.ufl.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!eng.ufl.edu!robot.nuceng.ufl.edu!sysopShow Full Headers
Complete Article Headers
Newsgroups: vmsnet.sysmgt Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!eng.ufl.edu!robot.nuceng.ufl.edu!sysop From: sysop@robot.nuceng.ufl.edu (Shawn A. Clifford) Subject: ADDR_CVT.COM - Internet address conversion program Message-ID: <14DEC199212080841@robot.nuceng.ufl.edu> News-Software: VAX/VMS VNEWS 1.41 Sender: news@eng.ufl.edu (Usenet Diskhog System) Reply-To: sysop@robot.nuceng.ufl.edu Organization: Nuclear Engineering Sciences - Univ. of Florida Date: 14 Dec 1992 12:08 EST Lines: 59