From 6625a2bd2989a4a0d5584dbc2061c5b30104c286 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Wed, 27 Jan 2016 19:25:06 +0000 Subject: [PATCH] Fix browser details nil window/screen size bug --- .../admin_ui/controllers/modules/modules.rb | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/extensions/admin_ui/controllers/modules/modules.rb b/extensions/admin_ui/controllers/modules/modules.rb index 92b8d236d..f3efd3f87 100644 --- a/extensions/admin_ui/controllers/modules/modules.rb +++ b/extensions/admin_ui/controllers/modules/modules.rb @@ -134,17 +134,26 @@ class Modules < BeEF::Extension::AdminUI::HttpController data = BeEF::Core::Constants::Browsers.friendly_name(BD.get(zombie_session, p[2])) when "ScreenSize" - screen_size_hash = JSON.parse(BD.get(zombie_session, p[2]).gsub(/\"\=\>/, '":')) # tidy up the string for JSON - width = screen_size_hash['width'] - height = screen_size_hash['height'] - cdepth = screen_size_hash['colordepth'] - data = "Width: #{width}, Height: #{height}, Colour Depth: #{cdepth}" - + screen_size = BD.get(zombie_session, "ScreenSize") + if screen_size.nil? + data = "Unknown" + else + screen_size_hash = JSON.parse(screen_size.gsub(/\"\=\>/, '":')) # tidy up the string for JSON + width = screen_size_hash['width'] + height = screen_size_hash['height'] + cdepth = screen_size_hash['colordepth'] + data = "Width: #{width}, Height: #{height}, Colour Depth: #{cdepth}" + end when "WindowSize" - window_size_hash = JSON.parse(BD.get(zombie_session, p[2]).gsub(/\"\=\>/, '":')) # tidy up the string for JSON - width = window_size_hash['width'] - height = window_size_hash['height'] - data = "Width: #{width}, Height: #{height}" + window_size = BD.get(zombie_session, "WindowSize") + if window_size.nil? + data = "Unknown" + else + window_size_hash = JSON.parse(window_size.gsub(/\"\=\>/, '":')) # tidy up the string for JSON + width = window_size_hash['width'] + height = window_size_hash['height'] + data = "Width: #{width}, Height: #{height}" + end else data = BD.get(zombie_session, p[2]) end