Skip to content

Commit 40fd695

Browse files
committed
Adds a few metrics-based tools and a mailmap
This merge adds four new tools: * .mailmap : allows for easier identification of committers * tools/module_count.rb : Spits out a current count of modules * tools/module_commits.rb: Spits out who commited to a module * tools/committer_counts.rb : Spits out commiters by commit counts This was part of a long-running feature branch, which is why it's now bundled up in one big squash merge. Squashed commit of the following: commit de201ff6a5b304d0fedec56d9f1930abf1a10d9e Author: Tod Beardsley <[email protected]> Date: Thu Jan 24 14:48:24 2013 -0600 Rename from scorecard to merely a count commit 8028cf838b0b560831602e3163e92d0751a4c0a9 Author: Tod Beardsley <[email protected]> Date: Thu Jan 24 14:36:42 2013 -0600 Some final comment docs commit a69fd78 Merge: e288f13 3faf4b3 Author: Tod Beardsley <[email protected]> Date: Thu Jan 24 13:21:14 2013 -0600 Merge branch 'master' into committer-scorecard I think these conflicts came from a move or a rename or something. Conflicts: external/source/exploits/cve-2012-5076_2/Makefile external/source/exploits/cve-2012-5088/Makefile modules/exploits/multi/browser/java_jre17_method_handle.rb modules/exploits/multi/http/jenkins_script_console.rb commit e288f13 Author: Tod Beardsley <[email protected]> Date: Wed Jan 16 14:06:23 2013 -0600 Add FireFart's mail alias commit 1b1792e Author: Tod Beardsley <[email protected]> Date: Fri Jan 18 22:41:44 2013 -0600 Fix grammar on description for webcam commit 276388f Author: Robin Wood <[email protected]> Date: Tue Jan 22 15:42:23 2013 +0000 added extra checking for strict databases commit a40ea3d Author: jvazquez-r7 <[email protected]> Date: Tue Jan 22 12:07:16 2013 +0100 fix data added to table commit 738d2fa Author: HD Moore <[email protected]> Date: Tue Jan 22 00:27:03 2013 -0600 Fix a stack overflow in bidirectional pipe commit aeec5a8 Author: jvazquez-r7 <[email protected]> Date: Mon Jan 21 12:26:35 2013 +0100 Cleanup for mysql_file_enum.rb commit 13f68f0 Author: sinn3r <[email protected]> Date: Mon Jan 21 00:30:43 2013 -0600 Updates the progress function Because the previous one was wrong. commit d971fe0 Author: Robin Wood <[email protected]> Date: Sun Jan 20 21:32:02 2013 +0000 Brute force directory and file names with MySQL commit a96ca2e Author: Robin Wood <[email protected]> Date: Sun Jan 20 00:13:42 2013 +0000 added a warning and using optpath commit aa98d85 Author: Robin Wood <[email protected]> Date: Sun Jan 20 00:12:38 2013 +0000 added a warning and using optpath commit 6dd5bb8 Author: Robin Wood <[email protected]> Date: Sun Jan 20 00:02:07 2013 +0000 stopped using fixed table name commit 520aeb9 Author: Robin Wood <[email protected]> Date: Sat Jan 19 23:41:38 2013 +0000 Fixed msftidy stuff commit cec6a06 Author: Robin Wood <[email protected]> Date: Sat Jan 19 22:48:00 2013 +0000 File/dir brute forcer using MySQL commit 3cc0f3f Author: jvazquez-r7 <[email protected]> Date: Sun Jan 20 19:54:24 2013 +0100 finally it doesn't use FileDropper atm commit 2670d5c Author: jvazquez-r7 <[email protected]> Date: Sun Jan 20 17:38:37 2013 +0100 references and date updated commit 1230d52 Author: bcoles <[email protected]> Date: Mon Jan 21 02:12:42 2013 +1030 update php_charts_exec metadata commit cf37c59 Author: bcoles <[email protected]> Date: Mon Jan 21 02:10:48 2013 +1030 move and update php_charts_exec metadata commit 1e86429 Author: bcoles <[email protected]> Date: Sun Jan 20 23:51:17 2013 +1030 Add PHP-Charts v1.0 PHP Code Execution Exploit commit fe60ee6 Author: jvazquez-r7 <[email protected]> Date: Sun Jan 20 13:42:02 2013 +0100 linux stager plus little cleanup commit 5900248 Author: Spencer McIntyre <[email protected]> Date: Sat Jan 19 19:10:56 2013 -0500 use target_uri and normalize_uri as well as fix a cookie problem commit a7ce0a5 Author: Spencer McIntyre <[email protected]> Date: Fri Jan 18 14:56:52 2013 -0500 add module to execute commands via Jenkins Script Console commit 33b8aa4 Author: jvazquez-r7 <[email protected]> Date: Fri Jan 18 18:42:27 2013 +0100 title updated commit 63fe457 Author: Charles Smith <[email protected]> Date: Thu Jan 17 16:52:02 2013 -0500 Fixed loot formatting so data is under the proper column The credentials table was defined with the columns "User", "Password", "Host", "Port", and "SSL". Credentials were not added in that order, however. They were added in the order "host, port, user, password, ssl" in this line: credentials << [cred['host'], cred['port'], cred['user'], cred['password'], cred['ssl']] I changed the order the columns were defined to fix this. The permissions table had a similar issue. The "FileWrite" column was missing, so I added it. I also moved the "Home" column to after the "AutoCreate" column. Now the line: permissions << [perm['host'], perm['user'], perm['dir'], perm['fileread'], perm['filewrite'], perm['filedelete'], perm['fileappend'],perm['dircreate'], perm['dirdelete'], perm['dirlist'], perm['dirsubdirs'], perm['autocreate']] works correctly. commit b948559 Author: jvazquez-r7 <[email protected]> Date: Thu Jan 17 21:45:13 2013 +0100 cleanup commit 199ab00 Author: jvazquez-r7 <[email protected]> Date: Thu Jan 17 21:39:41 2013 +0100 cleanup commit 8d55044 Author: jvazquez-r7 <[email protected]> Date: Thu Jan 17 21:27:47 2013 +0100 Added new module for cve-2012-5076 commit 31ae18f Author: jvazquez-r7 <[email protected]> Date: Thu Jan 17 21:14:49 2013 +0100 Added module for CVE-2012-5088 commit 6ac99f3 Author: Tod Beardsley <[email protected]> Date: Sat Jan 19 09:08:31 2013 -0600 Add a quick comment doc commit 0c18f1c Author: Tod Beardsley <[email protected]> Date: Sat Jan 19 09:06:34 2013 -0600 Adds a per-module commit counter. commit 44fa228 Merge: fa288ff 9f42abd Author: Tod Beardsley <[email protected]> Date: Sat Jan 19 08:30:37 2013 -0600 Merge remote-tracking branch 'origin/master' into committer-scorecard commit fa288ff Author: Tod Beardsley <[email protected]> Date: Fri Jan 18 14:05:47 2013 -0600 Make module_count execable commit 6c1625e Author: Tod Beardsley <[email protected]> Date: Tue Jan 8 09:56:48 2013 -0600 Wrote a quick module counter, by type commit af07ddc Merge: 2ee5df8 2c3ccb5 Author: Tod Beardsley <[email protected]> Date: Tue Jan 8 09:35:28 2013 -0600 Merge remote-tracking branch 'origin/master' into committer-scorecard commit 2ee5df8 Merge: 501c678 b50e040 Author: Tod Beardsley <[email protected]> Date: Fri Jan 4 10:24:27 2013 -0600 Merge remote-tracking branch 'origin/master' into committer-scorecard commit 501c678 Merge: 8001401 c2586d0 Author: Tod Beardsley <[email protected]> Date: Thu Dec 27 15:42:25 2012 -0600 Merge branch 'master' into committer-scorecard commit 8001401 Author: Tod Beardsley <[email protected]> Date: Thu Dec 27 11:13:04 2012 -0600 Adding shuckins and cjr to the mailmap commit ab2db49 Merge: 8b6ecb3 daf5465 Author: Tod Beardsley <[email protected]> Date: Thu Dec 27 10:29:19 2012 -0600 Merge remote branch 'origin/master' into committer-scorecard commit 8b6ecb3 Author: Tod Beardsley <[email protected]> Date: Mon Dec 17 21:58:37 2012 -0600 Comment docs on .mailmap commit 8e245a0 Author: Tod Beardsley <[email protected]> Date: Mon Dec 17 21:56:06 2012 -0600 Another alias for h0ng10 commit aff6169 Author: Tod Beardsley <[email protected]> Date: Mon Dec 17 17:02:35 2012 -0600 A more useful committer score card Now with aliases for anyone who hit the top 20 list of the last year, six months, and twelve weeks. Still needs some optparsey niceities, but it's good enough for an intial push to GitHub. commit bd4e00e Author: Tod Beardsley <[email protected]> Date: Mon Dec 17 15:22:33 2012 -0600 Initial commit of a git commit scorecard
1 parent fbbac2b commit 40fd695

