Hack Forums
[.NET] Using proxies with a web browser. - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Using proxies with a web browser. (/showthread.php?tid=4494830)



Using proxies with a web browser. - r00t_z - Oct 17, 2014

Just thought I'd release this as it may come in handy to people.

This is not my code!

Code
<Runtime.InteropServices.DllImport("wininet.dll", SetLastError:=True)> _
    Private Shared Function InternetSetOption(ByVal hInternet As IntPtr, ByVal dwOption As Integer, ByVal lpBuffer As IntPtr, ByVal lpdwBufferLength As Integer) As Boolean
    End Function

    Public Structure Struct_INTERNET_PROXY_INFO
        Public dwAccessType As Integer
        Public proxy As IntPtr
        Public proxyBypass As IntPtr
    End Structure

    Private Sub UseProxy(ByVal strProxy As String)
        Const INTERNET_OPTION_PROXY As Integer = 38
        Const INTERNET_OPEN_TYPE_PROXY As Integer = 3

        Dim struct_IPI As Struct_INTERNET_PROXY_INFO

        struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY
        struct_IPI.proxy = Marshal.StringToHGlobalAnsi(strProxy)
        struct_IPI.proxyBypass = Marshal.StringToHGlobalAnsi("local")

        Dim intptrStruct As IntPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(struct_IPI))

        Marshal.StructureToPtr(struct_IPI, intptrStruct, True)

        Dim iReturn As Boolean = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI))
    End Sub


USAGE:
Code
UseProxy("IP:PORT")
            WebBrowser1.Navigate("LINK")



* - Zeivu~ - Oct 17, 2014

Nice C+Ping the Code from youtube
If you gonna post something make it your code
not someone elses !


* - r00t_z - Oct 24, 2014

(Oct 17, 2014 03:52 PM)Zeivu~ Wrote:  Nice C+Ping the Code from youtube
If you gonna post something make it your code
not someone elses !
If I want to post something, then I will. Someone may find this useful.


* - Cornflower Blue இڿڰۣ-ڰۣ— - Oct 24, 2014

Copy and pasting code and not giving credits is not good.
Please leave this section if this is all you are going to do.


* - WZDY - Oct 24, 2014

Some people might actually find this handy.
No reason to hate as the OP said that this wasn't by him.

Anyways, thanks for sharing.


* - r00t_z - Oct 24, 2014

(Oct 24, 2014 08:14 AM)The Flash ϟ Wrote:  Some people might actually find this handy.
No reason to hate as the OP said that this wasn't by him.

Anyways, thanks for sharing.
Exactly. Thank you for appreciating the share.

I found this on Google somewhere and couldn't find it on here, hence the reason I posted it.


* - kenny3514 - Oct 24, 2014

Thanks man is very usefull, thanks for share :)


* - Who Soup - Oct 24, 2014

Thanks for the useful share OP

I personally wouldn't use it because it would fuck all of my internet explorer settings.


* - Archives - Oct 24, 2014

Thanks for the share OP. It might be helpful.
Spoiler (Click to View)