Skip to content

Instantly share code, notes, and snippets.

@kamilhism
Forked from markpundsack/heroku-CVE-2013-0156.rb
Created January 11, 2013 08:52
Show Gist options
  • Select an option

  • Save kamilhism/4509057 to your computer and use it in GitHub Desktop.

Select an option

Save kamilhism/4509057 to your computer and use it in GitHub Desktop.

Revisions

  1. Mark Pundsack revised this gist Jan 11, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion heroku-CVE-2013-0156.rb
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    ## The quick-and-nasty CVE-2013-0156 Heroku inspector!
    ## Brought to you by @elliottkember.
    ## Originally brought to you by @elliottkember with changes by @markpundsack @ Heroku
    ## Download and run using:
    ## ruby heroku-CVE-2013-0156.rb

  2. Mark Pundsack revised this gist Jan 11, 2013. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion heroku-CVE-2013-0156.rb
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    ## The quick-and-nasty CVE-2013-0156 Heroku inspector!
    ## Brought to you by @elliottkember.
    ## Run this in an empty directory for best results.
    ## Download and run using:
    ## ruby heroku-CVE-2013-0156.rb

    `heroku list`.split("\n").each do |app|
    app = app.strip
  3. Mark Pundsack revised this gist Jan 10, 2013. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion heroku-CVE-2013-0156.rb
    Original file line number Diff line number Diff line change
    @@ -16,8 +16,9 @@

    rails_path = `heroku run bundle show rails --app #{app}`.split("\n")[-1]
    rails_version_number = rails_path.split("rails-")[1]
    rails_version_number = rails_version_number.strip unless rails_version_number.nil?

    unless ["3.2.11", "3.1.10", "3.0.19", "2.3.15"].include?(rails_version_number) or rails_version_number == ""
    unless ["3.2.11", "3.1.10", "3.0.19", "2.3.15"].include?(rails_version_number) or rails_version_number.nil?
    puts "Uh oh! #{app} has #{rails_version_number}."
    else
    puts "..."
  4. @elliottkember elliottkember revised this gist Jan 9, 2013. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions heroku-CVE-2013-0156.rb
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    ## The quick-and-nasty CVE-2013-0156 Heroku inspector!
    ## Brought to you by @elliottkember.
    ## Run this in an empty directory for best results.

    `heroku list`.split("\n").each do |app|
    app = app.strip

  5. @elliottkember elliottkember revised this gist Jan 9, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion heroku-CVE-2013-0156.rb
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@
    rails_version_number = rails_path.split("rails-")[1]

    unless ["3.2.11", "3.1.10", "3.0.19", "2.3.15"].include?(rails_version_number) or rails_version_number == ""
    puts "Uh oh! #{app_name} has #{rails_version_number}."
    puts "Uh oh! #{app} has #{rails_version_number}."
    else
    puts "..."
    end
  6. @elliottkember elliottkember revised this gist Jan 9, 2013. 1 changed file with 9 additions and 15 deletions.
    24 changes: 9 additions & 15 deletions heroku-CVE-2013-0156.rb
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,3 @@
    ## The quick-and-nasty CVE-2013-0156 Heroku inspector!
    ## Brought to you by @elliottkember.
    ## Run this in an empty directory for best results.

    `heroku list`.split("\n").each do |app|
    app = app.strip

    @@ -14,15 +10,13 @@
    # Blank lines can be ommitted.
    next if app == ""

    puts ""
    puts "Cloning #{app}..."
    `git clone -q --depth=1 git@heroku.com:#{app}.git`
    end

    Dir.glob("*").each do |app_name|
    version = `cat #{app_name}/Gemfile.lock |grep " rails (="`.strip
    version = version.split(" (= ")[1].to_s.gsub(")", "").gsub("\n", "")
    unless ["3.2.11", "3.1.10", "3.0.19", "2.3.15"].include?(version) or version == ""
    puts "Uh oh! #{app_name} has #{version}."
    rails_path = `heroku run bundle show rails --app #{app}`.split("\n")[-1]
    rails_version_number = rails_path.split("rails-")[1]

    unless ["3.2.11", "3.1.10", "3.0.19", "2.3.15"].include?(rails_version_number) or rails_version_number == ""
    puts "Uh oh! #{app_name} has #{rails_version_number}."
    else
    puts "..."
    end
    end

    end
  7. @elliottkember elliottkember revised this gist Jan 9, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion heroku-CVE-2013-0156.rb
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@

    puts ""
    puts "Cloning #{app}..."
    `git clone --depth=1 git@heroku.com:#{app}.git`
    `git clone -q --depth=1 git@heroku.com:#{app}.git`
    end

    Dir.glob("*").each do |app_name|
  8. @elliottkember elliottkember revised this gist Jan 9, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions heroku-CVE-2013-0156.rb
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,8 @@
    # Blank lines can be ommitted.
    next if app == ""

    puts ""
    puts "Cloning #{app}..."
    `git clone --depth=1 git@heroku.com:#{app}.git`
    end

  9. @elliottkember elliottkember created this gist Jan 9, 2013.
    26 changes: 26 additions & 0 deletions heroku-CVE-2013-0156.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    ## The quick-and-nasty CVE-2013-0156 Heroku inspector!
    ## Brought to you by @elliottkember.
    ## Run this in an empty directory for best results.

    `heroku list`.split("\n").each do |app|
    app = app.strip

    # Some "heroku apps" lines have === formatting for grouping. They're not apps.
    next if app[0..2] == "==="

    # Some are appended by owner emails
    app = app.split(" ")[0].to_s.strip

    # Blank lines can be ommitted.
    next if app == ""

    `git clone --depth=1 git@heroku.com:#{app}.git`
    end

    Dir.glob("*").each do |app_name|
    version = `cat #{app_name}/Gemfile.lock |grep " rails (="`.strip
    version = version.split(" (= ")[1].to_s.gsub(")", "").gsub("\n", "")
    unless ["3.2.11", "3.1.10", "3.0.19", "2.3.15"].include?(version) or version == ""
    puts "Uh oh! #{app_name} has #{version}."
    end
    end