Friday, September 27, 2019

Positional Notation for IP Adresses

positional notation means that a digit represents different values depending on the position it occupies.

More specifically the value that a digit represents is the value of the digit multiplied by the power of the base or radix, represented by the position the digit occupies.

In the binary numbering system, the radix is 2. therefore each position represents increasing powers of two. In 8-bit binary numbers, the positions represent the quantities shown:

2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
128 64  32   16    8     4     2    1

the base 2 numbering system has only two digits: 0 and 1. when a byte is interpreted as a decimal number the quantity that position represents is added to the total if the digit is a 1 and 0 is added if the digit is a 0.

a 1 in each position mean that the value for that position is added to the total.

128 64 32 16 8 4 2 1 1 1 1 1 1 1 1 1 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255

the value of each position is added to determine the total value of the number.

A 0 in each position indicates that the value for that position is not added to the total.

128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 0
0+0+0+0+0+0+0+0 = 0

for the conversion of a 32 bit ip address, you identify the 4 bytes or octets that make up this address. You then convert each of these four octets to decimal.

The conversion starts with the low-order bits and continues to the high-order bits.

10101100.00010000.00000100.00010100

128 64 32 16 8 4 2 1
0 0 0 1 0 1 0 0 = Binary of first octet
0+0+0+16+0+4+0+0 = 20 decimal

128 64 32 16 8 4 2 1
0 0 0 0 0 1 0 0 = Binary of second octet
0+0+0+0+0+4+0+0 = 4 decimal


128 64 32 16 8 4 2 1
0 0 0 1 0 0 0 0 = Binary of third octet
0+0+0+16+0+0+0+0 = 16 decimal

128 64 32 16 8 4 2 1
1 0 1 0 1 1 0 0 = Binary of forth octet
128+0+32+0+8+4+0+0 =  172 decimal

in the example the binary number 10101100.00010000.00000100.00010100 is converted to 172.16.4.20

No comments:

Post a Comment

Exploiting Weak WEBDAV Configurations

The server we are going to audit has the following fingerprint. 80/tcp open http Apache httpd 2.2.8 ((Ubuntu) DAV/2) Next we need t...