Image
 
linkedin_logo.png rss_logo.jpg
twitter_logo.png youtube_logo.jpg
Latest Additions
 
EH-Net Login
Welcome Guest.






Lost Password?
No account yet? Register
Who's Online
We have 32 guests online
 
Free Business and Tech Magazines and eBooks

You are here: Home arrow Ethical Hacking Discussions and Related Certificationsarrow Otherarrow converting IP adresses
EH-Net
May 23, 2013, 06:39:22 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Go back to The Ethical Hacker Network Online Magazine Home Page
 
   Home   Help Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: converting IP adresses  (Read 6935 times)
0 Members and 1 Guest are viewing this topic.
Dutchie
Newbie
*
Offline Offline

Posts: 33


View Profile
« on: June 18, 2010, 04:30:12 AM »


Next week I will sit for my CEH examen. I'm still struggling with converting IP adresses from decimal to normal expression of the IP-adress, for instance

the decimal IP = 340590649

converted to normal expression should give: 203.2.4.5

How is this been calculated with a normal calculator?
What's the scientific method for converting?

Thanks for feedback,
Logged

RA, CISA, CISSP, C|EH, C|HFI, CWSP, LPIC-1
UNIX
Hero Member
*****
Offline Offline

Posts: 1235


View Profile
« Reply #1 on: June 18, 2010, 04:55:48 AM »

Did you already search for tutorials/ explanations? You'll find quite a few explanations when googling for it. Is there a specific part or step where you have difficulties in understanding?
Logged
Data_Raid
Full Member
***
Offline Offline

Posts: 165



View Profile
« Reply #2 on: June 18, 2010, 06:51:19 AM »


Next week I will sit for my CEH examen. I'm still struggling with converting IP adresses from decimal to normal expression of the IP-adress, for instance

the decimal IP = 340590649

converted to normal expression should give: 203.2.4.5

How is this been calculated with a normal calculator?
What's the scientific method for converting?

Thanks for feedback,

The address 340590649 340590949 is expressed in decimal (dotless long format), if you then convert that address to hex you should get: CB020405
Since the IP address consists of 4 octets each part of the address is represented as:

CB (203) 02 (2) 04 (4) 5 (5)

If you want to convert to the long decimal URL:
linux.org= 198.182.196.56
Convert to HEX: 198 (C6) 182 (B6)  196 (C4) 56 (38)
http://0xC6B6C438
Convert HEX to Decimal: C6B6C438 = 3333866552 (decimal, dotless address)
http://3333866552

*Note: this only works with some browsers like IE, and this won't work with Firefox. Your results may vary though.

HTH


*edit: modified dotless address
« Last Edit: June 18, 2010, 02:23:31 PM by Data_Raid » Logged

All men by nature desire knowledge.

Aristotle
Dutchie
Newbie
*
Offline Offline

Posts: 33


View Profile
« Reply #3 on: June 18, 2010, 08:34:53 AM »


Thanks Data_Raid for your constructive reply.

But as this is a valid question from the exam, they're expecting that we know all the Hex-notations by head? Can't be true!

Isn't there another method?
Logged

RA, CISA, CISSP, C|EH, C|HFI, CWSP, LPIC-1
jimbob
Guest
« Reply #4 on: June 18, 2010, 09:32:35 AM »

But as this is a valid question from the exam, they're expecting that we know all the Hex-notations by head? Can't be true!

Isn't there another method?
This is still by far the easiest way to do it. If you have a good scientific calculator it should support hexadecimal, which makes converting to hex and back again easy.

Knowing how to do hex arithmetic is a useful skill. If you're only covering 8-bit numbers you only need work with numbers in the rannge of 0x00-0xFF or 0-255 in decimal. Don't beat yourself up over it though, it does not come naturally to most and taking a minute doing a simple sum in your head can be time well spent.

Jim
Logged
ziggy_567
Sr. Member
****
Offline Offline

Posts: 361


View Profile
« Reply #5 on: June 18, 2010, 09:37:50 AM »

Converting hex to decimal is fairly simple multiplication. In the previous example CB represents 203. Here's how you get that:

Dec     Hex
0          0
1          1
2         2
3         3
4         4
5         5
...
A        10
B        11
C       12
D       13
E       14
F       15

Hex is base 16, which means that each digit is a multiple of 16 rather than 10 (decimal). In other words, 203 is equal to (2*10*10) + (0*10) + (3*1). In Hex you say (C*16) + (B*1). C represents 12 so C*16 is 12*16 which equals 192. B represents 11, so 192+11=203.

