Skip to content

Commit 6d0d269

Browse files
committed
Merge branch 'web-modules' of git://github.com/tasos-r7/metasploit-framework into tasos-r7-web-modules
2 parents c65f377 + c659b37 commit 6d0d269

File tree

19 files changed

+552
-544
lines changed

19 files changed

+552
-544
lines changed

lib/anemone/extractors/anchors.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Anemone::Extractors::Anchors < Anemone::Extractors::Base
22

3-
def run
4-
doc.search( '//a[@href]' ).map { |a| a['href'] }
5-
end
3+
def run
4+
doc.search( '//a[@href]' ).map { |a| a['href'] }
5+
end
66

77
end

lib/anemone/extractors/dirbuster.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ def run
88
return @@dirs if @@dirs
99
@@dirs = IO.read( File.dirname( __FILE__ ) + '/dirbuster/directories' ).split( "\n" )
1010
end
11-
11+
1212
end

lib/anemone/extractors/forms.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Anemone::Extractors::Forms < Anemone::Extractors::Base
22

3-
def run
4-
doc.search( '//form[@action]' ).map { |a| a['action'] }
5-
end
6-
3+
def run
4+
doc.search( '//form[@action]' ).map { |a| a['action'] }
5+
end
6+
77
end

lib/anemone/extractors/frames.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Anemone::Extractors::Frames < Anemone::Extractors::Base
22

3-
def run
4-
doc.css( 'frame', 'iframe' ).map { |a| a.attributes['src'].content rescue next }
5-
end
3+
def run
4+
doc.css( 'frame', 'iframe' ).map { |a| a.attributes['src'].content rescue next }
5+
end
66

77
end

lib/anemone/extractors/generic.rb

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,48 @@
33
class Anemone::Extractors::Generic < Anemone::Extractors::Base
44

55
def run
6-
URI.extract( doc.to_s, %w(http https) ).map do |u|
7-
#
8-
# This extractor needs to be a tiny bit intelligent because
9-
# due to its generic nature it'll inevitably match some garbage.
10-
#
11-
# For example, if some JS code contains:
12-
#
13-
# var = 'http://blah.com?id=1'
14-
#
15-
# or
16-
#
17-
# var = { 'http://blah.com?id=1', 1 }
18-
#
19-
#
20-
# The URI.extract call will match:
21-
#
22-
# http://blah.com?id=1'
23-
#
24-
# and
25-
#
26-
# http://blah.com?id=1',
27-
#
28-
# respectively.
29-
#
30-
if !includes_quotes?( u )
31-
u
32-
else
33-
if html.include?( "'#{u}" )
34-
u.split( '\'' ).first
35-
elsif html.include?( "\"#{u}" )
36-
u.split( '"' ).first
37-
else
38-
u
39-
end
40-
end
41-
end
42-
rescue
43-
[]
44-
end
6+
URI.extract( doc.to_s, %w(http https) ).map do |u|
7+
#
8+
# This extractor needs to be a tiny bit intelligent because
9+
# due to its generic nature it'll inevitably match some garbage.
10+
#
11+
# For example, if some JS code contains:
12+
#
13+
# var = 'http://blah.com?id=1'
14+
#
15+
# or
16+
#
17+
# var = { 'http://blah.com?id=1', 1 }
18+
#
19+
#
20+
# The URI.extract call will match:
21+
#
22+
# http://blah.com?id=1'
23+
#
24+
# and
25+
#
26+
# http://blah.com?id=1',
27+
#
28+
# respectively.
29+
#
30+
if !includes_quotes?( u )
31+
u
32+
else
33+
if html.include?( "'#{u}" )
34+
u.split( '\'' ).first
35+
elsif html.include?( "\"#{u}" )
36+
u.split( '"' ).first
37+
else
38+
u
39+
end
40+
end
41+
end
42+
rescue
43+
[]
44+
end
4545

46-
def includes_quotes?( url )
47-
url.include?( '\'' ) || url.include?( '"' )
48-
end
46+
def includes_quotes?( url )
47+
url.include?( '\'' ) || url.include?( '"' )
48+
end
4949

5050
end

lib/anemone/extractors/links.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Anemone::Extractors::Links < Anemone::Extractors::Base
22

3-
def run
4-
doc.search( "//link[@href]" ).map { |a| a['href'] }
5-
end
3+
def run
4+
doc.search( "//link[@href]" ).map { |a| a['href'] }
5+
end
66

77
end
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
class Anemone::Extractors::MetaRefresh < Anemone::Extractors::Base
22

3-
def run
4-
doc.search( "//meta[@http-equiv='refresh']" ).map do |url|
5-
begin
6-
_, url = url['content'].split( ';', 2 )
7-
next if !url
8-
unquote( url.split( '=', 2 ).last )
9-
rescue
10-
next
11-
end
12-
end
13-
rescue
14-
nil
15-
end
3+
def run
4+
doc.search( "//meta[@http-equiv='refresh']" ).map do |url|
5+
begin
6+
_, url = url['content'].split( ';', 2 )
7+
next if !url
8+
unquote( url.split( '=', 2 ).last )
9+
rescue
10+
next
11+
end
12+
end
13+
rescue
14+
nil
15+
end
1616

17-
def unquote( str )
18-
[ '\'', '"' ].each do |q|
19-
return str[1...-1] if str.start_with?( q ) && str.end_with?( q )
20-
end
21-
str
22-
end
17+
def unquote( str )
18+
[ '\'', '"' ].each do |q|
19+
return str[1...-1] if str.start_with?( q ) && str.end_with?( q )
20+
end
21+
str
22+
end
2323

2424
end

lib/anemone/extractors/scripts.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Anemone::Extractors::Scripts < Anemone::Extractors::Base
22

3-
def run
4-
doc.search( '//script[@src]' ).map { |a| a['src'] }
5-
end
3+
def run
4+
doc.search( '//script[@src]' ).map { |a| a['src'] }
5+
end
66

77
end

0 commit comments

Comments
 (0)