From d5fe8471ed02c72e6cd59e1f408006ba73b677af Mon Sep 17 00:00:00 2001 From: Thanat0s Date: Mon, 28 Apr 2014 12:16:49 +0200 Subject: [PATCH] unless id --- .../http/f5_bigip_cookie_disclosure.rb | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/modules/auxiliary/scanner/http/f5_bigip_cookie_disclosure.rb b/modules/auxiliary/scanner/http/f5_bigip_cookie_disclosure.rb index e7dac22d2b..60d811b3b3 100644 --- a/modules/auxiliary/scanner/http/f5_bigip_cookie_disclosure.rb +++ b/modules/auxiliary/scanner/http/f5_bigip_cookie_disclosure.rb @@ -51,11 +51,11 @@ class Metasploit3 < Msf::Auxiliary 'method' => 'GET', 'uri' => @uri }) - + begin # Get the SLB session ID, like "TestCookie=2263487148.3013.0000" m = res.headers['Set-Cookie'].match(/([\-\w\d]+)=((?:\d+\.){2}\d+)(?:$|,|;|\s)/) - ensure + ensure id = (m.nil?) ? nil : m[1] value = (m.nil?) ? nil : m[2] return id, value @@ -67,33 +67,33 @@ class Metasploit3 < Msf::Auxiliary @uri = normalize_uri(target_uri.path) print_status("Starting request #{@uri}") id, value = get_cookie() - if id - print_status ("F5 cookie \"#{id}\" found") - host, port = cookie_decode(value) - host_port[host+":"+port] = true - print_status "Backend #{host}:#{port}" - i=1 # We already have done one request - until i == datastore['RETRY'] - id, value = get_cook() - host, port = cookie_decode(value) - if ! host_port.has_key? host+":"+port - host_port[host+":"+port] = true - print_status "Backend #{host}:#{port}" - end - i += 1 - end - # Reporting found backend in database - backends = Array.new - host_port.each do |key, value| - backends.push key - end - report_note( - :host => datastore['RHOST'], - :type => "F5_Cookie_Backends", - :data => backends - ) - else + unless id print_error "F5 SLB cookie not found" + return end + print_status ("F5 cookie \"#{id}\" found") + host, port = cookie_decode(value) + host_port[host+":"+port] = true + print_status "Backend #{host}:#{port}" + i=1 # We already have done one request + until i == datastore['RETRY'] + id, value = get_cookie() + host, port = cookie_decode(value) + if ! host_port.has_key? host+":"+port + host_port[host+":"+port] = true + print_status "Backend #{host}:#{port}" + end + i += 1 + end + # Reporting found backend in database + backends = Array.new + host_port.each do |key, value| + backends.push key + end + report_note( + :host => datastore['RHOST'], + :type => "F5_Cookie_Backends", + :data => backends + ) end end