Network Addressing Tools Flashcards

1
Q

What is the official short description of the socket library ?

A

low-level networking interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The socket library is built on what? used in what systems?

What extra does it provide?

A

the famous C socket library
used in UNIX systems

higher-level interface and provides more convenient tools

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The contents of the socket library can be categorized into the following five groups:

A

Socket Objects
Socket Families
Socket Exceptions

Networking constants
Networking Tools

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the socket object category define

A

the socket class alongside various methods that are available for socket objects.

The methods are generic and can be applied to client and server sockets

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does socket families category define?

A

defines various ways to represent socket addresses on different platforms using various protocols.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does networking tools category define

A

a rich list of functions to perform various networking operations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what operations can be found in Networking Tools

A

Address resolution
Network data representation
Getting values of network configuration parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Define a hostname

A

a label (string) given to a specific device so it can be identified within a network.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Define a domain name

A

if a device is to be identified on the internet then it has to register the name to ensure that it is unique

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

machine1.secuirty-lab

A

machine1 is the hostname
security-lab is domain name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a fully qualified domain name?

A

Domain name that is completely specified, including all levels

mail.psut.edu

mail is hostname
psut is domain name
edu is higher-level internet domain

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Every domain name is associated with an IP address
The address resolution happens
through the what protocol?

A

DNS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Can a specific host have multiple hostnames or domain names mapped to the same IP address

A

Yes
like a web server having an old and a new domain name.

one is considered the hostname and the others are aliases

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How to get the local hostname

A

socket.gethostname()

returns a string representing the hostname (not fully qualified domain name)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How to get hostname on windows cmd

A

hostname

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How to resolve a hostname into an IP address

A

socket.gethostbyname(hostname)

it returns a four-dot string representing the IPv4 address of the given hostname

if hostname is ‘localhost’ it returns 127.0.0.1 (the loopback IP) special IP address that always points to your own machine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Does gethostbyname method work for IPv4 and IPv6?

A

nope only ipv4

18
Q

In Windows cmd, you can resolve a hostname into an IPv4 address using:

A

ping -4 <hostname></hostname>

nslookup <hostname></hostname>

19
Q

It is common to have multiple IPs mapped with a hostname

how to get all of them?

A

socket.gethostbyname_ex(hostname)

returns a tuple (p_hostname, aliaslist, iplist)

20
Q

does gethostbyname_ex support both ipv4 and ipv6

A

nope only ipv4

21
Q

what command to run on cmd to get all the IPs ??

22
Q

If I have the IP, how can I resolve it to its hostname

A

socket.gethostbyaddr(ip_addr)

returns a tuple (p_hostname, aliaslist, iplist)

23
Q

The output is the same for gethostbyaddr() and gethostbyname_ex()

how can they differ

A

gethostbyaddr() supports both ipv4 and ipv6

gethostbyname() only supports ipv4

24
Q

You can perform reverse DNS through Windows cmd using

A

nslookup ip

25
How can we get a fully qualified domain name
socket.getfqdn([name]) [name] is optional, if unsepcified it returns localhost fqdn if name is specified, the funtion internally invokes the function gethostbyaddr()
26
Note on a Windows cmd, you can get the fqdn using the command:
whoami fgdn need be domain user
27
How to check if the local machine supports IPv6
socket.has_ipv6 an attribute not a method
28
Get-NetAdapterBinding -ComponentID ms_tcpip62 what does this do?
to check if IPv6 is supported in your machine through Windows PowerShell
29
What are services
Network applications running on a machine each network service is attached to a specific port
30
which port number is attached to 'http'
80
31
which port number is attached to 'smtp'
25
32
To resolve a service name to its corresponding port, we can use the following function:
socket.getservbyname(service_name, [protocol_name]) service name like 'http' 'snmp' 'smtp' protocol is optional, tcp or udp function returns an integer the port number
33
If the service name resolution fails, what exception do we get?
OSError
34
snmp port number
161
35
ftp port number
21
36
To convert a port number to the corresponding service, the following function can be used:
socket.getservbyport(port, [protocol_name])
37
In Windows machines, you can check the status of running network services along with their corresponding ports using
netstat command
38
How to change the hostname?
socket.sethostname(hostname) only in UNIX machines but not on windows, MacOS or Android It requires the user/program to have the right privileges to be executed successfully. If it fails, it raises an OSError.
39
How to get the protocol number from the protocol name
socket.getprotobyname(protoname) Layer 3 and 4 protocols are referred to by the OS using unique integers (defined as constants) in underlying libs
40
protocol numbers for tcp udp icmp ip
6 17 7 0 needed for creating raw sockets