HTH
Logged

--
Ziggy


eCPPT - GSEC - GCIH - GCUX - RHCE - SCSecA - Security+ - Network+
Dutchie
Newbie
*
Offline Offline

Posts: 33


View Profile
« Reply #6 on: June 18, 2010, 09:39:49 AM »

With the help of Data_Raid and the advice from Awesec to google, it seems that I got the method to convert. But my outcome is not what I expect. I do not seem to discover where I got wrong. It's for sure in the stage of converting  decimal to hex!

So I will detail my outcome, maybe someone can review it and point me to my mistake:

decimal 340590649

340590649/16      21.286.915  rest  9 this is in hex    9
21286915/16        1.330.432   rest   3             hex    3
1330432/16          83.152        rest   0             hex   0
83152/16              5.197         rest   0            hex    0
5197/16                324           rest    13          hex    D
324/16                  20             rest   4            hex    4
20/16                    1              rest    4            hex    4
1/16                      0              rest    1            hex    1


so in hex this gives:   144D0039


but the correct answer is:  CB020405


Pls can someone review this and give me feedback!
« Last Edit: June 18, 2010, 09:46:19 AM by Dutchie » Logged

RA, CISA, CISSP, C|EH, C|HFI, CWSP, LPIC-1
Ignatius
Jr. Member
**
Offline Offline

Posts: 91


View Profile
« Reply #7 on: June 18, 2010, 12:49:26 PM »

I thought I was going crazy when I started to work through this myself.  I *thought* I knew how to do it ... but the maths just didn't work out.

The problem is that the decimal IP quoted (340590649) converts to
0x144D0039.  However, 3405906949 converts to 0xCB020405.

I confirmed this by using calc.exe in Scientific mode, rather than manually.
« Last Edit: June 18, 2010, 12:51:47 PM by Ignatius » Logged
Dutchie
Newbie
*
Offline Offline

Posts: 33


View Profile
« Reply #8 on: June 18, 2010, 12:56:03 PM »


Chapeau Ignatius,

Now I can be sure that my calculations were right.

The fault is within the question and it came from an official and recommended instance!!

Great you solve the "bug" completely!!

Thanks!!

Now doubt any more over here concerning converting IP adresses!!
Logged

RA, CISA, CISSP, C|EH, C|HFI, CWSP, LPIC-1
Data_Raid
Full Member
***
Offline Offline

Posts: 165



View Profile
« Reply #9 on: June 18, 2010, 02:21:19 PM »

I just checked my calculations again:
144D0039 is 340590649
and CB020405 is 3405906949 which is the correct address.
I can't recall my steps but 3405906649 never worked out in binary and I was scratching my head,  and I tried another method, I possibly worked back from the IP address to binary and then to HEX hence my original HEX value was correct  Smiley with a simple conversion 3405906949 works out fine in binary:
11001011 00000010 00000100 00000101

« Last Edit: June 18, 2010, 02:25:36 PM by Data_Raid » Logged

All men by nature desire knowledge.

Aristotle
ziggy_567
Sr. Member
****
Offline Offline

Posts: 361


View Profile
« Reply #10 on: June 18, 2010, 03:20:37 PM »

Here's another tip.

The C|EH is multiple choice, so you don't necessarily have to be able to go both ways to pass the test. (I understand that this doesn't help you learn for the sake of learning) But, the easiest (for me at least) solution is to work from the IP address to hex to binary to decimal. So no matter which way they ask the question, since I have all the possible answers, I can get to the correct answer fairly quickly by a process of elimination if they ask me to go from decimal to IP.

HTH
Logged

--
Ziggy


eCPPT - GSEC - GCIH - GCUX - RHCE - SCSecA - Security+ - Network+
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Page created in 0.103 seconds with 22 queries.
 
Exclusive Deal

sansfire13_245x90_cw90.jpg
SANSFIRE 2013
June 15 - 22

5% Off w/ Code: EHN_5

SANS Deals 4 EH-Netters
5% OFF Any SANS Course in Any Format!
Coupon Code: EHN_5 Including SANS Rocky Mountain 2013 & SANS Boston 2013
Polls
Compared to this year, 2013 will be:
 
Recent Forum Topics
EH-Net News Feeds
Latest Additions
 
         
Free Business and Tech Magazines and eBooks

© 2013 The Ethical Hacker Network
Joomla! is Free Software released under the GNU/GPL License.