Host


 

When you have a host name or a domain name you need to know its IP address, for that you have a very handy tool built into most Linux systems, the host command.

 

In the terminal you type: host [domain name] or host [host name]

 

 

And you get:

 

We get the IP

 

To use all the features of host, just type man host

 


RTFM!

"RTFM" is an abbreviation which means "Read The Fucking Manual", but yes, it's friendly! It's a joke that all Linuxians know, under Linux, reading the documentation must become a reflex. Indeed, while it sounds a bit scary at first, the documentation is really the best place to learn more about the commands you are using. To know certain parameters that you need less often, you will not cut them: you will need to read the doc.


Here is a part of the manual for the host command, let's try with -a, to quit the manual you have to type the q key

 

We obtain

 

Host names, other IP addresses, DNS servers

 

How to navigate this jungle, there are a few basics to know:

 

Differences between host name, domain name and Fully Qualified Domain Name

 

The host name is a freely selectable name for a computer. For example, you can name a server in a corporate network that is responsible for central administration of "mail" emails.

 

However, if a computer is to be available not only locally but also via the Internet, the host name must be supplemented with additional information which forms a name string. These are called a "Fully Qualified Domain Name" or "Fully Qualified Domain Name". An example for an FQDN would be:

 

  • mail.jouwweb.nl (see screenshot just above)

 

An FQDN is a form of human readable address. Unlike us, computers use numeric IP addresses to uniquely identify computers on the Internet. When you go to a web page, an intermediate step is therefore necessary in which the alphanumeric domain is translated into a numeric IP address.

 

The Domain Name System (DNS) is responsible for this name resolution. The domain entered is assigned to the corresponding IP address in order to find the page you are looking for. This system allows human users to use a name that is easier to remember, rather than having to enter the IP address every time they go to a website.

 

Definition and role of DNS

 

First of all: DNS stands for “Domain Name System” or domain name system. First, I'll explain how it works, then we'll get to the concept of a domain name (or subdomain).

 

The DNS server is a computer directory. When you want to access a computer on the network, your computer will query the DNS server to retrieve the address of the computer you want to join. Once your computer has retrieved the recipient's address, it can reach them directly with their IP address.

 

The DNS server will make it possible to make the relationship between computer name and IP address

     

     

    In the search on padawanhacker.com

     

    host found 3 DNS servers,
     
    When you register a domain name, DNS servers will host the settings of your DNS zone.
     
    Usually, 2 or 3 DNS server names are used:
     
    The primary server, but also one or two secondary servers that can take over if the primary DNS server is unavailable.
     
    So for example, for padawanhacker.com, the domain names whose DNS registration zones are managed by openprovider, the host names of DNS servers are:
     
    • ns3.openprovider.eu
    • ns2.openprovider.be
    • ns1.openprovider.nl
     
    It is very important that your computer can immediately translate the domain name when you issue a request.
     
    Your browser can only read IP addresses.

     

     


    Hacking éthique python

     

    If you don't have Linux, you're probably thinking that it won't be possible to get started on Windows, think again, most of the tools are programmable by yourself without too much trouble.

     

    Here is how to create HOST either even in python and run it from any computer and even from a Raspberry Pi

     

    Here we go !

     

    Start by opening SUBLIME TEXT (see the chapter Why learn to code), of course to code in python like a pro you have to go to an IDE, like pyCharme, KDevelp, Thonny etc ... To start, let's launch SUBLIME TEXT: let's already create a .py file

     

     

    In File then Save as ...

     

    We will call it findip.py

     

    Here is the program

     

     

       

      What is preceded by # does not execute in python but is just used to explain the code.

       

      Now let's try to run it directly from our terminal on Linux or Mac.

       

      After having saved it well, it is necessary to be able to find it for me it is in HOME (~) then Nico then Documents and finally in Dark python i.e. in      ~ / Documents / Dark python

       

       

      To execute it we type:

       

       

      It asks you to enter the domain name here padawanhacker.com and it responds with the IP address

       

       

      It also works with host names, try with the name of your machine you will see in the terminal in what I have hidden in light green after the @ this is your host name, check you will see, it will give you your ip, you can check by doing ifconfig in your terminal.

       

      To know it you can also type hostname in the terminal, it will give it to you.

       

       

      Go ahead and let go you are authorized, anyway everything you will see on padawanhacker.com is authorized (too cool ...), in any case we always make sure that it is.

       

      In reality it only has 6 lines but it could be even shorter, modify as desired, there is an infinite number of ways to code the same program and especially to improve it in my example it only runs once but you can also ask him to ask for the domain name again after each answer.

       


      SECU INFO:

      So you see that if someone knows the hostname of your machine, they have your IP with amazing ease. This should make you aware of the importance of choosing the correct hostname for your machine when installing. It is quite easy to change it in Linux, Mac and Windows, you will easily find tutorials on the internet.