All pastes #2051359 Raw Edit

Miscellany

public text v1 · immutable
#2051359 ·published 2011-04-27 22:51 UTC
rendered paste body
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
		<meta http-equiv="pragma" content="no-cache" />
		<title>Inblicken</title>
		<link href="/wa/common.css" rel="stylesheet" type="text/css" />
		<script language="Javascript" type="text/javascript" src="/wa/EPFunctions.js"></script>

		<script type="text/javascript">

			var installComponent = false;
			//Parameter for handling the new allow activex question in IE8
			var permitActivex=false;
			var activeXLoaded=false;
			var activeXError=false;
			var mInstallThreadID = null;

			// parse the query into an array to be able to find the location
			var qsParm = new Array();
			qsParm['install'] = null;
			//Add the permitActivex parameter to the array
			qsParm['permitActivex'] = null;	

			var query = window.location.search.substring(1);
			var parms = query.split('&');
			for (var i=0; i<parms.length; i++)
			{
				var pos = parms[i].indexOf('=');
				if (pos > 0)
				{
					var key = parms[i].substring(0,pos);
					var val = parms[i].substring(pos+1);
					qsParm[key] = val;
				}
			}

			if(qsParm['install'] != null && qsParm['installdone'] == null)
			{
				installComponent = true;
				// wait for page to load
				mInstallThreadID = setInterval("waitForInstall()", 100);
			}
			//If the query parameter permitActivex is not null the we need to handle the new question in IE8
			if(qsParm['permitActivex'] != null)
			{
				permitActivex = true;
				//We use the same methode as we do when we need to install the activeX control.
				mInstallThreadID = setInterval("waitForInstall()",100);
			}
			
			var tryAgain = false;
			if(qsParm['tryagain'] != null && qsParm['tryagain'] == "yes")
				tryAgain = true;


			var referenceObjectSet = false;
			var mReloadObject = null;
			var mLoaded = false;
			var mThreadID = null;
			var containerObject = null;
			var documentObject = null;

			// set all variables used by the loader and the native client
			var mPolicy = "3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d226e6f223f3e0a3c536572766572506f6c6963793e0a3c57696e646f77733e0a3c506f6c6963793e0a3c4173736573736d656e743e0a3c47656e6572616c3e0a3c436f6c6c65637457696e646f7773496e666f204163746976653d2266616c7365222f3e0a3c436f6c6c65637450726f63657373496e666f204163746976653d2266616c7365222f3e0a3c436f6c6c6563744e6574776f726b496e666f204163746976653d2266616c7365222f3e0a3c2f47656e6572616c3e0a3c436c69656e74496e666f436f6c6c6563746f72733e0a3c46696c652f3e0a3c4469726563746f72792f3e0a3c52656769737472794b65792f3e0a3c52656769737472795375624b65792f3e0a3c2f436c69656e74496e666f436f6c6c6563746f72733e0a3c2f4173736573736d656e743e0a3c41626f6c6973686d656e743e0a3c4361636865436c65616e65723e0a3c44656c6574654945486973746f7279204163746976653d2266616c7365222f3e0a3c44656c657465456e7472696573204163746976653d2266616c7365222066696c7465723d222a222f3e0a3c2f4361636865436c65616e65723e0a3c46696c655479706573546f44656c6574652054797065733d22646f632c20646f63782c20786c732c20786c73782c207070742c20707074782c207064662c207478742c207a69702c20657865222f3e0a3c2f41626f6c6973686d656e743e0a3c2f506f6c6963793e0a3c2f57696e646f77733e0a3c476c6f62616c3e0a3c5265616c54696d655363616e204163746976653d2266616c73652220496e74657276616c3d22313230222f3e0a3c46696c655479706573546f44656c657465204163746976653d227472756522204e6f74696679557365724f6e44656c6574653d227472756522204e6f74696679557365724f6e44656c657465496e666f3d2241626f6c6973686d656e74206973207265717565737465642e2053656c656374207468652066696c657320796f752077616e7420746f2064656c6574652e222f3e0a3c2f476c6f62616c3e0a3c2f536572766572506f6c6963793e";
			var mChallenge = "7a74da3a87e501faa149d1e1920f88b8";

			var mLoaderType = "activexapplet";

			// AP server settings
			var mPort = "";
			var mHost = document.location.host;
			var mProtocol = document.location.protocol;
			mProtocol = mProtocol.substring(0, mProtocol.length-1);

			// define if the init method should startup at ones or if the user must click the continue button
			var mStartUp = "false";

			// defines what container (frame name) to use (EPAssess or EPAbolish)
			var mTarget = "EPAssess";

			// define what type of action to take, Assess or Abolish.
			var mType = "Assess";

			// native application to load
			var mWindows = "";
			if(mType == "Assess")
				mWindows = "AssessWindows.exe";
			else
				mWindows = "";

			var mMacOSX = "";
			if(mType == "Assess")
				mMacOSX = "";
			else
				mMacOSX = "";

			// not used at the moment
			var mGUID = "";
			var mAuth = "Assess";

			var host_port_array = mHost.split(":");
			if (host_port_array.length > 0) {
				mHost = host_port_array[0];
			}
			if (host_port_array.length > 1) {
				mPort = host_port_array[1];
			}
			if (isNaN(mPort) || mPort == 0) {
				mPort = 443;
			}


			/**
			 * Verify that this is a valid browser. (Win and IE)
			 */
			function isValidBrowser()
			{

				var ua = navigator.userAgent.toLowerCase();
				var isWin = (ua.indexOf('win') != -1);

				return isWin;
			}



			/**
			 * Verifies that there is a EP container. Else redirect the user.
			 * Startup the EP loader when in right container by load /wa/EPLoadClient.html in
			 * the iframe named NativeClientLoader.
			 */
			function init()
			{

				// if we are installing the component under windows xp sp2, just return
				if(installComponent)
					return;
				//if we must permit the ActiveX control in IE8 or later, just return
				if(permitActivex)
				{
					return;
				}
				debugEvent("EPVerifyContainer:init() - Start");

				if(!isValidBrowser())
				{
//					alert("The client scan can only be loaded on Windows 2000, Windows 2003, or Windows XP.");
//					return;
				}

				debugEvent("EPVerifyContainer:init() - Trying to locate container named " + mTarget);

				// find the container in the frames/opener and parent structure
				containerObject = findEPContainer(mTarget);

				// get the document object for this user
				documentObject = getDocumentForWindow(containerObject);

				// parse the query into an array to be able to find the location
				var qsParm = new Array();
				qsParm['location'] = null;

				var query = window.location.search.substring(1);
				var parms = query.split('&');
				for (var i=0; i<parms.length; i++)
				{
					var pos = parms[i].indexOf('=');
					if (pos > 0)
					{
						var key = parms[i].substring(0,pos);
						var val = parms[i].substring(pos+1);
						qsParm[key] = val;
					}
				}


				if(containerObject == null)
				{
					// there is no container available for the loader, redirect user to EPMain
					debugEvent("EPVerifyContainer:init() - No container found. Redirecting to EPMain.html");

					document.location.href = "/wa/EPMain.html?location=" + qsParm['location'] + "&type=" + mType + "&target=" + mTarget;
				}
				else
				{
					debugEvent("EPVerifyContainer:init() - Container is found at " + containerObject.name);

					// there is a EP container available, verify the loaded page
					isCorrectPage = isEPLoadedInContainer(documentObject);

					if(!isCorrectPage)
					{

						setLoadingLayer("visible");

						// disable the buttons
						var continueButton = document.getElementById("continueButton");
						if(continueButton != null)
						{
							continueButton.disabled=true;
							continueButton.value=" Wait.... ";
						}
						var cancelButton = document.getElementById("cancelButton");
						if(cancelButton != null)
						{
							cancelButton.disabled=true;
						}

						debugEvent("EPVerifyContainer:init() - The correct page is not loaded. Load the page.");
						// if the container is in the opener scope, do noting, else reload this page frames.
						var redirectUrl = "/wa/auth?&authmech=" + mType + "&location=" + qsParm['location'];

						debugEvent("EPVerifyContainer:init() - redirectUrl = " + redirectUrl);

						if(isContainerInOpener(mTarget))
						{
							debugEvent("EPVerifyContainer:init() - container is in opener window.. redirect that page");

							if(this.name == "")
							{
								this.name = mGUID;
								redirectUrl += "&reloadFrame=" + mGUID;
							}
							else
								redirectUrl += "&reloadFrame=" + this.name;

							//alert("EPVerifyContainer:init() - container url: " + documentObject.location.href);

							debugEvent("EPVerifyContainer:init() - container url: " + documentObject.location.href);
							documentObject.location.href = redirectUrl;
							debugEvent("EPVerifyContainer:init() - container url: " + documentObject.location.href);

						}
						else
						{
							//alert("EPVerifyContainer:init() - container is not in opener");

							debugEvent("EPVerifyContainer:init() - container is not in opener");
							// the page is not in opener, just redirect container frame
							documentObject.location.href = redirectUrl;
						}

						debugEvent("EPVerifyContainer:init() - container is set, start waiting for the page to load..");

						// wait for page to load
						mThreadID = setInterval("waitForPageToLoad()", 100);

					}
					else /* isCorrectPage */
					{
						debugEvent("EPVerifyContainer:init() - The right page is already loaded, force a re-scan.");

						// the right page is already loaded, force a re-scan
						if(containerObject.contentWindow.frames[0].name == "NativeClientLoader")
						{
							// only assess can preform a re-scan
							if(mTarget == "EPAssess")
							{
								// wait for page to load
								mThreadID = setInterval("waitForPageToLoad()", 100);

								containerObject.contentWindow.frames[0].reScan();
							}
						}
						else
						{
							debugEvent("EPVerifyContainer:init() - Can't call re-scan method. Did not find frame.");
						}
					}
				}

			}


			/**
			 * Wait for the component to be installed in SP2
			 */
			function waitForInstall()
			{

				debugEvent("EPVerifyContainer:waitForInstall() - waiting for plugin to be installed");
				if (activeXLoaded == true && activeXError == false)
				{
					debugEvent("EPVerifyContainer:waitForInstall() - plugin is installed");

					var installButton = document.getElementById("continueInstall");
					if(installButton != null)
						installButton.disabled=false;

					debugEvent("EPVerifyContainer:waitForInstall() - shutting down thread");

					clearInterval(mInstallThreadID);
				}

			}


			/**
			 * Wait for the opener page to be loaded. Then set the a reference to this page.
			 * The Portal window will now know what frame to be reloaded.
			 */
			function waitForPageToLoad()
			{
				debugEvent("EPVerifyContainer:waitForPageToLoad() - verifying if it's loaded");

				if(containerObject == null)
					debugEvent("EPVerifyContainer:waitForPageToLoad() - container is null");

				if(containerObject && (containerObject.mLoaded || containerObject.contentWindow.mLoaded))
				{
					// set the reference
					if(containerObject.mLoaded)
					{
						containerObject.mReloadObject = this;
						debugEvent("EPVerifyContainer:waitForPageToLoad() - Referenced by " + containerObject.mReloadObject);
					}
					if(containerObject.contentWindow && containerObject.contentWindow.mLoaded)
					{
						containerObject.contentWindow.mReloadObject = this;
						debugEvent("EPVerifyContainer:waitForPageToLoad() - Referenced by " + containerObject.contentWindow.mReloadObject);
					}

					referenceObjectSet = true;

					debugEvent("EPVerifyContainer:waitForPageToLoad() - Page reference and focus is set in portal to this page.");

					clearInterval(mThreadID);

					debugEvent("EPVerifyContainer:waitForPageToLoad() - stopped");
				}
			}


			/**
			 * When in right context, startup the loader.
			 */
			function launch()
			{
				// if we are installing the component under windows xp sp2, just return
				if(installComponent)
					return;
				//If we need to accept the ActiveX control in IE8 or later, just return
				if(permitActivex)
				{
					return;
				}
				mLoaded = true;

				if(this.name == mTarget)
				{
					debugEvent("EPVerifyContainer:launch() - Loading EPLoadClient.html");

					var loader = "/wa/EPLoadClient.html";

					// parse the query into an array to be able to find the location
					var qsParm = new Array();
					qsParm['directaccess'] = null;

					var query = window.location.search.substring(1);
					var parms = query.split('&');
					for (var i=0; i<parms.length; i++)
					{
						var pos = parms[i].indexOf('=');
						if (pos > 0)
						{
							var key = parms[i].substring(0,pos);
							var val = parms[i].substring(pos+1);
							qsParm[key] = val;
						}
					}

					if(qsParm['directaccess'] != null)
					{
						loader = loader + "?directaccess=" + qsParm["directaccess"];

						debugEvent("EPVerifyContainer:launch() - Add direct access params: " + loader);
					}

            		setFrameURL("NativeClientLoader", loader);
            		debugEvent("EPVerifyContainer:launch() - loader set");

				}
			}

			/**
 			 * When the activex component is installed re-launch the native client
			 */
			function installDone()
			{
				installComponent = false;
				init();
			}
			/**
			 * When the user has accepted the activex to be run we re-launch the native client.
			 */
			function permitActivexDone()
			{
				permitActivex = false;
				init();
			}


		</script>


	</head>


	<body onLoad="launch()">


		<script type="text/javascript">
			function printActiveXComponents()
			{
				if(mType == "Assess")
				{
					debugEvent("EPVerifyContainer:body() - Generating Assessment ActiveX Component");
					document.writeln('<object id="EPLoaderActivex" name="EPLoaderActivex" ');
					document.writeln('codebase="/wa/AssessLoader.cab#version=1,0,0,20" ');
					document.writeln('classid="CLSID:05A2C7ED-7962-4A3F-BE2E-0A494B3C6A16" ');
					document.writeln('height="0" width="0" style="left: 0px; top: 0px" ');
					document.writeln('onreadystatechange="activeXLoaded = true;" ');
					document.writeln('onerror="activeXError = true;" ');
					document.writeln('VIEWASTEXT>');
					document.writeln('</object>');
				}
				else
				{
					debugEvent("EPVerifyContainer:body() - Generating Abolishment ActiveX Component");
					document.writeln('<object id="EPLoaderActivex" name="EPLoaderActivex" ');
					document.writeln('codebase="/wa/AbolishLoader.cab#version=1,0,0,20" ');
					document.writeln('classid="CLSID:AD1350A0-17F5-4714-A57B-B65F9EABF5D1" ');
					document.writeln('height="0" width="0" style="left: 0px; top: 0px" ');
					document.writeln('onreadystatechange="activeXLoaded = true;" ');
					document.writeln('onerror="activeXError = true;" ');
					document.writeln('VIEWASTEXT>');
					document.writeln('</object>');
				}
			}
			
			if (!installComponent && !permitActivex) {

					document.writeln('<div id="mainBack"></div>');
					document.writeln('<div id="mainTitle"><h2>End-Point Integrity</h2></div>');
					document.writeln('<div id="mainTextBox">');
					document.writeln('<p class="bottommargin">Before authorization can proceed, an End-Point Integrity scan must be performed on your computer. Click Continue to perform the scan or close this window to cancel.</p>');
					document.writeln('	<form action="auth" method="post" id="Form1" name="form">');
					document.writeln('		<input id="continueButton" name="continueButton" onclick="init()" type="button" value="Continue" />');
					document.writeln('		<input id="cancelButton" name="cancelButton" onclick="window.close();" type="button" value="Cancel" />');
					document.writeln('	</form>');
					document.writeln('</div>');

					document.writeln('<iframe src="/wa/blank.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" id="NativeClientLoader" name="NativeClientLoader" width="00" height="0"></iframe>');
			}
			//Special case if the permitActivex is true, then we need to handle the new IE8 question to allow the activex to be run on the new domain.
			else if(permitActivex)
			{
				printActiveXComponents();
				document.writeln('<div id="mainBackTwo">');
				document.writeln('	<h2>ActiveX permission is required</h2>');
				document.writeln('	<div id="mainTextBoxTwo">');
				document.writeln('		<p>');
				document.writeln('			To be able to run assessment and abolishment, you need to allow the ActiveX');
				document.writeln('			control to run. ');
				document.writeln('			<br/>');
				document.writeln('			<br/>');
				document.writeln('			You need to click the <b>Internet Explorer information bar</b> at the top of the browser window, just below ');
				document.writeln('			the address bar, to allow the control to run.');
				document.writeln('			<br/>');
				document.writeln('			<br/>');
				document.writeln('			Please contact your systems administrator if you have any questions.');
				document.writeln('			<br/>');
				document.writeln('			<br/>');
				document.writeln('			<form action="auth" method="post" id="Form1" name="form">');
				document.writeln('				<input id="continueInstall" onclick="permitActivexDone()" disabled="disabled" type="button" value="Continue when ActiveX control is permitted" />');
				document.writeln('			</form>');
				document.writeln('			<br/>');
				document.writeln('			<br/>');
				document.writeln('			<br/>');
				document.writeln('			<br/>');
				document.writeln('		</p>');
				document.writeln('	</div>');
				document.writeln('	<div id="copyright">');
				document.writeln('		Copyright &copy; 1999-2010, PortWise. All rights reserved.');
				document.writeln('	</div>');
				document.writeln('</div>');
			}
			else
			{

					
				printActiveXComponents();
				document.writeln('<div id="mainBackTwo">');
				document.writeln('	<h2>ActiveX Installation Required</h2>');
				document.writeln('	<div id="mainTextBoxTwo">');
				document.writeln('		<p>');
				document.writeln('			To be able to run assessment and abolishment, you need an ActiveX ');
				document.writeln('			control installed. Note that you need to have Administrator rights to ');
				document.writeln('			be able to install new components. Once the ActiveX control has been installed, ');
				document.writeln('			Administrator rights are not required.');
				document.writeln('			<br/>');
				document.writeln('			<br/>');
				document.writeln('			You need to click the <b>Internet Explorer information bar</b> at the top of the browser window, just below ');
				document.writeln('			the address bar, to allow the install.');
				document.writeln('			<br/>');
				document.writeln('			<br/>');
				document.writeln('			Then click the <b>Install Software...</b> link.');
				document.writeln('			<br/>');
				document.writeln('			<br/>');
				document.writeln('			Depending on your security preferences, you may need to accept the Security Warning displayed.');
				document.writeln('			<br/>');
				document.writeln('			<br/>');
				document.writeln('			Please contact your systems administrator if you have any questions.');
				document.writeln('			<br/>');
				document.writeln('			<br/>');
				document.writeln('			<form action="auth" method="post" id="Form1" name="form">');
				document.writeln('				<input id="continueInstall" onclick="installDone()" disabled="disabled" type="button" value="Continue when ActiveX control is installed" />');
				document.writeln('			</form>');
				document.writeln('			<br/>');
				document.writeln('			<br/>');
				document.writeln('			<br/>');
				document.writeln('			<br/>');
				document.writeln('		</p>');
				document.writeln('	</div>');
				document.writeln('	<div id="copyright">');
				document.writeln('		Copyright &copy; 1999-2010, PortWise. All rights reserved.');
				document.writeln('	</div>');
				document.writeln('</div>');

			}

		</script>


		<script>
			// if we don't need the user to click the button, just launch the native client
			if(mStartUp == "true" && !installComponent && (this.name != mTarget) && !tryAgain)
				init();