mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-05 14:57:30 +01:00
added Anemone path extractors
This commit is contained in:
parent
385d225305
commit
4cdd26d579
7
lib/anemone/extractors/anchors.rb
Normal file
7
lib/anemone/extractors/anchors.rb
Normal file
@ -0,0 +1,7 @@
|
||||
class Anemone::Extractors::Anchors < Anemone::Extractors::Base
|
||||
|
||||
def run
|
||||
doc.search( '//a[@href]' ).map { |a| a['href'] }
|
||||
end
|
||||
|
||||
end
|
12
lib/anemone/extractors/dirbuster.rb
Normal file
12
lib/anemone/extractors/dirbuster.rb
Normal file
@ -0,0 +1,12 @@
|
||||
class Anemone::Extractors::Dirbuster < Anemone::Extractors::Base
|
||||
|
||||
def run
|
||||
return [] if page.code.to_i != 200
|
||||
|
||||
@@dirs ||= nil
|
||||
|
||||
return @@dirs if @@dirs
|
||||
@@dirs = IO.read( File.dirname( __FILE__ ) + '/dirbuster/directories' ).split( "\n" )
|
||||
end
|
||||
|
||||
end
|
10
lib/anemone/extractors/dirbuster/directories
Normal file
10
lib/anemone/extractors/dirbuster/directories
Normal file
@ -0,0 +1,10 @@
|
||||
test/
|
||||
tmp/
|
||||
stuff/
|
||||
awstats/
|
||||
awstats/awstats/
|
||||
basilic/
|
||||
cacti/
|
||||
docs/text/manual.txt
|
||||
docs/CHANGELOG
|
||||
docs/html/php_script_server.html
|
7
lib/anemone/extractors/forms.rb
Normal file
7
lib/anemone/extractors/forms.rb
Normal file
@ -0,0 +1,7 @@
|
||||
class Anemone::Extractors::Forms < Anemone::Extractors::Base
|
||||
|
||||
def run
|
||||
doc.search( '//form[@action]' ).map { |a| a['action'] }
|
||||
end
|
||||
|
||||
end
|
7
lib/anemone/extractors/frames.rb
Normal file
7
lib/anemone/extractors/frames.rb
Normal file
@ -0,0 +1,7 @@
|
||||
class Anemone::Extractors::Frames < Anemone::Extractors::Base
|
||||
|
||||
def run
|
||||
doc.css( 'frame', 'iframe' ).map { |a| a.attributes['src'].content rescue next }
|
||||
end
|
||||
|
||||
end
|
50
lib/anemone/extractors/generic.rb
Normal file
50
lib/anemone/extractors/generic.rb
Normal file
@ -0,0 +1,50 @@
|
||||
require 'uri'
|
||||
|
||||
class Anemone::Extractors::Generic < Anemone::Extractors::Base
|
||||
|
||||
def run
|
||||
URI.extract( doc.to_s, %w(http https) ).map do |u|
|
||||
#
|
||||
# This extractor needs to be a tiny bit intelligent because
|
||||
# due to its generic nature it'll inevitably match some garbage.
|
||||
#
|
||||
# For example, if some JS code contains:
|
||||
#
|
||||
# var = 'http://blah.com?id=1'
|
||||
#
|
||||
# or
|
||||
#
|
||||
# var = { 'http://blah.com?id=1', 1 }
|
||||
#
|
||||
#
|
||||
# The URI.extract call will match:
|
||||
#
|
||||
# http://blah.com?id=1'
|
||||
#
|
||||
# and
|
||||
#
|
||||
# http://blah.com?id=1',
|
||||
#
|
||||
# respectively.
|
||||
#
|
||||
if !includes_quotes?( u )
|
||||
u
|
||||
else
|
||||
if html.include?( "'#{u}" )
|
||||
u.split( '\'' ).first
|
||||
elsif html.include?( "\"#{u}" )
|
||||
u.split( '"' ).first
|
||||
else
|
||||
u
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue
|
||||
[]
|
||||
end
|
||||
|
||||
def includes_quotes?( url )
|
||||
url.include?( '\'' ) || url.include?( '"' )
|
||||
end
|
||||
|
||||
end
|
7
lib/anemone/extractors/links.rb
Normal file
7
lib/anemone/extractors/links.rb
Normal file
@ -0,0 +1,7 @@
|
||||
class Anemone::Extractors::Links < Anemone::Extractors::Base
|
||||
|
||||
def run
|
||||
doc.search( "//link[@href]" ).map { |a| a['href'] }
|
||||
end
|
||||
|
||||
end
|
24
lib/anemone/extractors/meta_refresh.rb
Normal file
24
lib/anemone/extractors/meta_refresh.rb
Normal file
@ -0,0 +1,24 @@
|
||||
class Anemone::Extractors::MetaRefresh < Anemone::Extractors::Base
|
||||
|
||||
def run
|
||||
doc.search( "//meta[@http-equiv='refresh']" ).map do |url|
|
||||
begin
|
||||
_, url = url['content'].split( ';', 2 )
|
||||
next if !url
|
||||
unquote( url.split( '=', 2 ).last )
|
||||
rescue
|
||||
next
|
||||
end
|
||||
end
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
|
||||
def unquote( str )
|
||||
[ '\'', '"' ].each do |q|
|
||||
return str[1...-1] if str.start_with?( q ) && str.end_with?( q )
|
||||
end
|
||||
str
|
||||
end
|
||||
|
||||
end
|
7
lib/anemone/extractors/scripts.rb
Normal file
7
lib/anemone/extractors/scripts.rb
Normal file
@ -0,0 +1,7 @@
|
||||
class Anemone::Extractors::Scripts < Anemone::Extractors::Base
|
||||
|
||||
def run
|
||||
doc.search( '//script[@src]' ).map { |a| a['src'] }
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user