Komut satirindan Nessus kullanimi

Nessus’un beğendiğim ozelliklerinden biri de komut satirindan kullanilabilmesidir. Böylece komut satırının gücünü de kullanarak nessus taramalarını istediğimiz gibi şekillendirebiliyoruz.

Mesela kullandığımız sistemleri her gece saat xx de otomatik olarak belirli açıklıklara karşı tarayıp alarm üretebiliyoruz ya da yeni Nessus’un pluginlerini güncel tutup yeni bir açıklık çıktığında bu açıklığın hangi sistemlerimizde olduğunu kolayca öğrenebiliriz.

Komut satırı Nessus kullanımı için nessuscmd komutu kullanılır. Hem Linux hem de Windows için kullanılabilir.(nessuscmd)

Komut satırından hangi tür taramalar yapılabilir?

  • Host Keşfi
    Port Taramaları
    Zaafiyet tarama
    Yerel güvenlik açıklıklarının taranması(user/pass/sertifika ister)

Nessus’un çalışma mantığını hatırlayacak olursak istemci-sunucu mimarisinde çalışırdı. Yani Nessus taramalarini yapan bir motor ve bu motoru yoneten istemci programi. Nessuscmd burada istemci tarafını oynadığı için oyunun tamamlanabilmesi için Nessus motoru(sunucu tarafı)nun da çalışıyor olması gerekir.

NOTE: Nessuscmd’nin çalışması için nessus motorunun aynı hostta çalışmasına gerek yoktur, uzaktaki bir Nessus motoruna bağlanarak da çalışabilir. Bunun için aşağıdaki parametrelerin verilmesi yeterli olacaktır.

Connecting to a remote Nessus scanner :
—————————————
–remote : Connect to the remote Nessus host
–remote-port
: Connect to the remote Nessus on port
–login : Connect to the remote Nessus with the login [optional]
–password
: Connect to the remote Nessus with the password
[optional]

Nessus motoru çalışmadan yapılacak bir tarama aşağıdakine benzer bir çıktı verecektir.

# nessuscmd -sT localhost

Could not open /opt/nessus//var/nessus/nessus.sock (Connection refused)
Make sure nessusd is running and that you have the privileges to open this socket

Aynı taramayı Nessus motorunu çalıştırarak yapalım.

# /opt/nessus/sbin/nessusd &

[1] 17288
bt ~ # nessusd (Nessus) 3.2.1. for Linux
(C) 1998 – 2008 Tenable Network Security, Inc.

Processing the Nessus plugins…
[##################################################]

All plugins loaded

# nessuscmd -sT localhost

Starting nessuscmd 3.2.1
Scanning ‘localhost’…

+ Results found on localhost :
– Port ssh (22/tcp) is open
– Port http (80/tcp) is open
– Port nessus (1241/tcp) is open

Nessuscmd ile Port Tarama

Nessuscmd, Nmap benzeri bir port tarama listesi kullanır fakat tarama seçenekleri Nmap’inki kadar detaylı ve esnek değildir.

Port tarama seçenekleri

——————
-p
: Enable the port scanner and scan this port range
(use ‘default’ for the Nessus default port range)
-sT : Perform a TCP connect()
-sS : Perform a SYN scan
-sP : Perform a PING scan

-O : Enable OS Fingerprinting

—————–

Nessuscmd ile belirli bir açıklığı taramak

Nessus’da tüm açıklıklar bir id ile belirtilir. Mesela yeni çıkan Microsoft MS08-067 açıklığı için kullanılacak Nessus plugin’inin id’si #34477. Ben hedef sistemlerde sadece bu açıklığı test etmek istersem aşağıdaki gibi bir komut işimi görecektir.

#nessuscmd -i 34477 hedef_ip adresi

Birden fazla plugini denemek için -i parametresinden sonra pluginler arasına , koyulur.

#nessuscmd 192.168.1.1 -i 15000,1700,18000,19000
gibi.

Ek olarak birden fazla açıklığı birden fazla sistem üzerinde denemek için

#nessuscmd 192.168.1.0/24 -p 20-80 -i 20000,20001,20002

gibi bir komut yeterli olacaktir.

Yerel sistem açıklıklarını test etmek

# nessuscmd -vv -i 22869 –ssh-login root –ssh-password parolam 10.0.0.100

Nessuscmd ile birlikte gelen diğer kullanım özelliklerini öğrenmek için

# nessuscmd -h

nessuscmd 3.2.1 – (C) 2006 – 2008 Tenable Network Security, Inc.

Usage:
nessuscmd target…

Port Scan options:
——————
-p
: Enable the port scanner and scan this port range
(use ‘default’ for the Nessus default port range)
-sT : Perform a TCP connect()
-sS : Perform a SYN scan
-sP : Perform a PING scan

-O : Enable OS Fingerprinting

Ping options:
————–
-P0 : Do not ping the remote hosts prior to a scan
-PI : Do an ICMP ping
-PT : Do a TCP ping
-PA : Do an ARP ping (only on the local subnet)
Ping options can be combined – ie: -PIT performs a TCP and an ICMP ping

Vulnerability Scan options:
—————————
-i
: Enable plugin
This option can be used multiple times – ie: -i 12209 -i 20368 -i 16337,10884
See http://www.nessus.org/scripts.php for a list of plugins
-N : do NOT enable plugin dependencies
-V : Display the complete report of the plugins
-q : Only display wether a plugin matches or not
-U : DISABLE safe checks

Credentials:
—————————
SMB : (Windows)
–smb-login : SMB login
–smb-password : SMB password to use

–smb-domain : SMB domain to log into

–smbi : Interactively ask for SMB credentials

SSH :
–ssh-login : SSH login
–ssh-password : SSH password to use
–ssh-pubkey : SSH public key to use
–ssh-privkey : SSH private key to use
–ssh-passphrase : Passphrase for the SSH key to use
–sshi : Interactively ask for SSH credentials
Warning: Using ssh credentials for the scan makes you vulnerable to a mitm attack

Telnet/Rlogin/Rsh:
–cleartext-login : Clear text login
–cleartext-password : Clear text password to use
Warning: Using clear text credentials for a scan is dangerous

Using a .audit file:
—————————————
–unix-audit : .audit file to use for the local Unix compliance checks
–windows-audit : .audit file to use for the local Unix compliance checks

Connecting to a remote Nessus scanner :
—————————————
–remote : Connect to the remote Nessus host
–remote-port
: Connect to the remote Nessus on port
–login : Connect to the remote Nessus with the login [optional]
–password
: Connect to the remote Nessus with the password
[optional]

Other options:
————–
-v : Be verbose during the scan
-h : Display this help

–recv-timeout : Plugins recv() timeout
–max-hosts : Number of hosts to scan in parallel
-o name=value : nessusd option
-f /path/to/socket : use an alternative Unix socket
Examples :
———-
nessuscmd -p 1-1024 localhost
nessuscmd -O 10.0.1.2
nessuscmd -V -i 10884 172.1

6.1.1

This entry was posted in Network Security, Network Tools, Penetration, Security Tools. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

thirteen + 20 =