Re: interger to I P address

2008-08-28 Thread Beat Vontobel
Anything concerning an end network is not relevant to this list. lol I am however, very interested in the content/replies thus far. Very entertaining. Yes, while certainly off topic, also for me it's probably been one of the most entertaining threads of this kind. So just one more

Re: interger to I P address

2008-08-27 Thread Simon Lockhart
On Wed Aug 27, 2008 at 07:11:41AM -0400, kcc wrote: ls it possible t convert the interger to ip Yes. Simon

Re: interger to I P address

2008-08-27 Thread kcc
I search google but couldn't get any solution Can you send me information? Thank you On Wed, Aug 27, 2008 at 7:13 AM, Simon Lockhart [EMAIL PROTECTED] wrote: On Wed Aug 27, 2008 at 07:11:41AM -0400, kcc wrote: ls it possible t convert the interger to ip Yes. Simon

Re: interger to I P address

2008-08-27 Thread Jeroen Massar
Simon Lockhart wrote: On Wed Aug 27, 2008 at 07:11:41AM -0400, kcc wrote: ls it possible t convert the interger to ip Yes. If you are using 128-bit integers, which according to some will also change some day, thus one should be using struct addrinfo and: getaddrinfo() getnameinfo() as

Re: interger to I P address

2008-08-27 Thread Colin Alston
kcc wrote: I search google but couldn't get any solution Can you send me information? Sure! http://www.catb.org/~esr/faqs/smart-questions.html

RE: interger to I P address

2008-08-27 Thread Matlock, Kenneth L
94 Hex = 147 So your IP is 64.233.169.147 Ken From: Colin Alston [mailto:[EMAIL PROTECTED] Sent: Wed 8/27/2008 5:21 AM To: kcc Cc: nanog@nanog.org Subject: Re: interger to I P address kcc wrote: I search google but couldn't get any solution Can you

Re: interger to I P address

2008-08-27 Thread Stephane Bortzmeyer
On Wed, Aug 27, 2008 at 02:27:24PM +0200, Iljitsch van Beijnum [EMAIL PROTECTED] wrote a message of 14 lines which said: Easiest way. $ ping 1089055123 PING 1089055123 (64.233.169.147): 56 data bytes It relies on an undocumented feature (it is not in RFC 791, nor in getaddrinfo() manual)

RE: interger to I P address

2008-08-27 Thread Robert D. Scott
To: Iljitsch van Beijnum Cc: nanog@nanog.org Subject: RE: interger to I P address Huh, learn something new every day! Well, at least my method shows the underlying theory behind how the conversion works :) Thanks! Ken Matlock Network Analyst (303) 467-4671 [EMAIL PROTECTED] -Original Message- From

Re: interger to I P address

2008-08-27 Thread Colin Alston
Robert D. Scott wrote: The harder way: Decimal: 1089055123 Hex (dashes inserted at octals): 40-E9-A9-93 Decimal (of each octet): 64-233-169-147 IP Address: 64.233.169.147 The Python way import socket, struct socket.inet_ntoa(struct.pack('l', 1089055123)) '64.233.169.147'

Re: interger to I P address

2008-08-27 Thread Michael Holstein
ls it possible t convert the interger to ip #!/usr/local/bin/perl # Perl script to convert between numeric and dotted quad IPs. # give credit to Paul Gregg for this one while (STDIN) { chomp; $input = $_; if (/\./) { ($a, $b, $c, $d) = split(/\./); $decimal = $d + ($c * 256) + ($b

Re: interger to I P address

