From 1e06bb6c17038b4b314457bb2104fc07e11d56a9 Mon Sep 17 00:00:00 2001 From: antisnatchor Date: Fri, 27 Feb 2015 11:50:38 +0100 Subject: [PATCH] Return 'n/a' rather than nil in restful API calls for PF integration --- core/main/rest/handlers/hookedbrowsers.rb | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/core/main/rest/handlers/hookedbrowsers.rb b/core/main/rest/handlers/hookedbrowsers.rb index 82586559d..2715e80df 100644 --- a/core/main/rest/handlers/hookedbrowsers.rb +++ b/core/main/rest/handlers/hookedbrowsers.rb @@ -149,27 +149,33 @@ module BeEF # this is used in the 'get '/pf'' restful api call def hbs_to_array(hbs) - hbs_online = [] + hooked_browsers = [] hbs.each do |hb| details = BeEF::Core::Models::BrowserDetails # TODO jQuery.dataTables needs fixed array indexes, add emptry string if a value is blank - hbs_online << [ + + pfuid = details.get(hb.session, 'PhishingFrenzyUID') != nil ? details.get(hb.session, 'PhishingFrenzyUID') : 'n/a' + bname = details.get(hb.session, 'BrowserName') != nil ? details.get(hb.session, 'BrowserName') : 'n/a' + bversion = details.get(hb.session, 'BrowserVersion') != nil ? details.get(hb.session, 'BrowserVersion') : 'n/a' + bplugins = details.get(hb.session, 'BrowserPlugins') != nil ? details.get(hb.session, 'BrowserPlugins') : 'n/a' + + hooked_browsers << [ hb.id, hb.ip, - details.get(hb.session, 'PhishingFrenzyUID'), - details.get(hb.session, 'BrowserName'), - details.get(hb.session, 'BrowserVersion'), + pfuid, + bname, + bversion, details.get(hb.session, 'OsName'), details.get(hb.session, 'BrowserPlatform'), details.get(hb.session, 'BrowserLanguage'), - details.get(hb.session, 'BrowserPlugins'), + bplugins, details.get(hb.session, 'LocationCity'), details.get(hb.session, 'LocationCountry'), details.get(hb.session, 'LocationLatitude'), details.get(hb.session, 'LocationLongitude') ] end - hbs_online + hooked_browsers end end