Scanning is an essential activity in a hacking session that involves actively seeking vulnerabilities or weaknesses in a system or network. It is carried out to identify open ports, services, and applications that can be manipulated to gain unauthorized access. Proper scanning can help a hacker to map out the target network or system, discover the necessary information needed for a successful attack, and identify potential entry points for further exploitation.

Services

nmap -sVC example.htb

The nmap command is a powerful network scanning tool used to discover hosts and services on a computer network. When executed with the -sVC option, it performs a comprehensive scan on the target host "example.htb".

The -sV argument instructs nmap to perform service version detection. This means that it will attempt to determine the specific versions of services running on open ports. Knowing the service versions can be helpful for vulnerability assessment and determining potential security risks.

The -sC argument enables the script scanning feature in nmap. It tells nmap to run a set of default scripts that provide additional information about the target system. These scripts can identify various aspects of the target, such as common vulnerabilities, service enumeration, and remote operating system detection.

The ports scanned in this way are limited to the 1000 most commonly used ports.

PortServiceDescription
21FTPFile Transfer Protocol - facilitates file transfers between clients and servers.
22SSHSecure Shell - provides secure remote access and command execution.
25SMTPSimple Mail Transfer Protocol - used for sending email messages between servers.
80HTTPHypertext Transfer Protocol - used for web browsing and communication.
110POP3Post Office Protocol version 3 - retrieves email from a remote server.
143IMAPInternet Message Access Protocol - retrieves email messages from a remote server.
443HTTPSHTTP Secure - provides secure communication using SSL/TLS for web browsing.
3389RDPRemote Desktop Protocol - enables remote desktop connections to a server or computer.
5432PostgreSQLPostgreSQL Database Server - a popular open-source relational database system.
3306MySQLMySQL Database Server - a widely used open-source relational database system.
8080HTTP ProxyHTTP Proxy - used to route HTTP traffic through a proxy server.
8443HTTPS AltAlternate HTTPS Port - often used for secure web communication on non-standard ports.
27017MongoDBMongoDB Database Server - a NoSQL database system.
6379RedisRedis Key-Value Store - an in-memory data structure store often used as a cache or message broker.

Finding all ports

nmap -p- example.htb

The nmap command, when used with the -p- option, performs a port scan on a target host. The -p- option tells nmap to scan all 65,535 ports on the target host.

Finding UDP ports

sudo nmap -sU -p- example.htb

The nmap command, when used with the -sU and -p- options, performs a UDP port scan on a target host.

Warning: This will take a very long time, you can always press ENTER to see the current status.

UDP (User Datagram Protocol) is a connectionless protocol used for various network services. Unlike TCP (Transmission Control Protocol), UDP does not establish a reliable and ordered connection between hosts. UDP port scanning involves sending UDP packets to various ports on a target host and analyzing the responses received, if any.

PortServiceDescription
53DNSDomain Name System - translates domain names to IP addresses and vice versa.
67DHCP ServerDynamic Host Configuration Protocol (Server) - assigns IP addresses to network devices.
69TFTPTrivial File Transfer Protocol - used for simple file transfers between clients and servers.
123NTPNetwork Time Protocol - synchronizes system clocks on a network.
161SNMPSimple Network Management Protocol - monitors and manages network devices.
162SNMP TrapSNMP Trap - sends notifications or alerts from SNMP agents to a management system.
137NetBIOSNetBIOS Name Service - provides name resolution services for NetBIOS over IP.
138NetBIOSNetBIOS Datagram Service - supports connectionless communication between NetBIOS devices.
161SNMPSimple Network Management Protocol - monitors and manages network devices.
500IKEInternet Key Exchange - establishes secure VPN tunnels.
514SyslogSyslog - collects and forwards system log messages.
1900UPnPUniversal Plug and Play - enables discovery and control of network devices.