Page 2 of 2 <12
Topic Options
#89404 - 2002-11-14 09:18 PM Re: Run IE and enable proxy only for this windows
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
get this to work right... and it could be used as a great pop-up ad killer. [Big Grin] [Cool] [Big Grin]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#89405 - 2002-11-19 01:33 PM Re: Run IE and enable proxy only for this windows
Will Hetrick Offline
Hey THIS is FUN

Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
Patrick,
Can the users go to any site they want while in the "proxy enabled" IE that is running?
I would think that they could start up this training site then while it is running go to any site they want while making sure not to close out that session?

Is this true?

Will
_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!

Top
#89406 - 2002-11-19 02:29 PM Re: Run IE and enable proxy only for this windows
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
that it the way it's created.
_________________________
!

download KiXnet

Top
#89407 - 2002-11-19 02:43 PM Re: Run IE and enable proxy only for this windows
Will Hetrick Offline
Hey THIS is FUN

Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
So lonkero,
What you are saying is the people who do not have proxy access, if they are smart enough, they can have it. [Big Grin]
_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!

Top
#89408 - 2002-11-19 02:53 PM Re: Run IE and enable proxy only for this windows
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
in this case.
actually, that is a fact of life.
if one is smart enough, he can build a kix-trojan which will destroy the system it's running when it's tried to remove [Razz]

security by ignorance is one of the basic sins of humanity.
_________________________
!

download KiXnet

Top
#89409 - 2002-11-19 02:55 PM Re: Run IE and enable proxy only for this windows
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I guess stupidity would be a close second...
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#89410 - 2002-11-19 02:56 PM Re: Run IE and enable proxy only for this windows
Will Hetrick Offline
Hey THIS is FUN

Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
That is the best kind of users to have. That way I still have a job [Big Grin]
_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!

Top
#89411 - 2002-11-19 02:58 PM Re: Run IE and enable proxy only for this windows
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Apologies for coming a little late to this, but...

Wouldn't the simplest solution be to provide a ".pac" file?

This is a file used to automatically configure the browser proxy settings. It is simple javascript, and would look something like:

code:
function FindProxyForURL(url, host)
{
if (host == "www.training-host.com"){
return "PROXY myproxy.mydomain.com:8080";
} else {
return "DIRECT";
}
}

In this example any request for www.training-host.com would be sent to the proxy "myproxy.mydomain.com", all other requests would be forced to be local.

You would disable access to the IE configuration screens to stop your users fiddling, and assign the ".pac" file name during logon.

Top
#89412 - 2002-11-19 03:04 PM Re: Run IE and enable proxy only for this windows
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Richard,

howto assign the .pac???

I came up with this:
code:
;****************************************************************************
;
;SCRIPT : IE_with_proxy()
;
;AUTHOR : Patrick Rutten (MightyR1@hotmail.com)
;
;CONTRIBUTORS : KiXtart buddies
;
;ACTION : Starts IE with proxy settings
;
;SYNTAX : <path>wkix32.exe /i <path>IE_with_proxy.kix $proxy="PROXY_IP:PROXY_PORT"
; $url="http://URL_TO_GO_TO"
;
;VERSION : 1.0 - 2002-11-14
; initial release
; 1.1 - 2002-11-15
; added $proxy/$url arguments support
; modified proxyoverride/proxyserver; now contains correct settings
; window is now created dynamically using screenresolution
;
;PARAMETERS : $proxy
; IP-address of proxyserver
; $url
; destination url
;
;REMARKS : Current proxy settings will be remembered
;
;RETURNS : Nothing
;
;DEPENDENCIES : wkix32.exe (4.12) in @scriptdir
; - http://www.scriptlogic.com/downloads/kix/KiX2001_412.zip
; W9x (@inwin=2): kill95.exe in @scriptdir
; - http://helpdesk.kixtart.org/Download/Utils/kill95.zip
; NT and up (@inwin=1): WMI (installed on W2k by default)
; UDF GetScreenRes written by Kholm
; - http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=12;t=000035
; UDF WMIQuery written by Radimus
; - http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=12;t=000117
; UDF Taskbar written by Lonkero
; - http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_profile;u=00002306
;
;KIXTART VER : 4.x
;
;EXAMPLE(S) :
;
;KNOWN ISSUES :
;
;****************************************************************************
;
;

