Land #2197 - Tabassassin msftidy

bug/bundler_fix
sinn3r 2013-08-08 13:15:32 -05:00
commit 84090b73b1
4 changed files with 96 additions and 2 deletions

2
.gitignore vendored
View File

@ -40,3 +40,5 @@ tags
*.orig *.orig
*.rej *.rej
*~ *~
# Ignore backups of retabbed files
*.notab

View File

@ -0,0 +1,47 @@
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
include Msf::Auxiliary::Report
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
'Name' => "Check Test",
'Description' => %q{
This module ensures that 'check' actually functions for Auxiilary modules.
},
'References' =>
[
[ 'OSVDB', '0' ]
],
'Author' =>
[
'todb'
],
'License' => MSF_LICENSE
))
register_options(
[
Opt::RPORT(80)
], self.class)
end
def check
print_debug "Check is successful"
return Msf::Exploit::CheckCode::Vulnerable
end
def run
print_debug "Run is successful."
end
end

43
tools/dev/retab.rb Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/env ruby
# -*- coding: binary -*-
# Replace leading tabs with 2-width spaces.
# I'm sure there's a sed/awk/perl oneliner that's
# a million times better but this is more readable for me.
require 'fileutils'
require 'find'
dir = ARGV[0] || "."
raise ArgumentError, "Need a filename or directory" unless (dir and File.readable? dir)
Find.find(dir) do |infile|
next unless File.file? infile
next unless infile =~ /rb$/
outfile = infile
backup = "#{infile}.notab"
FileUtils.cp infile, backup
data = File.open(infile, "rb") {|f| f.read f.stat.size}
fixed = []
data.each_line do |line|
fixed << line
next unless line =~ /^\x09/
index = []
i = 0
line.each_char do |char|
break unless char =~ /[\x20\x09]/
index << i if char == "\x09"
i += 1
end
index.reverse.each do |idx|
line[idx] = " "
end
fixed[-1] = line
end
fh = File.open(outfile, "wb")
fh.write fixed.join
fh.close
puts "Retabbed #{fh.path}"
end

View File

@ -353,8 +353,10 @@ class Msftidy
warn("Spaces at EOL", idx) warn("Spaces at EOL", idx)
end end
if (ln.length > 1) and (ln =~ /^([\t ]*)/) and ($1.include?(' ')) # Allow tabs or spaces as indent characters, but not both.
warn("Bad indent: #{ln.inspect}", idx) # This should check for spaces only on October 8, 2013
if (ln.length > 1) and (ln =~ /^([\t ]*)/) and ($1.match(/\x20\x09|\x09\x20/))
warn("Space-Tab mixed indent: #{ln.inspect}", idx)
end end
if ln =~ /\r$/ if ln =~ /\r$/