cancel
Showing results for 
Search instead for 
Did you mean: 

Converting IP address in Binary to Std format??

Hi,

I am using the EPOEvents table and I need to convert the IP address field in the std format (xxx.xxx.xxx.xxx)

I have used this function to atleast convert this to binary from default int format. But I am not able to convert this further to

std format

dbo.epoConvertIntToIPV4Binary(E1.SourceIPV4)

Please help..

Thanks,

Micks

Tags (3)
4 Replies
McAfee Employee spamidi
McAfee Employee
Report Inappropriate Content
Message 2 of 5

Re: Converting IP address in Binary to Std format??

the RSD inbuilt function converts the IPV4 int value to string (as noted in reply to your other post)

RSDFN_ConvertIntToIPString(AnalyzerIPv4)

Re: Converting IP address in Binary to Std format??

Hey Sailendra,

Thanks for helping. But This function RSDFN_ConvertIntToIPString is not there in my  funtions->scalar-valued-functions->..

I tried running the command but it says 'RSDFN_ConvertIntToIPString' is not a recognized built-in function name.

Which Epo version are u using and can u send me this functions location and definition..

thanks a lot,

micks

GWIRT
Level 12
Report Inappropriate Content
Message 4 of 5

Re: Converting IP address in Binary to Std format??

If you are using ePO 4.0, you will need to install Rogue System Detection to get this function.

McAfee Employee tb_ng
McAfee Employee
Report Inappropriate Content
Message 5 of 5

Re: Converting IP address in Binary to Std format??

Thanks to the information from Greg's post, I was able to find a way to do this without installing Rogue System detection -- which I don't have approval to do in my environment (at least not yet).  I was able to extract the code from the RSD installation files that creates the function and use that to create a new stand-alone function.  I would recommend changing the name of the function (RSDFN_ConvertIntToIPString) so that any future installs/upgrades of RSD will not be impacted.  I just changed the RSDFN prefix on mine.

CREATE FUNCTION  [dbo].[RSDFN_ConvertIntToIPString]
(
    @ipin int
)
RETURNS  CHAR(15)
AS
BEGIN
declare @o1 bigint, @o2 bigint, @o3 bigint, @o4  bigint;
declare @ip bigint;
-- This is the magic epo conversion  size...
    set @ip = (CAST(@ipin as bigint) + 2147483647) + 1;
    SET @o1 = @ip / 16777216;
    SET  @ip = @ip % 16777216;
    SET @o2 = @ip / 65536;
    SET @ip = @ip %  65536;
    SET @o3 = @ip / 256;
    SET @ip = @ip % 256;
    SET @o4 =  @ip;
    RETURN
        CONVERT(VARCHAR(4),  @o1) + '.' +
        CONVERT(VARCHAR(4), @o2) + '.' +
         CONVERT(VARCHAR(4), @o3) + '.' +
        CONVERT(VARCHAR(4),  @o4)
END
More McAfee Tools to Help You

Community Help Hub

    New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

  • Find Forum FAQs
  • Learn How to Earn Badges
  • Ask for Help
Go to Community Help

Join the Community

    Thousands of customers use the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

  • Get helpful solutions from McAfee experts.
  • Stay connected to product conversations that matter to you.
  • Participate in product groups led by McAfee employees.
Join the Community
Join the Community