As we all know, when conducting penetration testing under MSF, the results data can be saved to the database, allowing individual team members to synchronize data during penetration testing.
For example, Metasploit provides the Db_nmap command, which allows the Nmap scan results to be stored directly in the database, and also provides a db_import command to support the import of scan results from up to 20 scans.
Metasploit supports a variety of databases, such as MySQL, SQLite3, PostgreSQL, where PostgreSQL is used as the default database.
To enable Msfconsole, you first need to enable PostgreSQL and Metasploit
Using Msfconsole to enter the MSF console
Db_status
You can use Db_status to view the database of the current MSF connection, for example, the database I am currently connected to is MSF3
Db_connect
If you are connecting for the first time, you need to use Db_connect to connect to the specified database, and for db_connect usage, you can view it using Db_connect--help
, you specify the database name, user name, and password when you want to connect to the specified database
View Password
If you do not know the Metasploit database name and password, you can view it in Database.yml (/OPT/METASPLOIT/APPS/PRO/UI/CONFIG/DATABASE.YML)
Db_disconnect
If you want to switch to a different database, you need to first disconnect the currently connected database by using Db_disconnect
Remotely connect to a database using Pgadmin
When you remotely connect to a database in a Kali in another machine, you sometimes get an error: The server is not listening
Or
Workaround:
To modify the configuration file postgresql.conf:
listen_addresses = ' * '(' * ' means all addresses)
Port = 5432 (if your DB listens on another port, it needs to be set to the appropriate listening port.) Some initial configurations may have commented out this option, please remove the preceding "#" character)Then use Pgadmin remote connection (username and password in database.yml file), will error, Fatal:no pg_hba.conf entry for Host "
Hostallall
If the above settings are to take effect, restart the Postgres service: Service PostgreSQL Restart, you can remotely connect to a PostgreSQL database on another server by using Pgadmin.
If you have other questions when you refer to the above steps, please Google yourself.
Recommended Reading
For additional configuration information about configuration files and authentication files, you can refer to the following articles:
postgresql.conf Configuration
Modify the configuration file pg_hba.conf, Postgresql.conf's attention point
A brief analysis of PostgreSQL pg_hba.conf file
Copyright
Author: Once a civil man
Original article: http://www.cnblogs.com/hongfei/p/3795324.html