1. Introduction
Metasploit provides a number of friendly, easy-to-use tools for penetration testers. Metasploit was originally created by HD Moore and was later acquired by Radid7, a nexpose vulnerability scanner. During penetration testing, some of the work that can be done by hand can be done by Metasploit.
The Metasploit needs to be updated frequently and the latest attack library has been maintained. You can update Metasploit by running the following command weekly.
# msfupdate
2. Metasploit and database postgresql2.1 PostgreSQL database
Metasploit can import the results of the execution into the database, using the PostgreSQL database by default. Use service postgresql start
the start PostgreSQL service and then command su postgres -c psql
to do some configuration. If you want to change the password for the default user name, you can use the following statement:
ALTER USER postgres WITH PASSWORD ‘myPassword‘;
This will change the password for the default user Postgres to MyPassword. Use \q to exit the console.
There is no return alter ROLE, and there is no postgres user, it is we can wear pieces of a user ourselves and create the database we need.
CREATE USER msfuser WITH PASSWORD ‘msfpass‘;
CREATE DATABASE pentester;
2.2 Confirming the connection status of the database
Start Metasploit control, terminal input msfconsole
, after the start of the interface as follows:
At the msf> prompt, enter:
"' Msf> db_connect msfuser:[email protected]/pentester
Msf> Db_status
View the connection information by entering the host command. The first time you connect to MSF, some tables are created automatically.
2.3 Call Nmap Scan in Metasploit
In order to obtain output information when executing the hosts command, you can use Nmap for a quick scan to collect data. In the case of Msfconsole booting, and the database is already connected, we can do the NMAP scan directly in the Metasploit. The scanned results are automatically added to the database and retrieved later.
db_nmap -nO -sTU -pT:22,80,443,139,111,U:111,137 222.31.76.240
You can now run the hosts command to see that the target system has been added to the PostgreSQL database. You can also use a variety of retrieval techniques to get the information you need to save time, such as finding which systems are open for 22 ports and can be used services -p 22
.
Penetration Testing Learning using Metasploit