Search Postgresql Archives

Re: Casting hexadecimal IPs to readable content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jean-Michel,

to be sure the documentation of that storage would be needed. But my educated guess is:

select get_byte(decode(substring('52e1fcb6',1,2),'hex'),0)||'.'||
get_byte(decode(substring('52e1fcb6',3,2),'hex'),0)||'.'||
get_byte(decode(substring('52e1fcb6',5,2),'hex'),0)||'.'||
get_byte(decode(substring('52e1fcb6',7,2),'hex'),0)

of course translated to:

select get_byte(decode(substring("columname",1,2),'hex'),0)||'.'||
get_byte(decode(substring("columname",3,2),'hex'),0)||'.'||
get_byte(decode(substring("columname",5,2),'hex'),0)||'.'||
get_byte(decode(substring("columname",7,2),'hex'),0)  from yourtable

where "columname" is the name of the column with the IPs.

Best wishes,

Harald

On Nov 22, 2007 5:13 PM, Jean-Michel Pouré <jm@xxxxxxxxx > wrote:
Dear Friends,

My PhpBB forum with 4000 users was hacked in Switzerland.

Enquirers (not my own idea) proposed that I look for certain IPs in my
PostgreSQL 8.2 database. The problem is that PhpBB stored IPs as
strings, which seem to be more or less encoded.

In PhpBB, IPs are stored as Hexa:
"54dc0636"
"52e1fcb6"

How to cast these values to readable content?
Any idea ? This is an important issue for me.
Thank you for any help.

Kind regards,
Jean-Michel


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend



--
GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Spielberger Straße 49
70435 Stuttgart
0173/9409607
fx 01212-5-13695179
-
EuroPython 2008 will take place in Vilnius, Lithuania - Stay tuned!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux