[isalist] Re: SQL Server Logging

  • From: "Jonathon J. Howey" <Jonathon@xxxxxxxx>
  • To: <isalist@xxxxxxxxxxxxx>
  • Date: Thu, 4 May 2006 09:05:02 -0600

3. How do I convert a IP Address to a IP Number?

IP address (IPV4) is divided into 4 sub-blocks. Each sub-block has a
different weight number each powered by 256. IP number is being used in
the database because it is efficient to search between a range of number
in database.

Beginning IP number and Ending IP Number are calculated based on
following formula:
IP Number = 16777216*w + 65536*x + 256*y + z     (1)

where
IP Address = w.x.y.z

For example, if IP address is "202.186.13.4", then its IP Number
"3401190660" is based on the formula (1).

IP Address = 202.186.13.4

So, w = 202, x = 186, y = 13 and z = 4

IP Number = 16777216*202 + 65536*186 + 256*13 + 4
          = 3388997632 + 12189696 + 3328 + 4
          = 3401190660

To reverse IP number to IP address,

w = int ( IP Number / 16777216 ) % 256
x = int ( IP Number / 65536    ) % 256
y = int ( IP Number / 256      ) % 256
z = int ( IP Number            ) % 256

where % is the mod operator and int is return the integer part of the
division.


Example ASP Function To Convert IP Address to IP Number

Function Dot2LongIP (ByVal DottedIP)
Dim i, pos
Dim PrevPos, num
If DottedIP = "" Then
    Dot2LongIP = 0
Else
    For i = 1 To 4
        pos = InStr(PrevPos + 1, DottedIP, ".", 1)
        If i = 4 Then 
            pos = Len(DottedIP) + 1
        End If
        num = Int(Mid(DottedIP, PrevPos + 1, pos - PrevPos - 1))
        PrevPos = pos
        Dot2LongIP = ((num Mod 256) * (256 ^ (4 - i))) + Dot2LongIP
    Next
End If
End Function 

Example PHP Function To Convert IP Address to IP Number

function Dot2LongIP ($IPaddr)
{
    if ($IPaddr == "") {
        return 0;
    } else {
        $ips = split ("\.", "$IPaddr");
        return ($ips[3] + $ips[2] * 256 + $ips[1] * 256 * 256 + $ips[0]
* 256 * 256 * 256);
    }
}
 
Jonathon J. Howey
MENSE Inc.
P 780.409.5620
F 780.409.5621
D 780.409.5628
C 780.965.8363
Jonathon@xxxxxxxx
 
Defining the Future of Transportation
www.MENSE.ca <http://www.mense.ca/> 
 
 
 

________________________________

From: isalist-bounce@xxxxxxxxxxxxx [mailto:isalist-bounce@xxxxxxxxxxxxx]
On Behalf Of Corciega, Michael P.
Sent: May 4, 2006 4:29 AM
To: isalist@xxxxxxxxxxxxx
Subject: [isalist] SQL Server Logging
Importance: High


Hi All,
 
Can you please help me with this, I configured my ISA2K4 to log web
traffic on a remote SQL server. My problem is, why is it that the output
on the ClientIP and DestHostIP columns are encrypted (see attached
figure). But when you check and query from the ISA Server > Monitoring >
Logging these columns are visible. How can I show/decrypt the IPs on the
ISA Logs?
 
Snapshot from SQL 
 
 
Snapshot from ISA query log
 
 
 
 
Many thanks,
 
mykel
DISCLAIMER:
This Message may contain confidential information intended only for the
use of the addressee named above. If you are not the intended recipient
of this message you are hereby notified that any use, dissemination,
distribution or reproduction of this message is prohibited. If you
received this message in error please notify your Mail Administrator and
delete this message immediately. Any views expressed in this message are
those of the individual sender and may not necessarily reflect the views
of GMA Network, Inc. 

JPEG image

JPEG image

Other related posts: