Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/tools/dev/update_wordpress_vulnerabilities.rb
Views: 11766
#!/usr/bin/env ruby1# -*- coding: binary -*-23#4# Update modules/auxiliary/scanner/http/wordpress_scanner.rb to have the most5# up to date list of vuln components based on exploits/scanners in the framework6#7# by h00die8#910require 'optparse'1112options = {}13optparse = OptionParser.new do |opts|14opts.banner = 'Usage: update_wordpress_vulnerabilities.rb [options]'15opts.on('-h', '--help', 'Display this screen.') do16puts opts17exit18end19end20optparse.parse!2122# colors and puts templates from msftidy.rb2324class String25def red26"\e[1;31;40m#{self}\e[0m"27end2829def yellow30"\e[1;33;40m#{self}\e[0m"31end3233def green34"\e[1;32;40m#{self}\e[0m"35end3637def cyan38"\e[1;36;40m#{self}\e[0m"39end40end4142#43# Display an error message, given some text44#45def error(txt)46puts "[#{'ERROR'.red}] #{cleanup_text(txt)}"47end4849#50# Display a warning message, given some text51#52def warning(txt)53puts "[#{'WARNING'.yellow}] #{cleanup_text(txt)}"54end5556#57# Display a info message, given some text58#59def info(txt)60puts "[#{'INFO'.cyan}] #{cleanup_text(txt)}"61end6263def cleanup_text(txt)64# remove line breaks65txt = txt.gsub(/[\r\n]/, ' ')66# replace multiple spaces by one space67txt.gsub(/\s{2,}/, ' ')68end6970plugins = []71themes = []72path = File.expand_path('../../', File.dirname(__FILE__))73Dir.glob(path + '/modules/**/*.rb').each do |file|74next unless file.include?('exploits') || file.include?('auxiliary')7576str = File.read(file)77match = str.match(/check_plugin_version_from_readme\(['"]([^'"]+)['"]/)78unless match.nil?79plugins.append(match[1])80info("#{file} contains plugin '#{match[1]}'")81end82match = str.match(/check_theme_version_from_readme\(['"]([^'"]+)['"]/)83unless match.nil?84themes.append(match[1])85info("#{file} contains theme '#{match[1]}'")86end87end8889info('Updating wp-exploitable-themes.txt')90wp_list = path + '/data/wordlists/wp-exploitable-themes.txt'9192File.open(wp_list, 'w+') do |f|93f.puts(themes)94end9596info('Updating wp-exploitable-plugins.txt')97wp_list = path + '/data/wordlists/wp-exploitable-plugins.txt'9899File.open(wp_list, 'w+') do |f|100f.puts(plugins)101end102103104