Skip to content

Commit 5cfabb0

Browse files
committed
Apply the changes I suggested before
1 parent 1e39c31 commit 5cfabb0

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

modules/auxiliary/scanner/http/coldfusion_locale_traversal.rb

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def initialize
4949

5050
register_options(
5151
[
52-
OptString.new('FILE', [ false, 'File to retrieve (make sure path/file match OS (ie, /etc/passwd on Windows == dumb))', '']),
53-
OptBool.new('FINGERPRINT', [true, 'Only fingerprint endpoints', false]),
52+
OptString.new('FILE', [ false, 'File to retrieve', '']),
53+
OptBool.new('FINGERPRINT', [true, 'Only fingerprint endpoints', false])
5454
], self.class)
5555
end
5656

@@ -115,7 +115,8 @@ def run_host(ip)
115115
'method' => 'GET',
116116
'Connection' => "keep-alive",
117117
'Accept-Encoding' => "zip,deflate",
118-
}, 10)
118+
})
119+
119120
return if not res or not res.body or not res.code
120121

121122
if (res.code.to_i == 200)
@@ -172,31 +173,26 @@ def run_host(ip)
172173
'Connection' => "keep-alive",
173174
'Accept-Encoding' => "zip,deflate",
174175
},
175-
}, -1)
176+
})
176177

177178

178179
if (res.nil?)
179180
print_error("no response for #{ip}:#{rport} #{url}")
180181
elsif (res.code == 200)
181182
#print_error("#{res.body}")#debug
182-
out << "URL: #{ip}#{url}#{locale}#{trav}\n"
183-
if match = res.body.match(/\<title\>(.*)\<\/title\>/im)
183+
print_status("URL: #{ip}#{url}#{locale}#{trav}")
184+
if res.body.match(/\<title\>(.*)\<\/title\>/im)
184185
fileout = $1
185186
if(fileout !~ /Login$/ and fileout !~ /^Welcome to ColdFusion/ and fileout !~ /^Archives and Deployment/)
186-
out << "#{ip} FILE:\n#{fileout}\r\n"
187-
break
187+
print_good("#{ip} FILE: #{fileout}")
188+
break
188189
end
189190
end
190191
else
191192
next if (res.code == 500 or res.code == 404 or res.code == 302)
192193
print_error("#{ip} #{res.inspect}")
193194
end
194195
end
195-
if(out =~ /FILE/)
196-
print_good(out)
197-
else
198-
print_status(out)
199-
end
200196

201197
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::ArgumentError
202198
rescue ::Timeout::Error, ::Errno::EPIPE

0 commit comments

Comments
 (0)