Networking primer series Binary to decimal TryHackMe

Hacking Truth
0




Networking


Part of the Blue Primer series, learn the basics of networking.



Kinda like a street address, just cooler.



In a manner similar to streets and homes, computers and their respective communication networks must have a way to address their 'mail'. In the following set of questions, we'll investigate the various types of IPv4 addresses. Here's a reference guide for that various types of IP addresses: Networking primer series Binary to decimal TryHackMe



IP Address Classes






Private Address Space







#1 How many categories of IPv4 addresses are there?

Ans :- 5



#2 Which type is for research? *Looking for a letter rather than a number here

Ans :- E



#3 How many private address ranges are there?


Ans :- 3



#4 Which private range is typically used by businesses?

Ans :-  A




#5 There are two common default private ranges for home routers, what is the first one?

Ans :-



#6 How about the second common private home range?

Ans :- 192.168.0.0



#7 How many addresses make up a typical class C range? Specifically a /24



1111 1111 . 1111 1111 . 1111 1111 . 0000 0000
There’re twenty-four “1”.
There’re eight “0”. → 2⁸ = 256



Ans :- 256





#8 Of these addresses two are reserved, what is the first addresses typically reserved as?

Ans :-



#9 The very last address in a range is typically reserved as what address type?

Ans :-



#10 A third predominant address type is typically reserved for the router, what is the name of this address type?

Ans :-


#11 Which address is reserved for testing on individual computers?

Ans :- 127.0.01



#12 A particularly unique address is reserved for unroutable packets, what is that address? This can also refer to all IPv4 addresses on the local machine.

Ans :- 0.0.0.0






Binary to Decimal



Binary conversion is essential to understand in order to properly manage computer networks. An IPv4 address consists of 32 bits split up into four sections of eight bits. For example, the address 192.168.1.12 translates to this:

11000000 10101000 00000001 00001100

When considering individual bit values, we can break down each octet further. For example, let's break down the second octet valuing 168:







This table provided above is useful to recreate when solving for decimal values. A blank variant has been provided below for copying:






Convert the following binary values into decimal. I suggest doing this by hand with a sheet of paper as it's essential to practice and retain properly. These have been split into two sections of four for readability, however, treat them as octets when solving for decimal values.




#1 1001 0010


Calculation method
For an example:
1001 0010 (in binary) = 1*2⁷ + 0*2⁶ + 0*2⁵ + 1*2⁴ + 0*2³ + 0*2² + 1*2¹ + 0*2⁰ = 146 (in decimal)


Ans :-





#2 0111 0111

Ans :-



#3 1111 1111

Ans :-



#4 1100 0101

Ans :-



#5 1111 0110



Ans :-



#6 0001 0011

Ans :-



#7 1000 0001

Ans :-



#8 0011 0001

Ans :-




#9 0111 1000


Ans :-





#10 1111 0000

Ans :-



#11 0011 1011

Ans :-




#12 0000 0111


Ans :-


CalCulation Method :


When you work at routing, you will find yourself converting decimal to binary and the opposite, specially for the masks of the IP address, here I will show you how to do it easily using your command line terminal.

Need to convert a base 10 integer in a base 2 one? Or, at any rate, convert a number from one numeration system to another? In Ubuntu, the bc utility already integrates these features. It is usually already installed, so you don’t have to anything special.



First you need to install 'bc'

sudo apt-get install bc








now, we will convert a Binary to Decimal :


echo "$((2#10010010))"

echo "$((2#00000111))"






------- ------- ------- ------- ------- ------- -------



Decimal to Hexadecimal

echo 'obase=16;10'| bc

A

Or

wcalc -h 10


-------


Decimal to Octal

echo 'obase=8;10' | bc

12

Or

wcalc -o 10


-------


Decimal to Binary

echo 'obase=2;10' | bc

1010

Or

wcalc -b 10


------- 


From Hexadecimal to decimal

echo 'ibase=16;A' | bc

10


------- 


From Octal to Decimal

echo 'ibase=8;12 | bc

10


-------  


From Binary to Decimal

echo 'ibase=2;1010 | bc</>

10




Note: Be sure to have bc or wcalc installed on your system


------- ------- ------- ------- ------- ------- ------- -------



Below diagram explains how to convert ( 1010 ) to equivalent decimal value:







Decimal to Binary



Using the table provided within the previous task convert the following values to binary. For the sake of preserving the full octet, pad the front of each answer with the appropriate amount of zeros.









#1 238

Ans :-



#2 34

Ans :-




#3 123

Ans :-




#4 50

Ans :-




#5 255

Ans :-




#6 200

Ans :-




#7 10


Ans :-




#8 138

Ans :-



#9 1

Ans :-





#10    

13



#11 250


Ans :-



#12 114


Ans :-




Copy Methods : 


For an example:
238 (in decimal)
Start with
238 / 2 = 119 *2 + 0


 










Repeat dividing step until you can’t







Fraction in the circle is the answer







Answer







Command Method :


Decimal to Binary

echo 'obase=2;10' | bc

echo 'obase=2;138' | bc








Programming Language Method (in python) :



# Python program to convert decimal to binary
   
# Function to convert Decimal number
# to Binary number
def decimalToBinary(n):
    return bin(n).replace("0b", "")
   
# Driver code
if __name__ == '__main__':
    print(decimalToBinary(8))
    print(decimalToBinary(18))
    print(decimalToBinary(7))









Address Class Identification



Using the table provided in the first task, identify which class each of the following addresses belongs to. ( Task 1*)



#1 10.240.1.1

Ans :- A




#2 150.10.15.0


Ans :- B




#3 192.14.2.0


Ans :- C



#4 148.17.9.1

Ans :- B


#5 193.42.1.1

Ans :- C


#6 126.8.156.0

Ans :-



#7 220.200.23.1

Ans :-



#8 230.230.45.58

Ans :-


#9 177.100.18.4

Ans :-



#10 119.18.45.0

Ans :-



#11 117.89.56.45

Ans :-



#12 215.45.45.0

Ans :-





Video Tutorial :- Updated....

    

Disclaimer


This was written for educational purpose and pentest only.
The author will not be responsible for any damage ..!
The author of this tool is not responsible for any misuse of the information.
You will not misuse the information to gain unauthorized access.
This information shall only be used to expand knowledge and not for causing  malicious or damaging attacks. Performing any hacks without written permission is illegal ..!


All video’s and tutorials are for informational and educational purposes only. We believe that ethical hacking, information security and cyber security should be familiar subjects to anyone using digital information and computers. We believe that it is impossible to defend yourself from hackers without knowing how hacking is done. The tutorials and videos provided on www.hackingtruth.in is only for those who are interested to learn about Ethical Hacking, Security, Penetration Testing and malware analysis. Hacking tutorials is against misuse of the information and we strongly suggest against it. Please regard the word hacking as ethical hacking or penetration testing every time this word is used.


All tutorials and videos have been made using our own routers, servers, websites and other resources, they do not contain any illegal activity. We do not promote, encourage, support or excite any illegal activity or hacking without written permission in general. We want to raise security awareness and inform our readers on how to prevent themselves from being a victim of hackers. If you plan to use the information for illegal purposes, please leave this website now. We cannot be held responsible for any misuse of the given information.



- Hacking Truth by Kumar Atul Jaiswal



I hope you liked this post, then you should not forget to share this post at all.
Thank you so much :-)






Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.
Post a Comment (0)
Our website uses cookies to enhance your experience. Learn More
Accept !