<commit_before>class Metasploit < Formula
  desc "The Metasploit Framework"
  homepage 'http://www.metasploit.com/framework/'
  head "https://github.com/rapid7/metasploit-framework.git"

  stable do
    url "http://downloads.metasploit.com/data/releases/framework-4.11.4-2015102801.tar.bz2"
    sha1 'b12991d879d7eb664ffd8f72e4fa11611f10a07d'
  end

  # Resources


  # Add the depends on


  def install
    libexec.install Dir["msf*",
                        'config',
                        'data',
                        'db',
                        'documentation',
                        'external',
                        'features',
                        'lib',
                        'modules',
                        'plugins',
                        'script',
                        'scripts',
                        'spec',
                        'test',
                        'tools']
    bin.mkpath
    Dir["#{libexec}/msf*"].each {|f| ln_s f, bin}
  end

  def caveats; <<-EOS.undent
    Metasploit can be updated in-place by doing:
      cd `brew --prefix metasploit`/libexec/
      svn up
    EOS
  end
end<commit_msg>A working version of the metasploit formula<commit_after>class Metasploit < Formula
  desc "The Metasploit Framework"
  homepage 'http://www.metasploit.com/framework/'
  head "https://github.com/rapid7/metasploit-framework.git"

  stable do
    url "http://downloads.metasploit.com/data/releases/archive/framework-4.11.3-2015070901.tar.bz2"
    sha1 'd9ce2ed088967a4b5e1f957aa09cc70cf60bf01a'
  end

  # Resources


  # Add the depends on
  # NOTE: Cant use the system ruby as then we cant install gems!
  depends_on "libxml2"
  depends_on "postgresql"
  depends_on "ruby"

  def install
    # NOTE: Maybe we should use brew gem and manually list all the gems we need?
    # Install the bundle gem if it is not installed
#    if which("bundle").to_s != "#{HOMEBREW_PREFIX}/bin/bundle"
      system "gem", "install", "bundler"
#    end

    # Lazily get bundle to install the gems using bundle
    system "#{HOMEBREW_PREFIX}/bin/bundle", "install"

    # Install the metasploit framework
    libexec.install Dir["*"]
    bin.mkpath
    Dir["#{libexec}/msf*"].each {|f| ln_s f, bin}
  end

  def caveats;<<-EOS.undent
    This installation does not create the metasploit database, this must be done manually.
      1. Initialise the database:
        initdb /usr/local/var/postgres

      2. (Optional) To have launchd start postgresql at login:
        ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
      Then to load postgresql now:
        launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
      Or, if you don't want/need launchctl, you can just run:
        postgres -D /usr/local/var/postgres

      3. Create the user and database for the metasploit framework
        createuser msf -P -h localhost
        createdb -O msf msf -h localhost

      4. Create a file '' with the following:
        # Development Database
        development: &pgsql
          adapter: postgresql
          database: msf
          username: msf
          password: <PASSWORD>
          host: localhost
          port: 5432
          pool: 5
          timeout: 5

        # Production database -- same as dev
        production: &production
          <<: *pgsql
    EOS
  end
end
{'fraction_non_alphanumeric': 0.09432835820895523, 'fraction_numerical': 0.02746268656716418, 'mean_word_length': 1.9681133746678476, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2809040', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1023, 'n_words': 286}