• Breaking News

    Panduan dan Tutorial Lengkap serta Materi Pelajaran di Mulyono Blog. Konten Terlengkap dan Terpercaya

    Kamis, 01 September 2011

    Membuat Web Browser Proxy Dengan VB6


    Terkadang kita ingin browsing ke internet dengan aman. Tanpa meninggalkan jejak ataupun berselancar dengan anonim. Kita membutuhkan sebuah web browser yang mampu berpindah - pindah IP adrress dengan cepat. Memang sih...saat ini sudah banyak browser yang menyediakan fasilitas ini. Akan tetapi sangat ribet dan butuh pengaturan yang lumayan menjengkelkan. Pada tutorial kali ini akan kita buat web browser sendiri yang mampu memilih IP Address dengan cepat.

    Jika anda tertarik silakan buka program visual basic anda dan ikuti langkah - langkah berikut

    1. Buat sebuah project baru. Masukkan sebuah textbox,windows common dialog dan kontrol WebBrowser. Dan masukkan pula sebuah tombol Command Button untuk proses koneksi.

    2. Buat sebuah modul dan masukkan coding berikut

    Option Explicit
    Private Type INTERNET_PER_CONN_OPTION

    dwOption As Long
    dwValue1 As Long
    dwValue2 As Long

    End Type

    Private Type INTERNET_PER_CONN_OPTION_LIST
    dwSize As Long
    pszConnection As Long
    dwOptionCount As Long
    dwOptionError As Long
    pOptions As Long

    End Type

    Private Const INTERNET_PER_CONN_FLAGS As Long = 1
    Private Const INTERNET_PER_CONN_PROXY_SERVER As Long = 2
    Private Const INTERNET_PER_CONN_PROXY_BYPASS As Long = 3
    Private Const PROXY_TYPE_DIRECT As Long = &H1
    Private Const PROXY_TYPE_PROXY As Long = &H2
    Private Const INTERNET_OPTION_REFRESH As Long = 37
    Private Const INTERNET_OPTION_SETTINGS_CHANGED As Long = 39
    Private Const INTERNET_OPTION_PER_CONNECTION_OPTION As Long = 75

    Private Declare Function InternetSetOption Lib "wininet.dll" Alias "InternetSetOptionA" ( _
    ByVal hInternet As Long, ByVal dwOption As Long, _
    lpBuffer As Any, ByVal dwBufferLength As Long) As Long

    'Untuk mengatur Proxy

    Public Function SetConnectionOptions(ByVal conn_name As String, ByVal proxy_full_addr As String) As Boolean

    Dim list As INTERNET_PER_CONN_OPTION_LIST
    Dim bReturn As Boolean
    Dim dwBufSize As Long
    Dim options(0 To 2) As INTERNET_PER_CONN_OPTION
    Dim abConnName() As Byte
    Dim abProxyServer() As Byte
    Dim abProxyBypass() As Byte
    dwBufSize = Len(list)
    list.dwSize = Len(list)
    abConnName() = StrConv(conn_name & vbNullChar, vbFromUnicode)
    list.pszConnection = VarPtr(abConnName(0))
    list.dwOptionCount = 3
    options(0).dwOption = INTERNET_PER_CONN_FLAGS
    options(0).dwValue1 = PROXY_TYPE_DIRECT Or PROXY_TYPE_PROXY
    options(1).dwOption = INTERNET_PER_CONN_PROXY_SERVER
    abProxyServer() = StrConv(proxy_full_addr & vbNullChar, vbFromUnicode)
    options(1).dwValue1 = VarPtr(abProxyServer(0)) '//"http://proxy:80"
    options(2).dwOption = INTERNET_PER_CONN_PROXY_BYPASS
    abProxyBypass() = StrConv("local" & vbNullChar, vbFromUnicode)
    options(2).dwValue1 = VarPtr(abProxyBypass(0))
    list.pOptions = VarPtr(options(0))

    If (0& = list.pOptions) Then
    Debug.Print "Failed to allocate memory in SetConnectionOptions()"
    SetConnectionOptions = 0
    End If
    bReturn = InternetSetOption(0, INTERNET_OPTION_PER_CONNECTION_OPTION, list, dwBufSize)
    Erase options
    Erase abConnName
    Erase abProxyServer
    Erase abProxyBypass
    dwBufSize = 0
    list.dwOptionCount = 0
    list.dwSize = 0
    list.pOptions = 0
    list.pszConnection = 0
    Call InternetSetOption(0, INTERNET_OPTION_SETTINGS_CHANGED, ByVal 0&, 0)
    Call InternetSetOption(0, INTERNET_OPTION_REFRESH, ByVal 0&, 0)
    SetConnectionOptions = bReturn

    End Function

    'Matikan Proxy

    Public Function DisableConnectionProxy(ByVal conn_name As String) As Boolean
    Dim list As INTERNET_PER_CONN_OPTION_LIST
    Dim bReturn As Boolean
    Dim dwBufSize As Long
    Dim options(0) As INTERNET_PER_CONN_OPTION
    Dim abConnName() As Byte
    dwBufSize = Len(list)
    list.dwSize = Len(list)
    abConnName() = StrConv(conn_name & vbNullChar, vbFromUnicode)
    list.pszConnection = VarPtr(abConnName(0))
    list.dwOptionCount = 1
    options(0).dwOption = INTERNET_PER_CONN_FLAGS
    options(0).dwValue1 = PROXY_TYPE_DIRECT
    list.pOptions = VarPtr(options(0))
    If (0 = list.pOptions) Then
    Debug.Print "Failed to allocate memory in DisableConnectionProxy()"
    DisableConnectionProxy = 0
    End If

    bReturn = InternetSetOption(0, INTERNET_OPTION_PER_CONNECTION_OPTION, list, dwBufSize)
    Erase options
    Erase abConnName
    dwBufSize = 0
    list.dwOptionCount = 0
    list.dwSize = 0
    list.pOptions = 0
    list.pszConnection = 0
    Call InternetSetOption(0, INTERNET_OPTION_SETTINGS_CHANGED, ByVal 0&, 0)
    Call InternetSetOption(0, INTERNET_OPTION_REFRESH, ByVal 0&, 0)
    DisableConnectionProxy = bReturn
    End Function


    3. Pada form silakan masukkan coding berikut

    Dim URL As String
    Dim conn_name As String, proxy_full_addr As String

    Private Sub CMDPROXY_Click()
    C.Filter = "File format TXT (*.txt) | *.txt"
    C.DialogTitle = "Pilih file TXT"
    C.ShowOpen
    fileName = C.fileName
    List1.Clear

    On Error Resume Next
    Open fileName For Input As #1
        Do While Not EOF(1)
            Line Input #1, listItem
            If Not (listItem = "") Then
                List1.AddItem listItem
            End If
        Loop
    Close #1
    End Sub

    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
    Case vbKeySpace
    StylerButton3_Click
    End Select
    End Sub

    Private Sub Form_Unload(Cancel As Integer)
    conn_name = TXTKONEKSI.Text
    Call DisableConnectionProxy(conn_name)
    Unload Me
    End Sub

    Private Sub WriteToRegistry(strFolder As String, strString, Optional strRegType As String = "REG_SZ")
        On Error Resume Next
        Dim b As Object
        Set b = CreateObject("wscript.shell")
        b.RegWrite strFolder, strString, strRegType
    End Sub

    Private Sub StylerButton1_Click()
    SAMBUNG
    End Sub

    Private Sub StylerButton4_Click()
    Timer3.Enabled = False
    WebBrowser1.Stop
    LBLCOUNT.Caption = "0"
    conn_name = TXTKONEKSI.Text
    Call DisableConnectionProxy(conn_name)
    End Sub

    Sub SAMBUNG()
    WebBrowser1.Stop
    WriteToRegistry "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", 1, "REG_DWORD" 'aktifkan proxies
    Dim itemnumber As Integer
    itemnumber = 0
    URL = TXTALAMAT.Text
    conn_name = TXTKONEKSI.Text
    proxy_full_addr = (List1.list(itemnumber))
    Call SetConnectionOptions(conn_name, proxy_full_addr)
    List1.RemoveItem (0)
    Label7.Caption = List1.ListCount
    LBLPERKIRAAN.Caption = List1.ListCount * TXTDETIK / 60 & " Menit"
    LBLPROXY.Caption = (List1.list(itemnumber))
    WebBrowser1.Navigate (URL)
    Timer2.Enabled = True
    End Sub


    Untuk selanjutnya silakan anda coba dan kembangkan sendiri. Masih banyak kemampuan yang bisa digali dalam pembuatan Web Browser.


    Project yang sedang saya kembangkan adalah Web Browser Proxy yang memakai timer. Sehingga bisa mengakali account di Linkbucks.com dan adf.ly. Lumayanlah...dapat dollar tanpa perlu kerja keras. Serta dipersenjatai pula dengan fitur Checking Proxy. Sehingga kita bisa memilih IP Proxy yang masih aktif.