Patching "undefined method empty?" errors + "encoding error"
parent
e8257122b3
commit
c9a5190726
|
@ -1,17 +1,8 @@
|
||||||
##
|
##
|
||||||
# $Id$
|
# This module requires Metasploit: http://metasploit.com/download
|
||||||
|
# Current source: https://github.com/rapid7/metasploit-framework
|
||||||
##
|
##
|
||||||
|
|
||||||
##
|
|
||||||
# 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/
|
|
||||||
##
|
|
||||||
|
|
||||||
# $Revision$
|
|
||||||
|
|
||||||
require 'rubygems'
|
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
require 'nokogiri'
|
require 'nokogiri'
|
||||||
require 'uri'
|
require 'uri'
|
||||||
|
@ -19,28 +10,21 @@ require 'uri'
|
||||||
class CrawlerForms < BaseParser
|
class CrawlerForms < BaseParser
|
||||||
|
|
||||||
def parse(request,result)
|
def parse(request,result)
|
||||||
|
return unless result['Content-Type'].include?('text/html')
|
||||||
if !result['Content-Type'].include? "text/html"
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
hr = ''
|
|
||||||
m = ''
|
|
||||||
|
|
||||||
doc = Nokogiri::HTML(result.body.to_s)
|
doc = Nokogiri::HTML(result.body.to_s)
|
||||||
doc.css('form').each do |f|
|
doc.css('form').each do |f|
|
||||||
hr = f['action']
|
hr = f['action']
|
||||||
|
|
||||||
fname = f['name']
|
# Removed because unused
|
||||||
fname = "NONE" if fname.empty?
|
#fname = f['name']
|
||||||
|
#fname = 'NONE' if fname.empty?
|
||||||
|
|
||||||
m = f['method'].empty? ? 'GET' : f['method'].upcase
|
m = (f['method'].empty? ? 'GET' : f['method'].upcase)
|
||||||
|
|
||||||
htmlform = Nokogiri::HTML(f.inner_html)
|
|
||||||
|
|
||||||
arrdata = []
|
arrdata = []
|
||||||
|
|
||||||
htmlform.css('input').each do |p|
|
f.css('input').each do |p|
|
||||||
arrdata << "#{p['name']}=#{Rex::Text.uri_encode(p['value'])}"
|
arrdata << "#{p['name']}=#{Rex::Text.uri_encode(p['value'])}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -51,7 +35,10 @@ class CrawlerForms < BaseParser
|
||||||
hreq['ctype'] = 'application/x-www-form-urlencoded'
|
hreq['ctype'] = 'application/x-www-form-urlencoded'
|
||||||
insertnewpath(hreq)
|
insertnewpath(hreq)
|
||||||
rescue URI::InvalidURIError
|
rescue URI::InvalidURIError
|
||||||
|
#puts "Parse error"
|
||||||
|
#puts "Error: #{link[0]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue