From 5655d7456c5fa52dc68c7ece4b41e867c33daeb1 Mon Sep 17 00:00:00 2001 From: ethicalhack3r Date: Mon, 18 Nov 2013 16:46:23 +0100 Subject: [PATCH] Would help if I commited the file... --- .../plugins/checker/checker_spelling.rb | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 lib/wpstools/plugins/checker/checker_spelling.rb diff --git a/lib/wpstools/plugins/checker/checker_spelling.rb b/lib/wpstools/plugins/checker/checker_spelling.rb new file mode 100644 index 00000000..5501ab54 --- /dev/null +++ b/lib/wpstools/plugins/checker/checker_spelling.rb @@ -0,0 +1,87 @@ +# encoding: UTF-8 + +class CheckerSpelling < Plugin + + def initialize + super(author: 'WPScanTeam - @ethicalhack3r') + + register_options(['--spellcheck', '--sc', 'Check all files for common spelling mistakes.']) + end + + def run(options = {}) + spellcheck if options[:spellcheck] + end + + def spellcheck + mistakes = 0 + + puts '[+] Checking for spelling mistakes' + puts + + files.each do |file_name| + if File.exists?(file_name) + file = File.open(file_name, 'r') + + misspellings.each_key do |misspelling| + begin + file.read.scan(/#{misspelling}/).each do |match| + mistakes += 1 + puts "[MISSSPELLING] File: #{file_name} Bad: #{match} Good: #{misspellings[misspelling]}" + end + rescue => e + puts "Error in #{file_name} #{e}" + next + end + end + + file.close + end + end + + puts + puts "[+] Found #{mistakes} spelling mistakes" + + mistakes + end + + def misspellings + { + /databse/i => 'database', + /whith/i => 'with', + /wich/i => 'which', + /verions/i => 'versions', + /vulnerabilitiy/i => 'vulnerability', + /unkown/i => 'unknown', + /recieved/i => 'received', + /acheive/i => 'achieve', + /wierd/i => 'weird', + /untill/i => 'until', + /alot/i => 'a lot', + /randomstorm/ => 'RandomStorm', + /wpscan/ => 'WPScan', + /Wordpress/ => 'WordPress' + } + end + + def files + files = Dir['**/*'].reject {|fn| File.directory?(fn) } + + ignore.each do |ignore| + files.delete_if { |data| data.match(ignore) } + end + + files + end + + def ignore + ignore = [] + + ignore << File.basename(__FILE__) + ignore << 'spec/cache/' + ignore << 'spec/spec_session/' + ignore << 'coverage/assets/' + ignore << 'wordlist-iso-8859-1' + + ignore + end +end \ No newline at end of file