msf automatic connection configuration postgresql

Today, do a bit msf connection configuration database, middle encountered some pit point here is not described in detail, beginning correct mode of operation.

First postgresql be configured to facilitate the connection.

root @ kali: ~ # service postgresql start # start the database

root @ kali: ~ # su postgres # Set the user and the database
postgres@kali:/root$ createuser msf -P
Enter password for new role:
Enter it again:
postgres@kali:/root$ createdb --owner=msf4 msf

postgres@kali:/root$ exit

exit

root @ times: ~ #     

root @ kali: ~ # msfconsole # test the database connection status
### ###
msf > db_connect msf:password@localhost/msf
[*] Rebuilding the module cache in the background...
msf > db_status
[*] postgresql connected to msf
msf > search 2015-0531
[!] Module database cache not built yet, using slow search # here to wait a bit until normal, restart the application may consider closing
msf > exit

Automatic concatenation /usr/share/metasploit-framework/config/database.yml accomplished by configuration files, can be done by copying database.yml.example set and modify the content.

root@kali:/usr/share/metasploit-framework/config# cp database.yml.example database.yml
root@kali:/usr/share/metasploit-framework/config# vi database.yml
root@kali:/usr/share/metasploit-framework/config# cat database.yml
# Please only use postgresql bound to a TCP port.
# Only postgresql is supportable for metasploit-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-postgresql
development: &pgsql
adapter: postgresql
database: msf # modify here
username: msf # here
password: password # and here
host: localhost
port: 5432
pool: 5 # here to see the mood
timeout: 5
# You will often want to seperate your databases between dev
# mode and prod mode. Absent a production db, though, defaulting
# to dev is pretty sensible for many developer-users.
production: &production
<<: *pgsql
# Warning: The database defined as "test" will 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 is totally unsupported by Metasploit now.
test:
<<: *pgsql
database: metasploit_framework_test
username: metasploit_framework_test
password: ___________________________

  Finally, as to restart msf can, of course, you can also automatically open configuration database

 
 
root@kali:~# systemctl start postgresql
root@kali:~# systemctl enable postgresql
root @ kali: ~ # msfconsole # msf look into the effect
### ### msf > db_status [*] postgresql connected to msf msf > search CVE-2015-0311 Matching Modules ================ Name Disclosure Date Rank Description ---- --------------- ---- ----------- exploit/multi/browser/adobe_flash_uncompress_zlib_uaf 2014-04-28 great Adobe Flash Player ByteArray UncompressViaZlibVariant Use After Free msf >
 

 

Guess you like

Origin www.cnblogs.com/zi-Chuan/p/12316564.html