2008-08-27 Thread Peter Dambier
is 64.233.169.147 Ken From: Colin Alston [mailto:[EMAIL PROTECTED] Sent: Wed 8/27/2008 5:21 AM To: kcc Cc: nanog@nanog.org Subject: Re: interger to I P address kcc wrote: I search google but couldn't get any solution Can you send me information

RE: interger to I P address

2008-08-27 Thread Eric Van Tol
-Original Message- From: kcc [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2008 7:12 AM To: nanog@nanog.org Subject: interger to I P address Hi all ls it possible t convert the interger to ip Thank you My two cents: # ping 1089055123 PING 1089055123 (64.233.169.147)

Re: interger to I P address

2008-08-27 Thread Shadow
Robert D. Scott wrote: The harder way: Decimal: 1089055123 Hex (dashes inserted at octals): 40-E9-A9-93 Decimal (of each octet): 64-233-169-147 IP Address: 64.233.169.147 The this could take all day way : (in bc with scale=0 for integer portions only) 1089055123/(2^24)%(2^8) 64

Re: interger to I P address

2008-08-27 Thread Dave Israel
Normally, I don't participate in this sort of thing, but I'm a sucker for a there's more than one way to do it challenge. Shadow wrote: Robert D. Scott wrote: The harder way: Decimal: 1089055123 Hex (dashes inserted at octals): 40-E9-A9-93 Decimal (of each octet): 64-233-169-147 IP

Re: interger to I P address

2008-08-27 Thread Brian Epstein
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 08/27/2008 11:50 AM, Andree Toonk wrote: | #or in one line, like ipcalc does: | sub ntoa_in_one_line { join(., unpack(, pack(N, $_[0]))); } For completeness: sub aton_in_one_line { unpack('N',pack('C4',split(/\./,$_[0]))); } Thanks, ep -

Re: interger to I P address

2008-08-27 Thread Michael Holstein
In MySQL : mysql SELECT INET_NTOA(ip_in_decimal) AS ipa; .. or the reverse : mysql SELECT INET_ATON('dotted.quad') AS ipn;

RE: interger to I P address

2008-08-27 Thread Boyd, Benjamin R
The harder way: Decimal: 1089055123 Hex (dashes inserted at octals): 40-E9-A9-93 Decimal (of each octet): 64-233-169-147 IP Address: 64.233.169.147 The Python way import socket, struct socket.inet_ntoa(struct.pack('l', 1089055123)) '64.233.169.147' The Perl way: sub ntoa { my

Re: interger to I P address

2008-08-27 Thread Colin Alston
On 2008/08/27 05:22 PM Dave Israel wrote: Normally, I don't participate in this sort of thing, but I'm a sucker for a there's more than one way to do it challenge. Aww come on, C gets way more fun than that ;) #define _u8 unsigned char #define _u32 unsigned long int main(void) { _u32

Re: interger to I P address

2008-08-27 Thread Robert Kisteleki
Colin Alston wrote: On 2008/08/27 05:22 PM Dave Israel wrote: Normally, I don't participate in this sort of thing, but I'm a sucker for a there's more than one way to do it challenge. Aww come on, C gets way more fun than that ;) #define _u8 unsigned char #define _u32 unsigned long int

Re: interger to I P address

2008-08-27 Thread Scott Doty
On Wed, Aug 27, 2008 at 10:25:10AM -0400, Shadow wrote: Robert D. Scott wrote: The harder way: Decimal: 1089055123 Hex (dashes inserted at octals): 40-E9-A9-93 Decimal (of each octet): 64-233-169-147 IP Address: 64.233.169.147 The this could take all day way : (in bc with

Re: interger to I P address

2008-08-27 Thread Joe Greco
Sorry to be continuing this thread, but I find a certain kind of elegance in bash which isn't actually there, but helps me sleep at night. bash# iptoint(){ oct1=`echo $1|awk -F\. '{print $1}'`; oct2=`echo $1|awk -F\. '{print $2}'`; oct3=`echo $1|awk -F\. '{print $3}'`; oct4=`echo $1|awk

RE: interger to I P address

2008-08-27 Thread Darden, Patrick S.
: Re: interger to I P address bash# iptoint(){ oct1=`echo $1|awk -F\. '{print $1}'`; oct2=`echo $1|awk -F\. '{print $2}'`; oct3=`echo $1|awk -F\. '{print $3}'`; oct4=`echo $1|awk -F\. '{print $4}'`; echo $[($oct124)+($oct216 )+($oct38)+$oct4 ];} bash# inttoip(){ echo $[$124].$[($116)255].$[($18

Re: interger to I P address

2008-08-27 Thread Colin Alston
On 2008/08/27 07:07 PM Robert Kisteleki wrote: (unsigned char)(((char*)i)[3]), Ahh yes, I was trying to remember that pattern. I saw it in an embedded device long ago :P

Re: interger to I P address

2008-08-27 Thread Henry Yen
On Wed, Aug 27, 2008 at 13:00:41PM -0400, [EMAIL PROTECTED] wrote: Sorry to be continuing this thread, but I find a certain kind of elegance in bash which isn't actually there, but helps me sleep at night. the (well, one of many, probably) REXX way: PARSE VALUE D2X(ARG(1)) WITH a 3 b 5 c 7 d

Re: interger to I P address

2008-08-27 Thread Mike Damm
The PHP way: echo long2ip('1089055123'); Boyd, Benjamin R wrote: The PHP way: function convertIntegerToIpv4($integer) { $max_value = pow(2,32); //4,294,967,296 $bug_fix = 0; settype($integer, float); if($integer 2147483647) $bug_fix = 16777216;

Re: interger to I P address

2008-08-27 Thread David Champion
Actually, who needs loops for that? ... (unsigned char)(((char*)i)[3]), (unsigned char)(((char*)i)[2]), (unsigned char)(((char*)i)[1]), (unsigned char)(((char*)i)[0]) Let data structures work for you. #include stdio.h main(int argc, char *argv[]) { union { unsigned

Re: interger to I P address

2008-08-27 Thread Owen DeLong
OK... I'll bite... The pedantic way: No. IP addresses are already integers. All conversation on this topic has been about how to convert between different methods of representing integers, but, at the end of the day, IP addresses are either 32 (IPv4) or 128 (IPv6) bit integers. There is no

Re: interger to I P address

2008-08-27 Thread Izaac
On Wed, Aug 27, 2008 at 05:50:44PM +0200, Andree Toonk wrote: The Perl way: sub ntoa_in_one_line { join(., unpack(, pack(N, $_[0]))); } print ntoa_in_one_line(1089055123) . \n; dec2ip awk '{ print int($1 / 16777216) . int($1 % 16777216 / 65536) . int($1 % 65536 / 256) . int($1 % 256) }'

Re: interger to I P address

2008-08-27 Thread Valdis . Kletnieks
On Wed, 27 Aug 2008 18:51:27 -, Johnny Eriksson said: The Tops-10/DDT way: .r ddt Gonna be hard to top that one for sheer old-skool geekitude. (No, it's OK, the monitor needed cleaning anyhow... :) pgpqbqFum3MLL.pgp Description: PGP signature

Re: interger to I P address

2008-08-27 Thread Gary E. Miller
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yo All! ls it possible t convert the interger to ip # php -r 'echo ip2long(196.3.39.209), \n;' RGDS GARY - --- Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR

Re: interger to I P address

2008-08-27 Thread Mark Newton
On 28/08/2008, at 8:38 AM, Randy Bush wrote: her at the apnic meeting, we are indulging for a bit into the deep topic of how ot textually represent 32-bit AS numbers. is it . or ? while we readily admit that a deep many year discussion of a dot is clearly a topic for the

Re: interger to I P address

2008-08-27 Thread James Hess
Perl provides some cleaner methods for interpreting/displaying IPs. There isn't a formal standard notation for an IP that looks like a string of decimal digits with no dots though. I.e. no RFC will define the host byte order and tell you that 127.0.0.1 corresponds to the decimal integer

Re: interger to I P address

2008-08-27 Thread Rob Austein
At Wed, 27 Aug 2008 18:51:27 WET DST, Johnny Eriksson wrote: The Tops-10/DDT way: Hmm, ITS TECO is a bit more verbose in this case: 1089055123u14q1377.\0j46i0jq1/400.u1d$$

RE: interger to I P address

2008-08-27 Thread Joe Blanchard
. -Joe -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2008 10:41 PM To: kcc Cc: nanog@nanog.org Subject: Re: interger to I P address On Wed, Aug 27, 2008 at 07:11:41AM -0400, kcc wrote: Hi all ls it possible t convert