;Allow CTRL-C
Break on

;Display error message if parameters are empty and exit
If ""=$url OR ""=$proxy
$rc=MessageBox("Parameters incorrect!"+@crlf+"Neem contact op met uw helpdesk.",
"KiXtart message",16,120)
Exit 0
EndIf

;Display warning message; OK/CANCEL buttons, timeout = 120 seconds
$rc=MessageBox("Sluit alle andere Internet Explorer vensters."+
@crlf+"Na 2 minuten òf na het klikken op OK, worden ze automatisch gesloten!",
"KiXtart message",49,120)

;Quit script if CANCEL is pressed
If 2=$rc
Exit 0
EndIf

;KILL all running iexplore.exe; W95 use kill95, NT use WMI
If 2=@inwin
;Still shows dos box ;(
Shell "%comspec% /c @scriptdir\kill95 iexplore.exe > nul"
Else
$GetObj="winmgmts:{impersonationLevel=impersonate}!//@WKSTA"
$Sel="select * from Win32_Process where Name='IEXPLORE.exe'"
For Each $Process in GetObject("$GetObj").ExecQuery("$sel")
$rc=$Process.Terminate
Next
EndIf

;Save previous proxy settings
$prevprox=ReadValue("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings",
"ProxyEnable")
;Enable proxy
$rc=WriteValue("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings",
"ProxyEnable","1","REG_DWORD")
;Set proxy override
$ProxyOverride="PROXY_OVERRIDE_SETTINGS"
$rc=WriteValue("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings",
"ProxyOverride",$ProxyOverride,"REG_SZ")
;Set proxy server to $proxy
$ProxyServer="$proxy"
$rc=WriteValue("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings",
"ProxyServer",$ProxyServer,"REG_SZ")
;Disable CTRL-O in IE
$rc=WriteValue("HKCU\Software\Policies\Microsoft\Internet Explorer\Restrictions",
"NoFileOpen","1","REG_DWORD")
;Disable CTRL-N in IE
$rc=WriteValue("HKCU\Software\Policies\Microsoft\Internet Explorer\Restrictions",
"NoFileNew","1","REG_DWORD")
;Disable F3 in IE
$rc=WriteValue("HKCU\Software\Policies\Microsoft\Internet Explorer\Restrictions",
"NoFindFiles","1","REG_DWORD")
;Disable F11 in IE
$rc=WriteValue("HKCU\Software\Policies\Microsoft\Internet Explorer\Restrictions",
"NoTheaterMode","1","REG_DWORD")
;Disable IE splashscreen
$rc=WriteValue("HKLM\Software\Policies\Microsoft\Internet Explorer\Infodelivery\Restrictions",
"NoSplash","1","REG_DWORD")

;Create IE object
$ie=CreateObject("internetexplorer.application")
;Define IE properties
$ie.addressbar=0
$ie.menubar=0
$ie.statusbar=0
$ie.toolbar=0
$ie.resizable=0
$ie.Left=1
$ie.top=1
$res=Split(getscreenres(),",")
$x=$res[0]
$y=$res[1]
$tb=taskbar()
$y=CInt($y)-$tb
$ie.width=$x
$ie.height=$y

;Display white window
$ie.navigate("about:blank")
;Loop until IE is ready
While $ie.busy AND $ie.readystate <> 4 AND @error=0 Loop
;Make IE window visible
$ie.visible=1

;Browse to $url
$ie.navigate("$url")
;Loop until IE is ready
While $ie.busy AND $ie.readystate <> 4 AND @error=0 Loop

;Restore previous proxy setting
$rc=WriteValue("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings",
"ProxyEnable",$prevprox,"REG_DWORD")

;Quit script
Exit 0

;****************************************************************************
;****************************************************************************
;****************************************************************************
;Following UDF are borrowed from KiXtart buddies...

;Function GetScreenRes written by Kholm
;http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=12;t=000035
Function GetScreenRes()
Dim $Dev,$Idx,$RKey,$ScreenXRes,$ScreenYRes,$SType
$GetScreenRes = ''
If @InWin = 1
If Split(@ProductType)[1] <> "NT"
$Dev = Split('' + WMIQuery("VideoModeDescription","Win32_VideoController"))
If Ubound($Dev) > 1
$GetScreenRes = $Dev[0] + "," + $Dev[2]
EndIf
Else
$RKey="HKLM\SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services"
$Dev = "\Device0"
If KeyExist($RKey)
$Idx = 0
Do
$SType = EnumKey($RKey,$Idx)
If @Error = 0 AND $SType <> "VgaSave"
$ScreenXRes = '' + ReadValue($RKey + "\" + $SType + $Dev,"DefaultSettings.XResolution")
$ScreenYRes = '' + ReadValue($RKey + "\" + $SType + $Dev,"DefaultSettings.YResolution")
Else
$Idx = $Idx + 1
EndIf
Until @Error OR $ScreenXRes
If $ScreenXRes
$GetScreenRes = $ScreenXRes + ',' + $ScreenYRes
EndIf
EndIf
EndIf
Else
$RKey="HKLM\Config\0001\Display\Settings"
If KeyExist($RKey)
$GetScreenRes = ReadValue($RKey,"Resolution")
EndIf
EndIf
EndFunction

;Function WMIQuery written by Radimus
;http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=12;t=000117
Function WMIQuery($what,$where, optional $computer)
Dim $strQuery, $objEnumerator, $value
If NOT $computer $computer="@WKSTA" EndIf
$strQuery = "Select $what From $where"
$SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//$computer")
$objEnumerator = $SystemSet.ExecQuery($strQuery)
For Each $objInstance in $objEnumerator
If @Error = 0 AND $objInstance <> ""
$=Execute("$$value = $$objInstance.$what")
$WMIQuery="$value"+"|"+"$WMIQuery"
EndIf
Next
$WMIQuery=Left($WMIQuery,Len($WMIQuery)-1)
Exit @error
EndFunction

;Function borrowed from Lonkero's bbChecker
Function TaskBar()
If @dos=="4.0" $_S="StuckRects" Else $_S="StuckRects2" EndIf
$TaskBar=Val("&"+SubStr(ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\$_S","settings"),41,2))
EndFunction

Any comments are welcome...
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#89413 - 2002-11-19 03:05 PM Re: Run IE and enable proxy only for this windows
Will Hetrick Offline
Hey THIS is FUN

Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
Richard,
Where would this PAC file reside
_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!

Top
#89414 - 2002-11-19 03:15 PM Re: Run IE and enable proxy only for this windows
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
If you use the IEAK, there's an option to provide proxy settings through a web link. Never used it myself, however, that might work for you.
_________________________
There are two types of vessels, submarines and targets.

Top
#89415 - 2002-11-19 03:16 PM Re: Run IE and enable proxy only for this windows
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Working from memory so bear with me boys..

There are a couple of ways.

Open IE and go to Tools->Internet Options->Connections->LAN Settings

There are two fields of interest. The "Automatically detect settings" will look for a file called "wpad.dat" on a local web server called "wpad". This file should be in the same format as a ".pac" file.

"Use automatic configuration script" will allow you to specify the script name. You are supposed to be able to use local file names rather than a URL, but I haven't tried this.

Both these values should be settable via registry writes during logon.

The ".pac" file is described on Netscapes site, but it applies to both NS and IE. Search MS site for more info - the IEAK has more info.

Top
Page 2 of 2 <12


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 557 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.064 seconds in which 0.037 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org