Título: Utilizar WebBrowser atraves de un proxy.
Publicado por: odeONeSs en 2 Septiembre 2007, 16:23 pm
Hola buenas, me gustaria saber si existe alguna forma de navegar atraves de un Proxy con un control WebBrowser, Hasta ahora lo único que se me ha ocurrido y no da resultado es modificar el registro de windows para que el Iexplorer cambie el su proxy, y asi el WebBrowser tambien este condicionado por ese cambio. No se si usare proxys que no funcionen o yo que se.. os dejo el codigo para que lo veais. No todas las rutinas son mias. Dim i As Integer
Private Sub CambiarProxy(strProxyServer As String)
' ubicacion en la registry Dim strRegPath strRegPath = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\" Set oWshShell = CreateObject("WScript.Shell") ' modifica las entradas en el registro Call oWshShell.RegWrite(strRegPath & "ProxyEnable", "00000001", "REG_DWORD") Call oWshShell.RegWrite(strRegPath & "ProxyOverride", "<local>", "REG_SZ") Call oWshShell.RegWrite(strRegPath & "ProxyServer", strProxyServer, "REG_SZ") ' notificacion MsgBox "Proxy setting enabled. " & vbCrLf & "Server - " & strProxyServer ' destroy Set oWshShell = Nothing End Sub
Private Sub QuitarProxy() Dim strRegPath ' ubicacion en la registry strRegPath = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\" Set oWshShell = CreateObject("WScript.Shell") ' modifica las entradas en el registro Call oWshShell.RegWrite(strRegPath & "ProxyEnable", "00000000", "REG_DWORD") ' notificacion MsgBox "Proxy setting disabled" ' destroy Set oWshShell = Nothing End Sub
Private Sub cargar(lw As ListBox, fname As String) 'carga una lista de servidores de un txt cada servidor en una linea y separdo del puerto por : Dim dire As String dire = App.Path + "\" + fname Open dire For Input As #1 While Not EOF(1) Line Input #1, file_data$ lw.AddItem file_data$ Wend Close #1 End Sub Private Function pinga(ip As String) As Boolean 'Funcion que hace un ping a una ip devuelve true si hace pong
Dim conectado As Boolean Dim Reply As ICMP_ECHO_REPLY Dim lngSuccess As Long Dim strIPAddress As String conectado = False 'Get the sockets ready. If SocketsInitialize() Then 'Address to ping strIPAddress = ip 'Ping the IP that is passing the address and get a reply. lngSuccess = ping(strIPAddress, Reply) 'Display the results. If EvaluatePingResponse(lngSuccess) <> "Success!" Then conectado = False Else conectado = True End If 'Clean up the sockets. SocketsCleanup Else 'Winsock error failure, initializing the sockets. conectado = False pinga = conectado End If pinga = conectado End Function
Private Sub Command1_Click() cargar List1, "proxys.txt" End Sub
Private Sub Command2_Click() 'boton que hace ping y saca el resultado con 2 shape uno verde y otro rojo Dim ip Dim ipbuena As String ip = Split(List1.Text, ":") ipbuena = ip(0) If pinga(ipbuena) = True Then rojo.Visible = False verde.Visible = True Else rojo.Visible = True verde.Visible = False End If
End Sub
Private Sub Command3_Click() 'cambia el proxy desde una lista de proxys 'utilizando el registro de windows CambiarProxy List1.Text End Sub
Private Sub Command4_Click() WebBrowser1.Navigate txt_url.Text End Sub
Private Sub Command5_Click() 'boton que inutiliza el proxy en iexplorer QuitarProxy End Sub
Private Sub Form_Load() On Error Resume Next i = 0 cargar List1, "proxys.txt" 'añade ips locales para hacer pruebas de ping List1.AddItem "192.168.1.1:80" List1.AddItem "192.168.1.4:80" End Sub
Bueno un saludo Gracias ;D
Título: Re: Utilizar WebBrowser atraves de un proxy.
Publicado por: H4NG3R en 2 Septiembre 2007, 19:06 pm
yo recuero k se podian encadenar direcciones, todo y k no todas la proxys lo permiten e estado provando i o e encontra ningu k me deje ya seguir mirando, diria k es asi:
wb1.Navigate "http://" & proxy & "/http:/www.google.es"
la proxy va kn ip i puerto
Enga espero k te sirva d argo!
H4NG3R
Título: Re: Utilizar WebBrowser atraves de un proxy.
Publicado por: odeONeSs en 2 Septiembre 2007, 19:33 pm
Gracias voy a probar
Un saludo!
Título: Re: Utilizar WebBrowser atraves de un proxy.
Publicado por: HaDeS, - en 2 Septiembre 2007, 19:41 pm
:O Si!, podes navegar con el anonymouse, es una aplicacion web que permite que al final de la url podas poner una web para navegar como proxy. http://anonymouse.org/cgi-bin/anon-www.cgi/http://[web]
u otras que dicen que funcionan pero en realidad no: http://anonym.to/?http://[web] http://anonym-url.com/go.php?to=http://[web]
Lo que dices H4NG3R, son servidores proxy con el puerto 80 abierto. enseguida busco de esa forma y la meto por aca :P. Bueno, el tema ya se habia posteado abajo, asi que buscalo :P Saludos :D
Título: Re: Utilizar WebBrowser atraves de un proxy.
Publicado por: H4NG3R en 11 Septiembre 2007, 19:54 pm
exacto xD
|