Arch-Linux

如何在任何目錄中執行 msfconsole?

  • July 13, 2017

我剛剛安裝了metasploit。問題是我只能./msfconsole在安裝目錄中執行,即/opt/framework/metasploit-framework.

當我msfconsole在另一個目錄中執行時,我收到此錯誤:

Could not find rake-10.4.2 in any of the sources
Run `bundle install` to install missing gems.

在我的 .bashrc 文件中:

export PATH="$PATH:$HOME/.rvm/bin" 
export PATH="$PATH:$HOME/.gem/ruby/2.3.0/bin"
export PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH"

export PATH=$PATH:/opt/framework/metasploit-framework
alias msfconsole="./msfconsole --quiet -x \"db_connect ${USER}@msf\""

到目前為止我的解決方案(我必須這樣exit/opt/framework/metasploit-framework):

alias msfconsole="cd /opt/framework/metasploit-framework && ./msfconsole --quiet -x \"db_connect ${USER}@msf\""

我設法通過將此行添加到我的.bashrc

alias msfconsole="cd /opt/framework/metasploit-framework && ./msfconsole --quiet -x \"db_connect ${USER}@msf\ && cd -""

你的別名是錯誤的。前導./表示“在目前目錄中執行此操作”。如果您刪除它,它應該可以工作。

export PATH=$PATH:/opt/framework/metasploit-framework
alias msfconsole="msfconsole --quiet -x \"db_connect ${USER}@msf\""

引用自:https://unix.stackexchange.com/questions/254258