File tree

4 files changed

+246
-0
lines changed

4 files changed

+246
-0
lines changed

.mailmap

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
wchen-r7 <wchen-r7@github> sinn3r <[email protected]> # aka sinn3r
2+
wchen-r7 <wchen-r7@github> Wei Chen <[email protected]>
3+
wchen-r7 <wchen-r7@github> sinn3r <[email protected]>
4+
todb-r7 <todb-r7@github> Tod Beardsley <[email protected]>
5+
jvazquez-r7 <jvazquez-r7@github> jvazquez-r7 <[email protected]>
6+
hmoore-r7 <hmoore-r7@github> HD Moore <[email protected]>
7+
jlee-r7 <jlee-r7@github> James Lee <[email protected]> # aka egypt
8+
jlee-r7 <jlee-r7@github> James Lee <[email protected]>
9+
dmaloney-r7 <dmaloney-r7@github> David Maloney <[email protected]> # aka TheLightCosine
10+
dmaloney-r7 <dmaloney-r7@github> David Maloney <[email protected]>
11+
joev-r7 <joev-r7@github> Joe Vennix <[email protected]>
12+
bturner-r7 <bturner-r7@github> Brandon Turner <[email protected]>
13+
ecarey-r7 <ecarey-r7@github> Erran Carey <[email protected]>
14+
limhoff-r7 <limhoff-r7@github> Luke Imhoff <[email protected]>
15+
todb-r7 <todb-r7@github> Tod Beardsley <[email protected]>
16+
tasos-r7 <tasos-r7@github> Tasos Laskos <[email protected]>
17+
shuckins-r7 <shuckins-r7@github> Samuel Huckins <[email protected]>
18+
19+
# Above this line are current Rapid7 employees Below this paragraph are
20+
# volunteers, former employees, and potential Rapid7 employees who, at
21+
# one time or another, had some largeish number of commits landed on
22+
# rapid7/metasploit-framework master branch. This should be refreshed
23+
# periodically. If you're on this list and would like to not be, just
24+
# let [email protected] know.
25+
26+
Meatballs1 <Meatballs1@github> Meatballs <[email protected]>
27+
Meatballs1 <Meatballs1@github> Meatballs1 <[email protected]>
28+
Meatballs1 <Meatballs1@github> Meatballs1 <[email protected]>
29+
jduck <jduck@github> Joshua Drake <[email protected]>
30+
jcran <jcran@github> Jonathan Cran <[email protected]>
31+
jcran <jcran@github> Jonathan Cran <[email protected]>
32+
bannedit <bannedit@github> David Rude <[email protected]>
33+
darkoperator <darkoperator@github> Carlos Perez <[email protected]>
34+
scriptjunkie <scriptjunkie@github> Matt Weeks <[email protected]>
35+
skape <skape@???> Matt Miller <[email protected]>
36+
ceballosm <ceballosm@github> Mario Ceballos <[email protected]>
37+
swtornio <swtornio@github> Steve Tornio <[email protected]>
38+
kris <kris@???> kris <>
39+
spoonm <spoonm@github> Spoon M <[email protected]>
40+
fab <fab@???> fab <> # fab at revhosts.net (Fabrice MOURRON)
41+
efraintorres <efraintorres@github> efraintorres <[email protected]>
42+
efraintorres <efraintorres@github> et <>
43+
r3dy <r3dy@github> Royce Davis <[email protected]>
44+
r3dy <r3dy@github> Royce Davis <[email protected]>
45+
mubix <mubix@github> Rob Fuller <[email protected]>
46+
nmonkee <nmonkee@github> nmonkee <[email protected]>
47+
rsmudge <rsmudge@github> Raphael Mudge <[email protected]> # Aka `butane
48+
m-1-k-3 <m-1-k-3@github> m-1-k-3 <[email protected]>
49+
kost <kost@github> Vlatko Kosturjak <[email protected]>
50+
ohdae <ohdae@github> ohdae <[email protected]>
51+
schierlm <schierlm@github> Michael Schierl <[email protected]> # Aka mihi
52+
corelanc0d3er <corelanc0d3er@github> Peter Van Eeckhoutte (corelanc0d3r) <[email protected]>
53+
corelanc0d3er <corelanc0d3er@github> corelanc0d3r <[email protected]>
54+
kernelsmith <kernelsmith@github> Joshua Smith <[email protected]>
55+
kernelsmith <kernelsmith@github> kernelsmith <kernelsmith@kernelsmith>
56+
h0ng10 <h0ng10@github> h0ng10 <[email protected]>
57+
h0ng10 <h0ng10@github> Hans-Martin Münch <[email protected]>
58+
nullbind <nullbind@github> nullbind <[email protected]>
59+
nevdull77 <nevdull77@github> Patrik Karlsson <[email protected]>
60+
jgor <jgor@github> jgor <[email protected]>
61+
ChrisJohnRiley <ChrisJohnRiley@github> Chris John Riley <[email protected]>
62+
ChrisJohnRiley <ChrisJohnRiley@github> Chris John Riley <[email protected]>
63+
FireFart <FireFart@github> Christian Mehlmauer <[email protected]>

