الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

nmap

The network mapper: find hosts, open ports, running services and versions, and check TLS — to audit your own network.

المستوى
خدمة DevSecOps
المجموعة
الفحص الأمني والتقوية
يحتاج root
للتغييرات
الحزمة
nmap

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

nmap sends probes to hosts and ports and reports which ports are open, closed or filtered. With -sV it detects service versions, with -O the OS, and the NSE scripts add checks (TLS ciphers, HTTP headers, SSH algorithms, known CVEs). DevSecOps use: check that only the ports you expect are open after a deployment, find forgotten services, and verify firewall rules from the outside.

Scan only networks you own or are allowed to test.

طريقة الكتابة

nmap [SCAN TYPE] [OPTIONS] TARGETS

الأجزاء الرئيسية

Scan types

-sS
TCP SYN scan (default as root; fast, half-open).
-sT
TCP connect scan (default as normal user).
-sU
UDP scan (slow).
-sn
Host discovery only, no ports.
-sV
Detect service versions.
-O
Detect the OS.
-A
-O -sV -sC --traceroute together.
-sC / --script NAME
Default / chosen NSE scripts.

الخيارات 10

الأكثر استخدامًا

Options

-p PORTS / -p-
Ports (22,80,443 / 1-65535 / all).
--top-ports N
The N most common ports.
-Pn
Skip ping (hosts that block ICMP).
-T0 … -T5
Timing (T3 default, T4 faster).
-oN / -oX / -oG / -oA FILE
Output: normal, XML, grepable, all.
--open
Show only open ports.
-iL FILE
Targets from a file.
--exclude HOSTS
Skip hosts.
-6
IPv6.
--reason
Why a port has its state.

أمثلة 10

$ مستخدم عادي# بصلاحية root (أو مع sudo)

  1. 1Which hosts are up in the lab?

    nmap -sn 192.168.122.0/24
  2. 2Open ports and versions on one server

    sudo nmap -sS -sV --open 192.168.122.11
  3. 3All TCP ports

    sudo nmap -p- --open -T4 192.168.122.11
  4. 4Check what the internet sees (run from outside)

    nmap -Pn --top-ports 100 --open shop.example.com
  5. 5TLS versions and ciphers

    nmap --script ssl-enum-ciphers -p 443 shop.example.com
  6. 6SSH algorithms

    nmap --script ssh2-enum-algos -p 22 192.168.122.11
  7. 7HTTP security headers and title

    nmap --script http-security-headers,http-title -p 80,443 shop.example.com
  8. 8UDP services (DNS, NTP, SNMP)

    sudo nmap -sU -p 53,123,161 192.168.122.1
  9. 9Compare two scans after a change

    sudo nmap -sS -p- -oX before.xml 192.168.122.11
    sudo nmap -sS -p- -oX after.xml 192.168.122.11
    ndiff before.xml after.xml
  10. 10Scan a list of servers and save all formats

    sudo nmap -sV -iL servers.txt -oA weekly-$(date +%F)

انتبه

  • Scanning networks without permission can be illegal and can trigger security alerts.
  • "filtered" means a firewall drops the probes — not that the port is safe.

الملفات

/usr/share/nmap/scripts/
NSE scripts.

نصائح للحفظ

  • Put a weekly nmap + ndiff of your public IPs into a pipeline and alert on new open ports.

رموز الخروج

0Success.
1Error.