{{tag>deutsch linux kali it-security pentest}}
====== Host Discovery mit Metasploit Datenbank ======
===== Datenbank vorbereiten =====
PostgreSQL Datenbank anlegen und einen Benutzer mit Zugriffsrechten für diese einrichten.
root@kali:~# msfdb init
Creating database user 'msf'
Enter password for new role:
Enter it again:
Creating databases 'msf' and 'msf_test'
Creating configuration file in /usr/share/metasploit-framework/config/database.yml
Creating initial database schema
===== Metasploit: Datenbank verbinden =====
msf6 > db_connect user:pass@127.0.0.1/db_name
==== Verbindung prüfen ====
msf6 > db_status
[*] Connected to db_name. Connection type: postgresql. Connection name: local_db_service.
===== Metasploit: Workspace anlegen =====
msf6 > workspace
* default
msf6 > workspace -a new_ws
[*] Added workspace: new_ws
[*] Workspace: new_ws
msf6 > workspace
default
* new_ws
==== nmap Scan ====
msf6 > db_nmap -sP 192.168.2.0/24
[*] Nmap: Starting Nmap 7.93 ( https://nmap.org ) at 2022-12-29 21:57 Mitteleurop�ische Zeit
[*] Nmap: Nmap scan report for 192.168.2.1
...
===== Hosts prüfen =====
sf6 > hosts
Hosts
=====
address mac name os_name os_flavor os_sp purpose info comments
------- --- ---- ------- --------- ----- ------- ---- --------
192.168.2.1 XX:XX:XX:XX:XX:XX
192.168.2.43 XX:XX:XX:XX:XX:XX 192-168-2-43.fritz.box
===== Portscan vorbereiten und durchführen =====
==== Hosts als Parameter übergeben ====
msf6 > use auxiliary/scanner/portscan/tcp
msf6 auxiliary(scanner/portscan/tcp) > hosts -R
==== Portscan starten ====
msf6 auxiliary(scanner/portscan/tcp) > run
[+] 192.168.2.1: - 192.168.2.1:21 - TCP OPEN
[+] 192.168.2.1: - 192.168.2.1:53 - TCP OPEN
[+] 192.168.2.1: - 192.168.2.1:80 - TCP OPEN
[+] 192.168.2.1: - 192.168.2.1:443 - TCP OPEN