Skip to content

Commit 51e71dc

Browse files
authored
Merge pull request #20332 from todb/update-module-counter
Update module counter
2 parents b8c375d + 81cb85e commit 51e71dc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/modules/module_commits.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ class CommitHistory < Struct.new(:fname, :total, :authors)
2121
end
2222

2323
msfbase = __FILE__
24+
2425
while File.symlink?(msfbase)
2526
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
2627
end
28+
msfbase = File.expand_path(File.join(File.dirname(msfbase), '..', '..'))
2729

2830
dir = ARGV[0] || File.join(msfbase, "modules", "exploits")
2931
raise ArgumentError, "Need a filename or directory" unless (dir and File.readable? dir)
@@ -59,7 +61,8 @@ def check_commit_history(fname)
5961
@module_stats = []
6062

6163
Find.find(dir) do |fname|
62-
next unless fname =~ /rb$/
64+
next unless fname =~ /\.(rb|py)$/ # be either ruby or python
65+
next unless File.file?(fname) && File.readable?(fname)
6366
@module_stats << check_commit_history(fname)
6467
end
6568

0 commit comments

Comments
 (0)