tools/committer_count.rb

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env ruby
2+
3+
# The commit_scorecard is a way to tell who's been active over the last
4+
# given period. It's of course, quite coarse -- someone with 10 commits in a day
5+
# may or may not be more productive than someone with 3, but over long enough
6+
# periods, it's an okay metric to measure involvement with the project, since
7+
# large and small commits will tend to average out.
8+
#
9+
# Note that this includes merge commits by default (which usually means at least
10+
# code review happened, so it's still a measure of work). You can get different
11+
# stats by ignoring merge commits, once option parsing is implemented.
12+
#
13+
# Usage: ./commit_scorecard.rb 2011-01-01 | head -10 # Since a particular date
14+
# ./commit_scorecard.rb 1y | head -10 # Last year
15+
# ./commit_scorecard.rb 6m | head -10 # Last six months
16+
# ./commit_scorecard.rb 12w | head -10 # Last twelve weeks
17+
# ./commit_scorecard.rb 100d | head -10 # Last hundred days
18+
#
19+
#
20+
# History with colors and e-mail addresses (respecting .mailmap):
21+
# git log --pretty=format:"%C(white)%ad %C(yellow)%h %Cblue'%aN' <%aE> %Cgreen%f%Creset" --date=short
22+
23+
class GitLogLine < Struct.new(:date, :hash, :author, :message)
24+
end
25+
26+
@history = `git log --pretty=format:"%ad %h '%aN' %f" --date=short --date-order`
27+
@recent_history = []
28+
@commits_by_author = {}
29+
30+
def parse_date(date)
31+
case date
32+
when /([0-9]+)y(ear)?s?/
33+
seconds = $1.to_i* (60*60*24*365.25)
34+
calc_date = (Time.now - seconds).strftime("%Y-%m-%d")
35+
when /([0-9]+)m(onth)?s?/
36+
seconds = $1.to_i* (60*60*24*(365.25 / 12))
37+
calc_date = (Time.now - seconds).strftime("%Y-%m-%d")
38+
when /([0-9]+)w(eek)?s?/
39+
seconds = $1.to_i* (60*60*24*7)
40+
calc_date = (Time.now - seconds).strftime("%Y-%m-%d")
41+
when /([0-9]+)d(ay)?s?/
42+
seconds = $1.to_i* (60*60*24)
43+
calc_date = (Time.now - seconds).strftime("%Y-%m-%d")
44+
else
45+
calc_date = Time.new(date).strftime("%Y-%m-%d")
46+
end
47+
end
48+
49+
date = ARGV[0] || "2005-03-22" # A day before the first SVN commit.
50+
calc_date = parse_date(date)
51+
52+
53+
@history.each_line do |line|
54+
parsed_line = line.match(/^([^\s+]+)\s(.{7,})\s'(.*)'\s(.*)[\r\n]*$/)
55+
break if calc_date == parsed_line[1]
56+
@recent_history << GitLogLine.new(*parsed_line[1,4])
57+
end
58+
59+
@recent_history.each do |logline|
60+
@commits_by_author[logline.author] ||= []
61+
@commits_by_author[logline.author] << logline.message
62+
end
63+
64+
puts "Commits since #{calc_date}"
65+
puts "-" * 50
66+
67+
@commits_by_author.sort_by {|k,v| v.size}.reverse.each do |k,v|
68+
puts "%-25s %3d" % [k,v.size]
69+
end
70+

