msf自動連接postgresql配置


今天做了一下msf連接數據庫的配置,中間碰到了一些坑點這里就不詳細敘述了,開始正確的操作方式。

首先對postgresql進行配置以方便連接。

root@kali:~# service postgresql start                       #啟動數據庫
root@kali:~# service postgresql status                      

root@kali:~# sudo -u postgres psql
psql (10.1)
輸入 "help" 來獲取幫助信息.

postgres=# alter user postgres password 'admin';
ALTER ROLE
postgres=# \q

root@kali:~# msfconsole                                           #測試數據庫連接狀態
### ###
msf > db_connect msf:admin@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 #這里要稍等一下才會正常,可以考慮關閉應用重啟一下
msf > exit
修改數據庫文件:postgresql.conf和pg_hba.conf
文件第一處(59行)

 

 文件第二處   (88行)

 

 第二個文件最會添加。

在文檔最后添加

 

 

連接數據庫

 

 這里因為之前有msf了所以從新創一個msf4(正常的可略過)

這里如果沒有database.yml文件可以先cp database.yml.example database.yml  然后進行修改。

 

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 #修改這里
username: msf #這里
password: admin  #還有這里
host: localhost
port: 5432
pool: 5  #這里看心情
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: ___________________________

  最后如重新啟動msf就可以了,當然還可以在配置下數據庫自動開啟

root@kali:~# systemctl start postgresql
root@kali:~# systemctl enable postgresql
root@kali:~# msfconsole       #進入msf看效果
### ### 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 >
 
 
        

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM