Skip to content

Commit 5af14c4

Browse files
committed
Merge pull request rapid7#1380 from todb-r7/feature/mailmap_and_commit_count
Godspeed, friends.
2 parents 47ea8ae + c87a60f commit 5af14c4

File tree

4 files changed

+249
-0
lines changed

4 files changed

+249
-0
lines changed

.mailmap

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