Skip to content

Instantly share code, notes, and snippets.

@austinsonger
Forked from xl7dev/Install Metasploit on OS X
Last active December 2, 2020 09:26
Show Gist options
  • Save austinsonger/11aacafb433d534e1b2b419af4f32395 to your computer and use it in GitHub Desktop.
Save austinsonger/11aacafb433d534e1b2b419af4f32395 to your computer and use it in GitHub Desktop.

Revisions

  1. austinsonger revised this gist Jan 31, 2020. 1 changed file with 38 additions and 37 deletions.
    75 changes: 38 additions & 37 deletions Install Metasploit on OS X
    Original file line number Diff line number Diff line change
    @@ -1,70 +1,71 @@
    # XCode Command Line Tools

    >xcode-select --install
    xcode-select --install

    # Install Homebrew

    >ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    >echo PATH=/usr/local/bin:/usr/local/sbin:$PATH >> ~/.bash_profile
    >source ~/.bash_profile
    >brew tap homebrew/versions
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    echo PATH=/usr/local/bin:/usr/local/sbin:$PATH >> ~/.bash_profile
    source ~/.bash_profile
    brew tap homebrew/versions

    # Install nmap

    >brew install nmap
    brew install nmap

    # Install libxml2

    >brew install libxml2
    brew install libxml2

    # Install PostgreSQL

    >brew install postgresql --without-ossp-uuid
    brew install postgresql

    # ruby 2.1.X

    >brew install homebrew/versions/ruby21
    brew install homebrew/versions/ruby21


    # Initialize the database

    >initdb /usr/local/var/postgres
    >mkdir -p ~/Library/LaunchAgents
    >cp /usr/local/Cellar/postgresql/9.4.0/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
    >launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
    >echo "alias pg_start='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'"
    >echo "alias pg_stop='pg_ctl -D /usr/local/var/postgres stop'"
    initdb /usr/local/var/postgres
    mkdir -p ~/Library/LaunchAgents
    cp /usr/local/Cellar/postgresql/12.1/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
    echo "alias pg_start='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'"
    echo "alias pg_stop='pg_ctl -D /usr/local/var/postgres stop'"

    # Create the db for the metasploit framework

    >createuser msf -P -h localhost
    >createdb -O msf msf -h localhost
    createuser msf -P -h localhost
    createdb -O msf msf -h localhost

    # Clone the Git Metasploit

    >git clone https://github.com/rapid7/metasploit-framework.git /usr/local/share/metasploit-framework
    git clone https://github.com/rapid7/metasploit-framework.git /usr/local/share/metasploit-framework

    # settings Env

    >echo 'alias msfconsole="/usr/local/share/metasploit-framework && ./msfconsole && cd -"' >> ~/.zshrc
    >echo 'alias msfbinscan="/usr/local/share/metasploit-framework && ./msfbinscan && cd -"' >> ~/.zshrc
    >echo 'alias msfd="/usr/local/share/metasploit-framework && ./msfd && cd -"' >> ~/.zshrc
    >echo 'alias msfelfscan="/usr/local/share/metasploit-framework && ./msfelfscan && cd -"' >> ~/.zshrc
    >echo 'alias msfmachscan="/usr/local/share/metasploit-framework && ./msfmachscan && cd -"' >> ~/.zshrc
    >echo 'alias msfpescan="/usr/local/share/metasploit-framework && ./msfpescan && cd -"' >> ~/.zshrc
    >echo 'alias msfrop="/usr/local/share/metasploit-framework && ./msfrop && cd -"' >> ~/.zshrc
    >echo 'alias msfrpc="/usr/local/share/metasploit-framework && ./msfrpc && cd -"' >> ~/.zshrc
    >echo 'alias msfrpcd="/usr/local/share/metasploit-framework && ./msfrpcd && cd -"' >> ~/.zshrc
    >echo 'alias msfupdate="/usr/local/share/metasploit-framework && ./msfupdate && cd -"' >> ~/.zshrc
    >echo 'alias msfvenom="/usr/local/share/metasploit-framework && ./msfvenom && cd -"' >> ~/.zshrc
    >sudo chmod go+w /etc/profile
    >sudo echo export MSF_DATABASE_CONFIG=/usr/local/share/metasploit-framework/config/database.yml >> /etc/profile
    >cd /usr/local/share/metasploit-framework
    >bundle install
    echo 'alias msfconsole="/usr/local/share/metasploit-framework && ./msfconsole && cd -"' >> ~/.zshrc
    echo 'alias msfbinscan="/usr/local/share/metasploit-framework && ./msfbinscan && cd -"' >> ~/.zshrc
    echo 'alias msfd="/usr/local/share/metasploit-framework && ./msfd && cd -"' >> ~/.zshrc
    echo 'alias msfelfscan="/usr/local/share/metasploit-framework && ./msfelfscan && cd -"' >> ~/.zshrc
    echo 'alias msfmachscan="/usr/local/share/metasploit-framework && ./msfmachscan && cd -"' >> ~/.zshrc
    echo 'alias msfpescan="/usr/local/share/metasploit-framework && ./msfpescan && cd -"' >> ~/.zshrc
    echo 'alias msfrop="/usr/local/share/metasploit-framework && ./msfrop && cd -"' >> ~/.zshrc
    echo 'alias msfrpc="/usr/local/share/metasploit-framework && ./msfrpc && cd -"' >> ~/.zshrc
    echo 'alias msfrpcd="/usr/local/share/metasploit-framework && ./msfrpcd && cd -"' >> ~/.zshrc
    echo 'alias msfupdate="/usr/local/share/metasploit-framework && ./msfupdate && cd -"' >> ~/.zshrc
    echo 'alias msfvenom="/usr/local/share/metasploit-framework && ./msfvenom && cd -"' >> ~/.zshrc
    sudo chmod go+w /etc/profile
    sudo echo export MSF_DATABASE_CONFIG=/usr/local/share/metasploit-framework/config/database.yml >> /etc/profile
    cd /usr/local/share/metasploit-framework
    bundle install

    # Create the Database Configuration

    >vim /usr/local/share/metasploit-framework/config/database.yml
    nano /usr/local/share/metasploit-framework/config/database.yml

    Paste the following text:

    production:
    @@ -79,7 +80,7 @@ production:

    # update your environment

    >source /etc/profile
    >source ~/.bash_profile
    source /etc/profile
    source ~/.bash_profile

    > msfconsole
    msfconsole
  2. @xl7dev xl7dev revised this gist Jan 5, 2016. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion Install Metasploit on OS X
    Original file line number Diff line number Diff line change
    @@ -46,7 +46,17 @@

    # settings Env

    >echo 'alias msfconsole="pushd /usr/local/share/metasploit-framework && ./msfconsole && popd"' >> ~/.zshrc
    >echo 'alias msfconsole="/usr/local/share/metasploit-framework && ./msfconsole && cd -"' >> ~/.zshrc
    >echo 'alias msfbinscan="/usr/local/share/metasploit-framework && ./msfbinscan && cd -"' >> ~/.zshrc
    >echo 'alias msfd="/usr/local/share/metasploit-framework && ./msfd && cd -"' >> ~/.zshrc
    >echo 'alias msfelfscan="/usr/local/share/metasploit-framework && ./msfelfscan && cd -"' >> ~/.zshrc
    >echo 'alias msfmachscan="/usr/local/share/metasploit-framework && ./msfmachscan && cd -"' >> ~/.zshrc
    >echo 'alias msfpescan="/usr/local/share/metasploit-framework && ./msfpescan && cd -"' >> ~/.zshrc
    >echo 'alias msfrop="/usr/local/share/metasploit-framework && ./msfrop && cd -"' >> ~/.zshrc
    >echo 'alias msfrpc="/usr/local/share/metasploit-framework && ./msfrpc && cd -"' >> ~/.zshrc
    >echo 'alias msfrpcd="/usr/local/share/metasploit-framework && ./msfrpcd && cd -"' >> ~/.zshrc
    >echo 'alias msfupdate="/usr/local/share/metasploit-framework && ./msfupdate && cd -"' >> ~/.zshrc
    >echo 'alias msfvenom="/usr/local/share/metasploit-framework && ./msfvenom && cd -"' >> ~/.zshrc
    >sudo chmod go+w /etc/profile
    >sudo echo export MSF_DATABASE_CONFIG=/usr/local/share/metasploit-framework/config/database.yml >> /etc/profile
    >cd /usr/local/share/metasploit-framework
  3. @xl7dev xl7dev created this gist Jan 5, 2016.
    75 changes: 75 additions & 0 deletions Install Metasploit on OS X
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,75 @@
    # XCode Command Line Tools

    >xcode-select --install

    # Install Homebrew

    >ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    >echo PATH=/usr/local/bin:/usr/local/sbin:$PATH >> ~/.bash_profile
    >source ~/.bash_profile
    >brew tap homebrew/versions

    # Install nmap

    >brew install nmap

    # Install libxml2

    >brew install libxml2

    # Install PostgreSQL

    >brew install postgresql --without-ossp-uuid

    # ruby 2.1.X

    >brew install homebrew/versions/ruby21


    # Initialize the database

    >initdb /usr/local/var/postgres
    >mkdir -p ~/Library/LaunchAgents
    >cp /usr/local/Cellar/postgresql/9.4.0/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
    >launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
    >echo "alias pg_start='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'"
    >echo "alias pg_stop='pg_ctl -D /usr/local/var/postgres stop'"

    # Create the db for the metasploit framework

    >createuser msf -P -h localhost
    >createdb -O msf msf -h localhost

    # Clone the Git Metasploit

    >git clone https://github.com/rapid7/metasploit-framework.git /usr/local/share/metasploit-framework

    # settings Env

    >echo 'alias msfconsole="pushd /usr/local/share/metasploit-framework && ./msfconsole && popd"' >> ~/.zshrc
    >sudo chmod go+w /etc/profile
    >sudo echo export MSF_DATABASE_CONFIG=/usr/local/share/metasploit-framework/config/database.yml >> /etc/profile
    >cd /usr/local/share/metasploit-framework
    >bundle install

    # Create the Database Configuration

    >vim /usr/local/share/metasploit-framework/config/database.yml
    Paste the following text:

    production:
    adapter: postgresql
    database: msf
    username: msf
    password: <your password>
    host: 127.0.0.1
    port: 5432
    pool: 75
    timeout: 5

    # update your environment

    >source /etc/profile
    >source ~/.bash_profile

    > msfconsole