tryhackme nmap soru cevapları
tryhackme.com’un interakif öğrenme olanağı sunduğu alıştırmaların nmap bölümünün soru-cevaplarını aşağıda paylaştım. Sorunların cevabını basit bir googling ile bulabileceğiniz gibi nmap manuel guide’ında da bulabilirsiniz.
Linux makinenizde “man nmap” yazarak manuele ulaşabilirsiniz.
I gave answers the questions in tryhackme.com. You can find those answers by googling or in the manuel of nmap tool. In linux, you can find a detailed guide by writing “man nmap” in CLI.
2. Introduction
What networking constructs are used to direct traffic to the right application on a server?
Cevap: Ports
How many of these are available on any network-enabled computer?
Cevap:65535
How many of these are considered “well-known”? (These are the “standard” numbers mentioned in the task)
Cevap-answer:1024
3. nmap Switches
What is the first switch listed in the help menu for a ‘Syn Scan’ (more on this later!)?
cevap-answer:-sS
Which switch would you use for a “UDP scan”?
answer:-sU
If you wanted to detect which operating system the target is running on, which switch would you use?
answer:-O
Nmap provides a switch to detect the version of the services running on the target. What is this switch?
answer:-sV
The default output provided by nmap often does not provide enough information for a pentester. How would you increase the verbosity?
answer:-v
Verbosity level one is good, but verbosity level two is better! How would you set the verbosity level to two?
-answer: vv
What switch would you use to save the nmap results in three major formats?
answer:-oA
What switch would you use to save the nmap results in a “normal” format?
answer:-oN
A very useful output format: how would you save results in a “grepable” format?
answer:-oG
Sometimes the results we’re getting just aren’t enough. If we don’t care about how loud we are, we can enable “aggressive” mode. This is a shorthand switch that activates service detection, operating system detection, a traceroute and common script scanning.
How would you activate this setting?
answer:-A
Nmap offers five levels of “timing” template. These are essentially used to increase the speed your scan runs at. Be careful though: higher speeds are noisier, and can incur errors! How would you set the timing template to level 5?
answer:-t5
How would you tell nmap to only scan port 80?
answer:-p 80
How would you tell nmap to scan ports 1000–1500?
answer:-p 1000–1500
How would you tell nmap to scan all ports?
answer: — p-
How would you activate a script from the nmap scripting library (lots more on this later!)?
— script
How would you activate all of the scripts in the “vuln” category?
answer : — script=vuln
5.TCP Connect Scans
Which RFC defines the appropriate behaviour for the TCP protocol?
answer : RFC 793
If a port is closed, which flag should the server send back to indicate this?
answer: RST
Eğer port kapalı ise RST ile cevap verir. hedefin önünde bir firewall varsa zaten paket drop edileceği için cevap dönmeyecektir. Portun kapalı olduğunu anlamanın bir yoludur.
6. SYN Scans
There are two other names for a SYN scan, what are they?
Answer: half-open,stealth
Can Nmap use a SYN scan without Sudo permissions (Y/N)?
Answer: No
SYN scans are the default scans used by Nmap if run with sudo permissions.
SYN taramasını yetkili olmayan bir hesap yapamaz. Sudo yetkisine sahip olmalıdır.
7. UDP Scans
UDP isteği gönderdiğimiz makineden cevap gelmezse open|filtered diyebiliriz. Eğer kapalıysa “the port isunreachable” icmp mesajını geri döner.
Yani kapalı olduğunu anlamanın güzel bir yoludur. UDP TCP den daha hızlı olmasına rağmen, portun açık olduğundan emin olmak zordur. Yani filtered mı açık mı emin olmak zordur. Emin olmak için çoğu kez 2. istek de gönderilir. Bu yüzden UDP scan TCP’ye göre oldukça yavaştır. Tavsiye edilen ise sık kullanılan portları taramaktır. — top-ports’ u kullanabilirsiniz.
Örneğin: nmap -sU — top-ports 20 192.168.1.23
If a UDP port doesn’t respond to an Nmap scan, what will it be marked as?
answer: open|filtered
When a UDP port is closed, by convention the target should send back a “port unreachable” message. Which protocol would it use to do so?
answer: ICMP
8. NULL, FIN and Xmas
- -sN: NULL scan (no flags in TCP request, TCP isteğindeki bayrak kısmı boş)
- -sF: FIN scan (instead of completely emty packet, a request is sent with the FIN flag, TCP isteğindeki bayrak kısmında FIN bulunur)
- -sX: Xmas scan( malformed TCP packet, bozuk TCP paketi, segmenti, PSH, URG, FIN requests). Kapalı port için RST olarak döner. Dönüş yoksa, open-filtered diyebiliriz.
Which of the three shown scan types uses the URG flag?
answer: xmas
Why are NULL, FIN and Xmas scans generally used?
answer: Firewall evasion
Which common OS may respond to a NULL, FIN or Xmas scan with a RST for every port?
answer: microsoft windows
9. ICMP Network Scanning ( -sn)
How would you perform a ping sweep on the 172.16.x.x network (Netmask: 255.255.0.0) using Nmap? (CIDR notation)
answer: nmap -sn 172.16.0.0/16 (Class C)
10. NSE Scripts-Overview
NSE (nmap Scripting Engine) nmap’i daha verimli ve etkili kullanabilmemiz için çok iyi bir fırsat sağlar. NSE’deki scriptler Lua isimli bir dilde yazılır. Kategorilerine göre farklı amaçlar için kullanılabilir.
NSE (nmap Script Engine) is a powerful addition to Nmap, extending its functionality quite considerably. NSE Scripts are written in the Lua programming language and can be used to do a varity of things.
- safe : hedefi etkilemez, wont affect the target.
- intrusive: güvenli değil, muhtemelen hedefi etkiler. Canlı ortam için kullanılması tavsiye edilmez. Not safe: likely to affect the target. Not appropriate for production environment.
- vuln: Zafiyet tarama, Scan for vulnerabilirties
- exploit: Zafiyet sömürme, Attempt to exploit a vulnerability
- auth: yetki atlatma. Attempt to bypass authentication for running services.
- brute
- discovery
What language are NSE scripts written in?
answer: Lua
Which category of scripts would be a very bad idea to run in a production environment?
answer: -intrusive
11. NSE Scripts- Working with the NSE
NSE scriptlerinin kullanımı aşağıdaki gibidir. The usage of NSE scripts is in the following:
— script=<script_name>
Farklı scriptler aynı anda kullanılabilir. Different scritps can be used simultaneously.
— script_sbm-enum-users,smb-enum-shares
What optional argument can be the ftp-anon.nse script take?
answer: maxlist
12. NSE Scripts- Searching for scripts
NSE Scriptleri ile çalışmayı gördük. Şimdi de bu scriptleri nerede bulabileceğimize bakalım. Linux’da
/usr/share/nmap/scripts
de bulabilirsiniz. Bununla beraber;
/usr/share/nmap/scripts/script.db dosyasında da bulabilrisiniz.
Hatta daha da güzeli “grep” ile amacınıza uygun scripte ulaşabilirsiniz;
grep “ftp” /usr/share/nmap/scripts/script.db
komutu ile “ftp” içeren scriptlere ulaşabilrisiniz.
- ls -l .7usr/share/nmap/scripts/script.db*ftp*
ile de “ftp” içeren scriptlere ulabiliriz.
Ayrıca bir sitedeki scriptleri çekmek istersek;
sudo apt update && sudo apt install nmap
sudo wget -= /usr/share/nmap/scripts/<script_name> https://svn.nmap.org/nmap/scripts/<script_name>.nse
Search for “smb” scripts in the
/usr/share/nmap/scripts/
directory using either of the demonstrated methods.
What is the filename of the script which determines the underlying OS of the SMB server?answer: smb-os-discovery.nse
Read through this script. What does it depend on?
answer: smb-brute
linux cli’da “cat smb-os-discovery.nse” yazarak bulabilirsiniz.
13. Firewall Evasion
Firewall’un icmp isteklerini reddetmesini kullanarak firewalli atlatabilriz.
-Pn
ile icmp isteği göndermeden atlatabiliriz.
Bununla beraber başka yöntemler de vardır.
- -f : IDS ya da Firewallın dikkatini çekmesin diye parçalı, bölünmüş paketler gönderir, f: fragment
- — mtu<number> ile göndereceğimiz paket sayısını belirtebiliriz. 8'in katı olmalıdır.
- — scan-delay<time>ms : paketlerin arasına bir delay koyarız.
- — badsum: Firewall/IDS varlığını tespit etmemize yaray. Doğru olmayan bir checksum’a sahip bir paket kullanılır.
Which simple (and frequently relied upon) protocol is often blocked, requiring the use of the
-Pn
switch?answer: ICMP
Which Nmap switch allows you to append an arbitrary length of random data to the end of packets?
answer: — data-length
14. Practical
Does the target (
10.10.212.63
)respond to ICMP (ping) requests (Y/N)?answer: N
Perform an Xmas scan on the first 999 ports of the target — how many ports are shown to be open or filtered?
Answer: 999
There is a reason given for this — what is it?
answer: no response
Perform a TCP SYN scan on the first 5000 ports of the target — how many ports are shown to be open?
answer : 5