Metasploit自動連接postgresql

來源:互聯網
上載者:User

標籤:

1. 啟動postgresql
[email protected]:~# service postgresql start
2. 設定使用者與資料庫
[email protected]:~# su postgres[email protected]:/root$ createuser msf4 -PEnter password for new role:Enter it again:[email protected]:/root$ createdb --owner=msf4 msf4
[email protected]:/root$ exit
exit
[email protected]:~#
3. 測試資料庫連接狀態
[email protected]:~# msfconsole### ###msf > db_connect msf4:[email protected]/msf4[*] Rebuilding the module cache in the background...msf > db_status[*] postgresql connected to msf4msf > search 2015-0531[!] Module database cache not built yet, using slow search #這裡要稍等一下才會正常,可以考慮關閉應用重啟一下msf > 
4. 設定自動連接

自動連接可以通過設定檔 /usr/share/metasploit-framework/config/database.yml 完成,內容可以通過複製database.yml.example並修改內容來完成設定。

[email protected]:/usr/share/metasploit-framework/config# cp database.yml.example database.yml[email protected]:/usr/share/metasploit-framework/config# vi database.yml[email protected]:/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-postgresqldevelopment: &pgsql  adapter: postgresql  database: msf3 #主要該紅色的這三個值  username: msf3  password: jinchangkun  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: ___________________________

重新執行msfconsole即可直接連結資料庫

[email protected]:~# msfconsole### ###msf > db_status[*] postgresql connected to msf4msf > search CVE-2015-0311Matching 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 Freemsf > 
5. . .

之前遇到過填database.yml內容無效的版本,是通過在使用者的家目錄下建立設定檔完成的,等遇到類似的再補充。

Metasploit自動連接postgresql

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.