Skip to content
Browse files

Merge pull request #1380 from todb-r7/feature/mailmap_and_commit_count

Godspeed, friends.
  • Loading branch information...
2 parents 47ea8ae + c87a60f commit 5af14c4153621f73627ee0b9d92a2f71e3e6fb56 @trosen-r7 trosen-r7 committed Mar 21, 2013
Showing with 249 additions and 0 deletions.
  1. +66 −0 .mailmap
  2. +70 −0 tools/committer_count.rb
  3. +64 −0 tools/module_commits.rb
  4. +49 −0 tools/module_count.rb
View
66 .mailmap
@@ -0,0 +1,66 @@
+wchen-r7 <wchen-r7@github> sinn3r <msfsinn3r@gmail.com> # aka sinn3r
+wchen-r7 <wchen-r7@github> Wei Chen <Wei_Chen@rapid7.com>
+wchen-r7 <wchen-r7@github> sinn3r <wei_chen@rapid7.com>
+todb-r7 <todb-r7@github> Tod Beardsley <todb@metasploit.com>
+jvazquez-r7 <jvazquez-r7@github> jvazquez-r7 <juan.vazquez@metasploit.com>
+hmoore-r7 <hmoore-r7@github> HD Moore <hd_moore@rapid7.com>
+hmoore-r7 <hmoore-r7@github> HD Moore <hdm@digitaloffense.net>
+jlee-r7 <jlee-r7@github> James Lee <egypt@metasploit.com> # aka egypt
+jlee-r7 <jlee-r7@github> James Lee <James_Lee@rapid7.com>
+dmaloney-r7 <dmaloney-r7@github> David Maloney <DMaloney@rapid7.com> # aka TheLightCosine
+dmaloney-r7 <dmaloney-r7@github> David Maloney <David_Maloney@rapid7.com>
+joev-r7 <joev-r7@github> Joe Vennix <Joe_Vennix@rapid7.com>
+bturner-r7 <bturner-r7@github> Brandon Turner <brandon_turner@rapid7.com>
+ecarey-r7 <ecarey-r7@github> Erran Carey <e@ipwnstuff.com>
+limhoff-r7 <limhoff-r7@github> Luke Imhoff <luke_imhoff@rapid7.com>
+todb-r7 <todb-r7@github> Tod Beardsley <tod_beardsley@rapid7.com>
+tasos-r7 <tasos-r7@github> Tasos Laskos <Tasos_Laskos@rapid7.com>
+shuckins-r7 <shuckins-r7@github> Samuel Huckins <samuel_huckins@rapid7.com>
+bperry-r7 <bperry-r7@github> Brandon Perry <bperry@bperry-rapid7.(none)>
+bperry-r7 <bperry-r7@github> Brandon Perry <bperry.volatile@gmail.com>
+
+# Above this line are current Rapid7 employees Below this paragraph are
+# volunteers, former employees, and potential Rapid7 employees who, at
+# one time or another, had some largeish number of commits landed on
+# rapid7/metasploit-framework master branch. This should be refreshed
+# periodically. If you're on this list and would like to not be, just
+# let todb@metasploit.com know.
+
+Meatballs1 <Meatballs1@github> Meatballs <eat_meatballs@hotmail.co.uk>
+Meatballs1 <Meatballs1@github> Meatballs1 <eat_meatballs@hotmail.co.uk>
+Meatballs1 <Meatballs1@github> Meatballs1 <campbell_ab@hotmail.com>
+jduck <jduck@github> Joshua Drake <github.jdrake@qoop.org>
+jcran <jcran@github> Jonathan Cran <jcran@rapid7.com>
+jcran <jcran@github> Jonathan Cran <jcran@0x0e.org>
+bannedit <bannedit@github> David Rude <bannedit0@gmail.com>
+darkoperator <darkoperator@github> Carlos Perez <carlos_perez@darkoperator.com>
+scriptjunkie <scriptjunkie@github> Matt Weeks <scriptjunkie@scriptjunkie.us>
+skape <skape@???> Matt Miller <mmiller@hick.org>
+ceballosm <ceballosm@github> Mario Ceballos <mc@metasploit.com>
+swtornio <swtornio@github> Steve Tornio <swtornio@gmail.com>
+kris <kris@???> kris <>
+spoonm <spoonm@github> Spoon M <spoonm@gmail.com>
+fab <fab@???> fab <> # fab at revhosts.net (Fabrice MOURRON)
+efraintorres <efraintorres@github> efraintorres <etlownoise@gmail.com>
+efraintorres <efraintorres@github> et <>
+r3dy <r3dy@github> Royce Davis <r3dy@Royces-MacBook-Pro.local>
+r3dy <r3dy@github> Royce Davis <royce.e.davis@gmail.com>
+mubix <mubix@github> Rob Fuller <jd.mubix@gmail.com>
+nmonkee <nmonkee@github> nmonkee <dave@northern-monkee.co.uk>
+rsmudge <rsmudge@github> Raphael Mudge <rsmudge@gmail.com> # Aka `butane
+m-1-k-3 <m-1-k-3@github> m-1-k-3 <michael.messner@integralis.com>
+kost <kost@github> Vlatko Kosturjak <kost@linux.hr>
+ohdae <ohdae@github> ohdae <bindshell@live.com>
+schierlm <schierlm@github> Michael Schierl <schierlm@gmx.de> # Aka mihi
+corelanc0d3er <corelanc0d3er@github> Peter Van Eeckhoutte (corelanc0d3r) <peter.ve@corelan.be>
+corelanc0d3er <corelanc0d3er@github> corelanc0d3r <peter.ve@corelan.be>
+kernelsmith <kernelsmith@github> Joshua Smith <kernelsmith@kernelsmith.com>
+kernelsmith <kernelsmith@github> kernelsmith <kernelsmith@kernelsmith>
+h0ng10 <h0ng10@github> h0ng10 <hansmartin.muench@googlemail.com>
+h0ng10 <h0ng10@github> Hans-Martin Münch <hansmartin.muench@googlemail.com>
+nullbind <nullbind@github> nullbind <scott.sutherland@nullbind.com>
+nevdull77 <nevdull77@github> Patrik Karlsson <patrik@cqure.net>
+jgor <jgor@github> jgor <jgor@indiecom.org>
+ChrisJohnRiley <ChrisJohnRiley@github> Chris John Riley <chris.riley@c22.cc>
+ChrisJohnRiley <ChrisJohnRiley@github> Chris John Riley <reg@c22.cc>
+FireFart <FireFart@github> Christian Mehlmauer <firefart@gmail.com>
View
70 tools/committer_count.rb
@@ -0,0 +1,70 @@
+#!/usr/bin/env ruby
+
+# The committer_count.rb is a way to tell who's been active over the last
+# given period. It's of course, quite coarse -- someone with 10 commits in a day
+# may or may not be more productive than someone with 3, but over long enough
+# periods, it's an okay metric to measure involvement with the project, since
+# large and small commits will tend to average out.
+#
+# Note that this includes merge commits by default (which usually means at least
+# code review happened, so it's still a measure of work). You can get different
+# stats by ignoring merge commits, once option parsing is implemented.
+#
+# Usage: ./committer_count.rb 2011-01-01 | head -10 # Since a particular date
+# ./committer_count.rb 1y | head -10 # Last year
+# ./committer_count.rb 6m | head -10 # Last six months
+# ./committer_count.rb 12w | head -10 # Last twelve weeks
+# ./committer_count.rb 100d | head -10 # Last hundred days
+#
+#
+# History with colors and e-mail addresses (respecting .mailmap):
+# git log --pretty=format:"%C(white)%ad %C(yellow)%h %Cblue'%aN' <%aE> %Cgreen%f%Creset" --date=short
+
+class GitLogLine < Struct.new(:date, :hash, :author, :message)
+end
+
+@history = `git log --pretty=format:"%ad %h '%aN' %f" --date=short --date-order`
+@recent_history = []
+@commits_by_author = {}
+
+def parse_date(date)
+ case date
+ when /([0-9]+)y(ear)?s?/
+ seconds = $1.to_i* (60*60*24*365.25)
+ calc_date = (Time.now - seconds).strftime("%Y-%m-%d")
+ when /([0-9]+)m(onth)?s?/
+ seconds = $1.to_i* (60*60*24*(365.25 / 12))
+ calc_date = (Time.now - seconds).strftime("%Y-%m-%d")
+ when /([0-9]+)w(eek)?s?/
+ seconds = $1.to_i* (60*60*24*7)
+ calc_date = (Time.now - seconds).strftime("%Y-%m-%d")
+ when /([0-9]+)d(ay)?s?/
+ seconds = $1.to_i* (60*60*24)
+ calc_date = (Time.now - seconds).strftime("%Y-%m-%d")
+ else
+ calc_date = Time.new(date).strftime("%Y-%m-%d")
+ end
+end
+
+date = ARGV[0] || "2005-03-22" # A day before the first SVN commit.
+calc_date = parse_date(date)
+
+@history.each_line do |line|
+ parsed_line = line.match(/^([^\s+]+)\s(.{7,})\s'(.*)'\s(.*)[\r\n]*$/)
+ next unless parsed_line
+ break if calc_date == parsed_line[1]
+ @recent_history << GitLogLine.new(*parsed_line[1,4])
+end
+
+@recent_history.each do |logline|
+ @commits_by_author[logline.author] ||= []
+ @commits_by_author[logline.author] << logline.message
+end
+
+puts "Commits since #{calc_date}"
+puts "-" * 50
+
+@commits_by_author.sort_by {|k,v| v.size}.reverse.each do |k,v|
+ puts "%-25s %3d" % [k,v.size]
+end
+
View
64 tools/module_commits.rb
@@ -0,0 +1,64 @@
+#!/usr/bin/env ruby
+
+# Check the commit history of a module or tree of modules.
+# and sort by number of commits.
+#
+# Usage: tools/module_commits.rb [module dir | module fname]
+
+require 'find'
+
+class GitLogLine < Struct.new(:date, :hash, :author, :message)
+end
+
+class CommitHistory < Struct.new(:fname, :total, :authors)
+end
+
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
+dir = ARGV[0] || File.join(msfbase, "modules", "exploits")
+raise ArgumentError, "Need a filename or directory" unless (dir and File.readable? dir)
+
+def check_commit_history(fname)
+
+ git_cmd = `git log --pretty=format:"%ad %h '%aN' %f" --date=short --date-order #{fname}`
+ commit_history = []
+ commits_by_author = {}
+
+ git_cmd.each_line do |line|
+ parsed_line = line.match(/^([^\s+]+)\s(.{7,})\s'(.*)'\s(.*)[\r\n]*$/)
+ commit_history << GitLogLine.new(*parsed_line[1,4])
+ end
+
+ commit_history.each do |logline|
+ commits_by_author[logline.author] ||= []
+ commits_by_author[logline.author] << logline.message
+ end
+
+ puts "Commits for #{fname} #{commit_history.size}"
+ puts "-" * 72
+
+ commits_by_author.sort_by {|k,v| v.size}.reverse.each do |k,v|
+ puts "%-25s %3d" % [k,v.size]
+ end
+
+ this_module = CommitHistory.new(fname,commit_history.size,commits_by_author)
+ return this_module
+
+end
+
+@module_stats = []
+
+Find.find(dir) do |fname|
+ next unless fname =~ /rb$/
+ @module_stats << check_commit_history(fname)
+end
+
+puts "=" * 72
+puts "Sorted modules by commit counts"
+
+@module_stats.sort_by {|m| m.total }.reverse.each do |m|
+ puts "%-60s %d" % [m.fname, m.total]
+end
View
49 tools/module_count.rb
@@ -0,0 +1,49 @@
+#!/usr/bin/env ruby
+
+# Lists the current count of modules, by type, and outputs a bare CSV.
+
+msfbase = __FILE__
+while File.symlink?(msfbase)
+ msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
+end
+
+$:.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', 'lib')))
+require 'fastlib'
+require 'msfenv'
+
+$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
+
+require 'rex'
+require 'msf/ui'
+require 'msf/base'
+
+# Always disable the database (we never need it just to list module
+# information).
+framework_opts = { 'DisableDatabase' => true }
+
+# Initialize the simplified framework instance.
+$framework = Msf::Simple::Framework.create(framework_opts)
+Indent = ' '
+
+i = 0
+module_types = {
+ :exploit => 0,
+ :auxiliary => 0,
+ :post => 0,
+ :payload => 0,
+ :encoder => 0,
+ :nop => 0
+}
+
+$framework.modules.each do |name, mod|
+ this_mod = mod.new
+ [:exploit, :auxiliary, :post, :payload, :encoder, :nop].each do |meth|
+ interrogative = "#{meth}?".intern
+ if this_mod.send(interrogative)
+ module_types[meth] += 1
+ end
+ end
+end
+
+puts module_types.keys.map {|k| k.to_s}.join(",")
+puts module_types.values.join(",")

0 comments on commit 5af14c4

Please sign in to comment.
Something went wrong with that request. Please try again.