tools/module_commits.rb

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env ruby
2+
3+
# Check the commit history of a module or tree of modules.
4+
# and sort by number of commits.
5+
#
6+
# Usage: tools/module_commits.rb [module dir | module fname]
7+
8+
require 'find'
9+
10+
class GitLogLine < Struct.new(:date, :hash, :author, :message)
11+
end
12+
13+
class CommitHistory < Struct.new(:fname, :total, :authors)
14+
end
15+
16+
msfbase = __FILE__
17+
while File.symlink?(msfbase)
18+
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
19+
end
20+
21+
dir = ARGV[0] || File.join(msfbase, "modules", "exploits")
22+
raise ArgumentError, "Need a filename or directory" unless (dir and File.readable? dir)
23+
24+
def check_commit_history(fname)
25+
26+
git_cmd = `git log --pretty=format:"%ad %h '%aN' %f" --date=short --date-order #{fname}`
27+
commit_history = []
28+
commits_by_author = {}
29+
30+
git_cmd.each_line do |line|
31+
parsed_line = line.match(/^([^\s+]+)\s(.{7,})\s'(.*)'\s(.*)[\r\n]*$/)
32+
commit_history << GitLogLine.new(*parsed_line[1,4])
33+
end
34+
35+
commit_history.each do |logline|
36+
commits_by_author[logline.author] ||= []
37+
commits_by_author[logline.author] << logline.message
38+
end
39+
40+
puts "Commits for #{fname} #{commit_history.size}"
41+
puts "-" * 72
42+
43+
commits_by_author.sort_by {|k,v| v.size}.reverse.each do |k,v|
44+
puts "%-25s %3d" % [k,v.size]
45+
end
46+
47+
this_module = CommitHistory.new(fname,commit_history.size,commits_by_author)
48+
return this_module
49+
50+
end
51+
52+
@module_stats = []
53+
54+
Find.find(dir) do |fname|
55+
next unless fname =~ /rb$/
56+
@module_stats << check_commit_history(fname)
57+
end
58+
59+
puts "=" * 72
60+
puts "Sorted modules by commit counts"
61+
62+
@module_stats.sort_by {|m| m.total }.reverse.each do |m|
63+
puts "%-60s %d" % [m.fname, m.total]
64+
end

