1. Start PostgreSQL
[email protected]:~# service PostgreSQL start
2. Setting up Users and databases
[Email protected]:~# su Postgres[email protected]:/root$ createuser msf4- for new Role:enter it Again:[email Protected]:/root$ createdb--owner=msf4 MSF4
[Email protected]:/root$ exit
Exit
3. Test Database Connection Status
[Email protected]:~ #> Db_connect msf4:[email protected]/msf4[in > db_status[* -0531[!
4. Set up automatic connection
Automatic connection can be done through configuration file /usr/share/metasploit-framework/config/database.yml , Content can be set by copying database.yml.example and modifying content.
[Email protected]:/usr/share/metasploit-framework/config# CPdatabase.yml.example database.yml[email protected]: /usr/share/metasploit-framework/config# VIdatabase.yml[email protected]: /usr/share/metasploit-framework/config# Catdatabase.yml# bound to a TCP port.# only PostgreSQL is supportable formetasploit-framework# these days. (No SQLite, no MySQL). # To set up a Metasploit database, follow the directions hosted at:# http://R-7.co/msf-dev#set-up-postgresqlDevelopment: &pgsql adapter:postgresql Database: msf3 #主要该红色的这三个值 username: msf3 Password: jinch Angkun host:localhost Port:5432Pool:5Timeout:5# You'll often want to seperate your databases between dev# mode and prod mode. Absent a production db, though, defaulting# to Dev is pretty sensible forMany developer-users.production:&Production<<: *pgsql# warning:the database defined as"Test"'ll be erased and# re-generated from your development database when you run"Rake". # do not set this db to the same as development or production.## Note Also, sqlite3 are totally unsupported by METASPL OIT now.test:<<: *pgsql database:metasploit_framework_test username:metasploit_framework_test Password: ________________________ ___
The database can be linked directly by re-executing msfconsole
[Email protected]:~ # msfconsole### # # #msf>db_status[*] PostgreSQL connected to MSF4MSF> Search cve- --0311Matching Modules================Name Disclosure Date Rank Description---- --------------- ---- -----------Exploit/multi/browser/adobe_flash_uncompress_zlib_uaf the-Geneva- -great Adobe Flash Player ByteArray uncompressviazlibvariant use after FREEMSF>
5.. .
Previously encountered the DATABASE.YML content is invalid version, is through the user's home directory to create the configuration file completed, etc. encountered a similar supplement.
Metasploit automatically connect PostgreSQL