Skip to content

Commit af3a1db

Browse files
committed
Make better use of ruby regex
1 parent 077c04d commit af3a1db

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

modules/auxiliary/scanner/http/cold_fusion_version.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ def fingerprint(response)
3939
return nil if response.body.length < 100
4040

4141
title = "Not Found"
42-
response.body.gsub!(/[\r\n]/, '')
43-
if(response.body =~ /<title.*\/?>(.+)<\/title\/?>/i)
42+
if(response.body =~ /<title.*\/?>(.+)<\/title\/?>/im)
4443
title = $1
4544
title.gsub!(/\s/, '')
4645
end
@@ -51,11 +50,11 @@ def fingerprint(response)
5150
if(response.body =~ />\s*Version:\s*(.*)<\/strong\><br\s\//)
5251
v = $1
5352
out = (v =~ /^6/) ? "Adobe ColdFusion MX6 #{v}" : "Adobe ColdFusion MX7 #{v}"
54-
elsif(response.body =~ /<meta name=\"Author\" content=\"Copyright 1995-2012 Adobe/ and response.body =~ /Administrator requires a browser that supports frames/ )
53+
elsif(response.body =~ /<meta name=\"Author\" content=\"Copyright 1995\-2012 Adobe/ and response.body =~ /Administrator requires a browser that supports frames/ )
5554
out = "Adobe ColdFusion MX7"
56-
elsif(response.body =~ /<meta name=\"Author\" content=\"Copyright \(c\) 1995-2006 Adobe/)
55+
elsif(response.body =~ /<meta name=\"Author\" content=\"Copyright \(c\) 1995\-2006 Adobe/)
5756
out = "Adobe ColdFusion 8"
58-
elsif(response.body =~ /<meta name=\"Author\" content=\"Copyright \(c\) 1995-2010 Adobe/ or
57+
elsif(response.body =~ /<meta name=\"Author\" content=\"Copyright \(c\) 1995\-2010 Adobe/ or
5958
response.body =~ /<meta name=\"Author\" content=\"Copyright \(c\) 1995\-2009 Adobe Systems\, Inc\. All rights reserved/)
6059
out = "Adobe ColdFusion 9"
6160
elsif(response.body =~ /<meta name=\"Keywords\" content=\"(.*)\">\s+<meta name/)
@@ -79,7 +78,7 @@ def run_host(ip)
7978
res = send_request_cgi({
8079
'uri' => url,
8180
'method' => 'GET',
82-
}, 10)
81+
})
8382

8483
return if not res or not res.body or not res.code
8584
res.body.gsub!(/[\r|\n]/, ' ')

0 commit comments

Comments
 (0)