tools/module_count.rb

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env ruby
2+
3+
# Lists the current count of modules, by type, and outputs a bare CSV.
4+
5+
msfbase = __FILE__
6+
while File.symlink?(msfbase)
7+
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
8+
end
9+
10+
$:.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', 'lib')))
11+
require 'fastlib'
12+
require 'msfenv'
13+
14+
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
15+
16+
require 'rex'
17+
require 'msf/ui'
18+
require 'msf/base'
19+
20+
# Always disable the database (we never need it just to list module
21+
# information).
22+
framework_opts = { 'DisableDatabase' => true }
23+
24+
# Initialize the simplified framework instance.
25+
$framework = Msf::Simple::Framework.create(framework_opts)
26+
Indent = ' '
27+
28+
i = 0
29+
module_types = {
30+
:exploit => 0,
31+
:auxiliary => 0,
32+
:post => 0,
33+
:payload => 0,
34+
:encoder => 0,
35+
:nop => 0
36+
}
37+
38+
$framework.modules.each do |name, mod|
39+
this_mod = mod.new
40+
[:exploit, :auxiliary, :post, :payload, :encoder, :nop].each do |meth|
41+
interrogative = "#{meth}?".intern
42+
if this_mod.send(interrogative)
43+
module_types[meth] += 1
44+
end
45+
end
46+
end
47+
48+
puts module_types.keys.map {|k| k.to_s}.join(",")
49+
puts module_types.values.join(",")

0 commit comments

Comments
 (0)