From 63e3e3a0e95339c4fb341d691fc11a190e9d6cf3 Mon Sep 17 00:00:00 2001 From: James Lee Date: Fri, 21 Nov 2008 05:37:28 +0000 Subject: [PATCH] remove some verbosity and dead code from js osdetect git-svn-id: file:///home/svn/framework3/trunk@5973 4d416f70-5f16-0410-b530-b9f4589650da --- lib/rex/exploitation/javascriptosdetect.rb | 40 +++++----------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/lib/rex/exploitation/javascriptosdetect.rb b/lib/rex/exploitation/javascriptosdetect.rb index a917258bf3..31fe79fada 100644 --- a/lib/rex/exploitation/javascriptosdetect.rb +++ b/lib/rex/exploitation/javascriptosdetect.rb @@ -24,7 +24,7 @@ function getVersion(){ var os_name; var os_flavor; var os_sp; - var os_lang = "English"; + var os_lang; var browser_name; var browser_version; var useragent = navigator.userAgent; @@ -32,8 +32,8 @@ function getVersion(){ var version = ""; version = useragent; - document.write("navigator.userAgent = '"+navigator.userAgent+"'
"); - document.write("navigator.appVersion = '"+navigator.appVersion+"'
"); + //document.write("navigator.userAgent = '"+navigator.userAgent+"'
"); + //document.write("navigator.appVersion = '"+navigator.appVersion+"'
"); // Firefox's appVersion on windows doesn't tell us the flavor, so use // userAgent all the time. If userAgent is spoofed, appVersion will lie @@ -84,7 +84,7 @@ function getVersion(){ version = ScriptEngineMajorVersion().toString(); version += ScriptEngineMinorVersion().toString(); version += ScriptEngineBuildVersion().toString(); - document.write("ScriptEngine: "+version+"
"); + //document.write("ScriptEngine: "+version+"
"); switch (version){ case "514615": os_flavor = "2000"; @@ -155,38 +155,16 @@ function getVersion(){ if (navigator.systemLanguage) { // ie - version = navigator.systemLanguage; + os_lang = navigator.systemLanguage; } else if (navigator.language) { // gecko derivatives - version = navigator.language; + os_lang = navigator.language; } else { // some other browser and we don't know how to get the language, so // just guess english - version = "en"; + os_lang = "en"; } - document.write("language = '"+version+"'
"); - os_lang = version; - //switch (version){ - // case "fr": os_lang = "French"; break; - // case "zh": os_lang = "Chinese"; break; - // case "nl": os_lang = "Dutch"; break; - // case "de": os_lang = "German"; break; - // case "it": os_lang = "Italian"; break; - // case "ja": os_lang = "Japanese"; break; - // case "ko": os_lang = "Korean"; break; - // case "pl": os_lang = "Polish"; break; - // case "pt": os_lang = "Portuguese"; break; - // case "ru": os_lang = "Russian"; break; - // case "es": os_lang = "Spanish"; break; - // case "sv": os_lang = "Swedish"; break; - // case "tr": os_lang = "Turkish"; break; - // case "uk": os_lang = "Ukrainian"; break; - // case "vi": os_lang = "Vietnamese"; break; - // default: //"en", "en-*" - // os_lang = "English"; break; - //} // switch navigator.systemLanguage - version = navigator.platform; if ( ("Win32" == version) || (version.match(/i.86/)) ) { arch = "#{ARCH_X86}"; @@ -194,7 +172,7 @@ function getVersion(){ arch = "#{ARCH_PPC}"; } - document.write("Target is: "+os_name+" "+os_flavor+" "+os_sp+" "+os_lang+" / "+browser_name+" "+browser_version +"
"); + //document.write("Target is: "+os_name+" "+os_flavor+" "+os_sp+" "+os_lang+" / "+browser_name+" "+browser_version +"
"); return { os_name:os_name, os_flavor:os_flavor, os_sp:os_sp, os_lang:os_lang, arch:arch, browser_name:browser_name, browser_version:browser_version }; } // function getVersion @@ -222,4 +200,4 @@ ENDJS end end -end \ No newline at end of file +end