<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## Metasploit Development Environment 這是一個關于怎么安裝一個有效的`Metasploit`開發環境的指南 如果你只是想使用合法,切授權的`Metasploit`來進行黑客活動,我們建議你使用商業版`Metasploit`框架安裝包或者這個開源安裝包,這將處理你所有的依賴關系。 商業安裝程序還包括升級到` Metasploit Pro` 的選項, 并一周兩次更新,而開放源碼的安裝者將每晚更新 如果你是`kali linux` ` metasploit`是已經預先安裝了的,查看`kali linux`如何開始使用`metasploit`并設置數據庫 如果你想發展和貢獻 `Metasploit`, 閱讀這本指南應該讓你在所有基于`debian`的系統使用 讓我們開始吧 ### 假設 1. 您有一個 `Debian-based` 的 Linux 環境 2. 您有一個不是`root`的用戶。在本指南中, 我們使用的是`msfdev`。 3. 您有一個` GitHub` 帳戶 ### 下載開發依賴包 ~~~ sudo apt-get -y install \ autoconf \ bison \ build-essential \ curl \ git-core \ libapr1 \ libaprutil1 \ libcurl4-openssl-dev \ libgmp3-dev \ libpcap-dev \ libpq-dev \ libreadline6-dev \ libsqlite3-dev \ libssl-dev \ libsvn1 \ libtool \ libxml2 \ libxml2-dev \ libxslt-dev \ libyaml-dev \ locate \ ncurses-dev \ openssl \ postgresql \ postgresql-contrib \ wget \ xsel \ zlib1g \ zlib1g-dev ~~~ 注意, 還沒`Ruby` 不過我們很快就會得到。 ### fork或clone metasploit 您可以按照github的`fork`指令操作, 但它基本上只是在`Metasploit`框架的頁面的右上方,點擊 `fork` 按鈕 #### Clone 如果你有一個`fork`在 GitHub, 是時候把它拉到你的本地開發了。當然 您需要按照 GitHub 中的`clone`指令進行操作。 ~~~ mkdir -p $HOME/git cd $HOME/git git clone git@github.com:YOUR_USERNAME_FOR_GITHUB/metasploit-framework cd metasploit-framework ~~~ #### 設置git上游 首先, 如果你計劃用最新的`Metasploitg-framework`Git倉庫來更新你的本地克隆庫, 你就會想要跟蹤它。在您的`Metasploit-framework`庫中, 進行以下操作: ~~~ git remote add upstream git@github.com:rapid7/metasploit-framework.git git fetch upstream git checkout -b upstream-master --track upstream/master ~~~ 現在, 你有一個分支, 指向上游 (這個 `rapid7` fork), 這是不同于你自己的fork (原始的主分支, 指向`origin/master`)。你可能會發現有上游和master是不同的分支 (特別是如果你是一個 `Metasploi`t 提交, 因為這使得它不太可能不小心推到 `rapid7/master`)。 ###  下載rvm 大多數發行版不會與最新的 `Ruby` 一起使用一樣的頻率更新。因此, 我們將使用 `RVM`, 一個`Ruby` 版本管理器。你可以在這里讀到指南: https://rvm.io/, 發現它是相當大。有些人喜歡` rbenv`。你可以使用`rbenv`, 但你要靠自己來確保你有一個正常的ruby版本。大多數的提交使用 `RVM`, 所以對于本指南, 我們要堅持下去。 首先, 您需要 RVM 分發的簽名密鑰: ~~~ curl -sSL https://rvm.io/mpapis.asc | gpg --import - ~~~ 接下來, 獲取 RVM ~~~ curl -L https://get.rvm.io | bash -s stable ~~~ 這是直接的傳遞到 bash, 這可能是一個敏感的問題。一種更長、更安全的方式: ~~~ curl -o rvm.sh -L https://get.rvm.io less rvmsh cat rvm.sh | bash -s stable ~~~ 完成后, 使得當前終端以使用 RVM 版本的 ruby: ~~~ source ~/.rvm/scripts/rvm cd ~/git/metasploit-framework rvm --install $(cat .ruby-version) ~~~ 最后, 安裝bundle, 以獲得你需要的其他gem庫: ~~~ gem install bundler ~~~ ### 配置 Gnome 終端使用 RVM Gnome 終端是不聰明的, 并沒有讓你的 shell 默認情況下是登錄型shell, 所以 RVM沒有調整配置不能在那里工作。 導航`Edit > Profiles > Highlight Default > Edit > Title and Command > Check [ ] Run command as a login shell.`它看起來像這樣,取決于你的特定版本的Gnome: ![](https://github.com/rapid7/metasploit-framework/wiki/screens/kali-gnome-terminal.png) 最后, 請看看您現在正在運行 ruby 版本. ~~~ ruby -v ~~~ 如果您運行的ruby 版本仍未是ruby 定義的版本, 您可能需要重新啟動終端。如果您的 rvm 最初的安裝沒有類似于以下內容, 請確保您已將 rvm 添加到您的終端啟動中: ~~~ echo [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> .bashrc ~~~ > 看到這,如果沒根據指南.用root用戶操作的準備好報錯吧 ### 下載 Bundled Gem Metasploit有依賴(Ruby 庫)。因為您使用的是 RVM, 所以,您可以在本地安裝它們, 而不用擔心與 Debian 封裝的ruby沖突, 這要歸功于bundled ~~~ cd ~/git/metasploit-framework/ bundle install ~~~ 一兩分鐘后, 你可以開始使用metasploit了 ~~~ ./msfconsole ~~~ 在第一次啟動時順便創建你的 msf4 目錄。 ~~~ msfdev@lys:~/git/metasploit-framework$ ./msfconsole [*] Starting the Metasploit Framework console.../ _---------. .' ####### ;." .---,. ;@ @@`; .---,.. ." @@@@@'.,'@@ @@@@@',.'@@@@ ". '-.@@@@@@@@@@@@@ @@@@@@@@@@@@@ @; `.@@@@@@@@@@@@ @@@@@@@@@@@@@@ .' "--'.@@@ -.@ @ ,'- .'--" ".@' ; @ @ `. ;' |@@@@ @@@ @ . ' @@@ @@ @@ , `.@@@@ @@ . ',@@ @ ; _____________ ( 3 C ) /|___ / Metasploit! \ ;@'. __*__,." \|--- \_____________/ '(.,...."/ =[ metasploit v4.11.0-dev [core:4.11.0.pre.dev api:1.0.0]] + -- --=[ 1420 exploits - 802 auxiliary - 229 post ] + -- --=[ 358 payloads - 37 encoders - 8 nops ] + -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ] msf > ls ~/.msf4 [*] exec: ls ~/.msf4 history local logos logs loot modules plugins msf > exit ~~~ 雖然你還沒有設置數據庫。但這很容易解決 ### 安裝 PostgreSQL kali linux 已經有 Postgresql, 所以我們可以使用它。而用于工作的 Ubuntu 和其他 Debian-based 發行, 假設他們有一個等價的 postgresql 包。確保數據庫也在系統啟動時啟動。 ~~~ echo 'YOUR_PASSWORD_FOR_KALI' | sudo -kS update-rc.d postgresql enable && echo 'YOUR_PASSWORD_FOR_KALI' | sudo -S service postgresql start && cat <<EOF> $HOME/pg-utf8.sql update pg_database set datallowconn = TRUE where datname = 'template0'; \c template0 update pg_database set datistemplate = FALSE where datname = 'template1'; drop database template1; create database template1 with template = template0 encoding = 'UTF8'; update pg_database set datistemplate = TRUE where datname = 'template1'; \c template1 update pg_database set datallowconn = FALSE where datname = 'template0'; \q EOF sudo -u postgres psql -f $HOME/pg-utf8.sql && sudo -u postgres createuser msfdev -dRS && sudo -u postgres psql -c \ "ALTER USER msfdev with ENCRYPTED PASSWORD 'YOUR_PASSWORD_FOR_PGSQL';" && sudo -u postgres createdb --owner msfdev msf_dev_db && sudo -u postgres createdb --owner msfdev msf_test_db && cat <<EOF> $HOME/.msf4/database.yml # Development Database development: &pgsql adapter: postgresql database: msf_dev_db username: msfdev password: YOUR_PASSWORD_FOR_PGSQL host: localhost port: 5432 pool: 5 timeout: 5 # Production database -- same as dev production: &production <<: *pgsql # Test database -- not the same, since it gets dropped all the time test: <<: *pgsql database: msf_test_db EOF ~~~ 在kali Linux 上, postgresql (和任何其他監聽服務) 默認情況下是不啟用的。這是一個良好的安全和資源預防措施, 但如果你想要使用它, 隨時啟動它: ~~~ update-rc.d postgresql enable ~~~ 接下來, 切換到 postgres 用戶執行少量數據庫維護以修復默認編碼 (在 @ffmike 的要點中提供了有用的信息)。 ~~~ sudo -sE su postgres psql update pg_database set datallowconn = TRUE where datname = 'template0'; \c template0 update pg_database set datistemplate = FALSE where datname = 'template1'; drop database template1; create database template1 with template = template0 encoding = 'UTF8'; update pg_database set datistemplate = TRUE where datname = 'template1'; \c template1 update pg_database set datallowconn = FALSE where datname = 'template0'; \q ~~~ #### 創造一個數據庫用戶msfdev 在postgresql命令行 ~~~ createuser msfdev -dPRS # Come up with another great password createdb --owner msfdev msf_dev_db # Create the development database createdb --owner msfdev msf_test_db # Create the test database exit # Become msfdev again ~~~ #### 創造database.yml 現在你切換回原本用戶,創造文件`$HOME/.msf4/database.ym` ~~~ # Development Database development: &pgsql adapter: postgresql database: msf_dev_db username: msfdev password: YOUR_PASSWORD_FOR_PGSQL host: localhost port: 5432 pool: 5 timeout: 5 # Production database -- same as dev production: &production <<: *pgsql # Test database -- not the same, since it gets dropped all the time test: <<: *pgsql database: msf_test_db ~~~ 下次啟動./msfconsole 時, 將創建開發數據庫.檢查一下 ~~~ ./msfconsole -qx "db_status; exit" ~~~ ### respc 大多數框架測試都使用 rspec。確保它工作 ~~~ rake spec ~~~ 您應該看到超過9000測試運行, 主要都是綠色點, 少數是黃色的, 沒有紅色的錯誤。 ### 配置git #### 使用dev運行 ~~~ cd $HOME/git/metasploit-framework && git remote add upstream git@github.com:rapid7/metasploit-framework.git && git fetch upstream && git checkout -b upstream-master --track upstream/master && ruby tools/dev/add_pr_fetch.rb && ln -sf ../../tools/dev/pre-commit-hook.rb .git/hooks/pre-commit && ln -sf ../../tools/dev/pre-commit-hook.rb .git/hooks/post-merge && git config --global user.name "YOUR_USERNAME_FOR_REAL_LIFE" && git config --global user.email "YOUR_USERNAME_FOR_EMAIL" && git config --global github.user "YOUR_USERNAME_FOR_GITHUB" ~~~ #### 設置pull參考 如果您想輕松在您的命令行上訪問上游請求,-您需要在. git/config 中添加適當的 fetch 引用。以下操作很容易完成: ~~~ tools/dev/add_pr_fetch.rb ~~~ 這將為所有遠程倉庫添加適當的參考, 包括您的。現在, 你可以做一些奇特的事情, 比如: ~~~ git checkout fixes-to-pr-1234 upstream/pr/1234 git push origin ~~~ 在github這樣做的方法不太容易描述 這一切都可以讓你看看其他的的pull請求 , 作出修改, 并發布到自己的分支。反過來, 這將允許你幫助其他人的pull請求 修正或增加。 #### 保持同步 你大部分時間并不想直接提交給主分支。 始終在分支中進行更改,然后合并這些更改。 這使得與上游保持同步并且不會丟失任何本地更改變得很容易。 ##### 同步到上游/主分支 不可能更容易了 ~~~ git checkout master git fetch upstream git push origin ~~~ 這也可以保持pull請求與主分支同步,但除非你遇到合并沖突,你不應該經常這樣做。 當你最終解決合并沖突時,你需要在推送重新同步的分支時使用--force,因為你的提交歷史將在rebase之后有所不同。 > 對于rapid7/master來說,push是從來沒有好的,但對于正在進行的分支,對歷史的一點點說明不是違法的。 ### Msftidy 為了檢查你正在編寫的任何新模塊,你需要一個預先提交和一個合并后的`hook`來運行我們的lint-checker,`msftidy.rb`。 所以,像這樣符號鏈接: ~~~ cd $HOME/git/metasploit-framework ln -sf tools/dev/pre-commit-hook.rb .git/hooks/pre-commit ln -sf tools/dev/pre-commit-hook.rb .git/hooks/post-merge ~~~ ### 你的名字 最后,如果您想要為Metasploit做出貢獻,您至少需要配置您的用戶名和電子郵件地址,如下所示: ~~~ git config --global user.name "YOUR_USERNAME_FOR_REAL_LIFE" git config --global user.email "YOUR_USERNAME_FOR_EMAIL" git config --global github.user "YOUR_USERNAME_FOR_GITHUB" ~~~ 你填寫的郵件地址需要和你的github賬號的郵件地址相同 ### 簽名提交 我們喜歡簽名提交,主要是因為我們害怕偽造[偽造](https://mikegerwitz.com/papers/git-horror-story)。 程序在這里[詳細說明](https://github.com/rapid7/metasploit-framework/wiki/Committer-Keys#signing-howto)。 請注意,名稱和電子郵件地址必須完全匹配簽名密鑰上的信息。 鼓勵貢獻者簽署提交,而Metasploit提交者需要在提交請求時簽署合并提交。 ### 方便的別名 沒有幾個方便的別名,開發環境設置也將是完整的,但它可以使您的生活更輕松 #### 覆蓋已安裝的msfconsole 作為開發用戶,您可能會不小心嘗試使用已安裝的Metasploit msfconsole。 由于RVM怎么處理不同的ruby版本和gemset 各種各樣的原因,這種方式不能工作。 所以,創建這個別名 ~~~ echo 'alias msfconsole="pushd $HOME/git/metasploit-framework && ./msfconsole && popd"' >> ~/.bash_aliases ~~~ 如果您正在使用已安裝版本和開發版本,則不同的用戶帳戶是最好的選擇。 #### 提示當前的Ruby/Gemset/Branch 這是超級方便的跟蹤你現在在哪里的方法。 把它放在?/ .bash_aliases中。 ~~~ function git-current-branch { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /' } export PS1="[ruby-\$(~/.rvm/bin/rvm-prompt v p g)]\$(git-current-branch)\n$PS1" ~~~ ####  Git 別名 Git有自己的處理別名的方法 - 無論是在$HOME/.gitconfig還是repo-name/.git/config 與常規shell別名分離。 下面是一些較為便利的。 ~~~ [alias] # An easy, colored oneline log format that shows signed/unsigned status nicelog = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%aE>%Creset [%G?]' # Shorthand commands to always sign (-S) and always edit the commit message. m = merge -S --no-ff --edit c = commit -S --edit # Shorthand to always blame (praise) without looking at whitespace changes b= blame -w # Spin up a quick temp branch, because git stash is too spooky. temp = !"git branch -D temp; git checkout -b temp" # Create a pull request in a web browser from the CLI. Usage: $1 is HISNAME, $2 is HISBRANCH # Fixes from @kernelsmith, thanks! pr-url =!"xdg-open https://github.com/$(git config github.user)/$(basename $(git rev-parse --show-toplevel))/pull/new/$1:$2...$(git branch-current) #" ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看