Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

[Simple]Tut how to make VPN GUI [VB 6 + OPENVPN Commands] ]

Status
Not open for further replies.
palitan mu ang " >log.txt" ng "--log log.txt"

kasi pag " >log.txt" gamit mo mag produce sya ng process na cmd.exe tingnan mo sa taskmanager.

Dim test As String
test = "openvpn --config test.ovpn --remote 184.x.x.x--port 9200 --ca ca\ca.crt --log log.txt"
Shell "cmd /c" & test, vbHide
End Sub

pwede mo rin gamitin to

xample ito ang config.ovpn
Code:
client
dev tun
proto udp
remote 10.xxx.xxx.xxx 9200
script-security 2
resolv-retry infinite
lport 53
persist-key
persist-tun
ca ca.crt
comp-lzo
mute 3
tun-mtu 2000
tun-mtu-extra 32
mssfix 1450
auth-user-pass password.txt
reneg-sec 0
keepalive 10 120
route-method exe



ito ang gawin mo sa vb6 mo
Code:
Private Sub Connect_Click()
dim test as string
test ="openvpn --client --dev tun --proto udp --remote 10.xxx.xxx.xxx 9200 --script-security 2 --resolv-retry infinite --lport 53 --persist-key --persist-tun --ca ca.crt --comp-lzo --mute 3 --tun-mtu 2000 --tun-mtu-extra 32 --mssfix 1450 --auth-user-pass password.txt --reneg-sec 0 --keepalive 10 120 --route-method exe --log log.txt" 'dapat isang linya lang ito '
shell "cmd /c" & test,vbhide
End Sub

Private Sub Connect_Click()
dim test as string
test ="openvpn --client --dev tun --proto udp --remote 10.xxx.xxx.xxx 9200 --script-security 2 --resolv-retry infinite --lport 53 --persist-key --persist-tun --ca ca.crt --comp-lzo --mute 3 --tun-mtu 2000 --tun-mtu-extra 32 --mssfix 1450 --auth-user-pass password.txt --reneg-sec 0 --keepalive 10 120 --route-method exe --log log.txt" 'dapat isang linya lang ito '
shell "cmd /c" & test,vbhide
End Sub

sir ginawa ko na po ito eh kaso nag eerror.. sa persist-key then pati sa --float kaya inalis ko na lang :) okay na yung ip at port lang ang nakatago :)
 
baka makatulong din sa inyo to split() function
use po nito kukunin nya po cetain part ng isang text "textline sa log" para mapaganda nyo yung log details tsaka 2 din ginamit ko para malaman ng client na connected na cla..

xample...

textline="Tue Jun 21 16:54:40 2011 Initialization Sequence Completed"

Dim lines() As String

lines = Split(textline, " ", -1, vbTextCompare)

--------------------
lines(0)="Tue"
lines(1)="Jun"
etc....

sample para displaystatus..

if lines(6)="Completed" then
lblstatus.caption="Connected"
endif


eto naman po sir paturo kung paano
 
wew hintayin lang natin ung mga ipopost ng mga imba nating kaibigan sooner or later lalabas din ung end user tut nang mga kaibigan natin heheh


gudluck sa atin ^^:clap:
 
--port 9200 kung smart ang modem
--port 53 kung globe ang modem

EDIT:
Mas maganda nyan, wag nyo muna i-embed ang mga options ng openvpn, magrely lang po muna kayo sa mga nakalagay sa ovpn files, bale ganito ang example ko:\

SAMPLE.OVPN
Code:
client
dev tap
#dev-node MyTAP  #If you renamed your TAP interface or have more than one TAP interface then remove the # at the beginning and change "MyTAP" to its name
proto udp
remote YOURHOST.dyndns.org 1194  #You will need to enter you dyndns account or static IP address here. The number following it is the port you set in the server's config
resolv-retry infinite
nobind
persist-key
persist-tun
ca "ca.crt"
cert "client2.crt" # Change the next two lines to match the files in the keys directory.  This should be be different for each client.
ns-cert-type server
cipher BF-CBC        # Blowfish (default) encrytion
comp-lzo
verb 1

Event code:
Code:
Private Sub Connect_Click()
Shell App.Path + "\openvpn.exe --config " + App.Path + "(location of config files)\Sample.ovpn --port (PORT NUMBER)"
End Sub
boss salamat sa pagtulong..
 
ang ganda na ng gui ko haha. ginamit ko ang napag aralan ko ng apat na taon as comsci at vb 6 din ang ginamit namin 4 thesis kaya maganda ung gui ko haha. jowk
 
weee...! ito na OpenVPN gui ko...

rrlelh.jpg


btw i'm using VB.net 2008...
 
pano po mag screen shot dito?


ok lng poh basta ung source code... :salute:

EDIT: here's the source code

xenxa na wala kac attach button sa edit...

Note: wla pa poh yan ung sa log kac inuna ko ung auto reconnect ( di pa finalize kac 1 beses lng mag auto recon) reciv, sent bytes tas ung down at up speed nya...

Imports System.IO
Public Class Form1

Public Sub pror(ByRef strProcessToKill As String)
Dim proc() As Process = Process.GetProcesses
For p As Integer = 0 To proc.GetUpperBound(0)
If proc(p).ProcessName = strProcessToKill Then
proc(p).Kill()
End If
Next
End Sub


Public Shared Function FormatFileSize(ByVal Size As Long) As String
Try
Dim KB As Integer = 1024
Dim MB As Integer = KB * KB
' Return size of file in kilobytes.
If Size < KB Then
Return (Size.ToString("D") & " bytes")
Else
Select Case Size / KB
Case Is < 1000
Return (Size / KB).ToString("N") & "KB"
Case Is < 1000000
Return (Size / MB).ToString("N") & "MB"
Case Is < 10000000
Return (Size / MB / KB).ToString("N") & "GB"
End Select
End If
Catch ex As Exception
Return Size.ToString
End Try
End Function

Dim i, k As Integer

Public Function lines(ByVal file_path As String, ByVal line2read As Integer) As String
Dim line(1000) As String
i = 0
FileOpen(1, file_path, OpenMode.Input, OpenAccess.Read, OpenShare.Shared)
Do Until EOF(1)
line(i) = LineInput(1)
i += 1
Loop
FileClose(1)
Return line(line2read)
End Function

Dim log_show As Integer = 0

Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
intro.Dispose()
intro.Close()
Me.Dispose()
Me.Close()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label5.ForeColor = Color.Maroon
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If log_show = 0 Then
log_show = 1
GroupBox3.Location = New Point(7, 255)
Me.Size = New System.Drawing.Size(384, 451)
Panel1.Size = New System.Drawing.Size(372, 396)
Else
log_show = 0
GroupBox3.Location = New Point(7, 270)
Me.Size = New System.Drawing.Size(384, 288)
Panel1.Size = New System.Drawing.Size(372, 234)
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button1.Text = "Connect" Then
Button1.Enabled = False
Label5.Text = "Connecting"
Label5.Location = New Point(Int((GroupBox4.Width - Label5.Width) / 2), 18)
Shell("bin\openvpn --client --dev tun --remote x.x.x.x --proto udp --port 9200 --lport 53 --persist-key --persist-tun --ca crt\torrent_UDP.crt --comp-lzo --mute 3 --tun-mtu 1500 --auth-user-pass crt\account.txt --reneg-sec 0 --keepalive 10 120 --route-method exe --route-delay 2 --verb 3 --log crt\log.txt --status crt\stat.db 1", AppWinStyle.Hide)
Timer1.Enabled = True
connecting_Timer.Enabled = True
speed_Timer.Enabled = True
speed2_Timer.Enabled = True
ElseIf Button1.Text = "Stop" Then
pror("openvpn")
stopping_while_connecting_Timer.Enabled = True
connecting_Timer.Enabled = False
Button1.Enabled = False
Button1.Text = "Pls wait..."
Else
speed_Timer.Enabled = False
speed2_Timer.Enabled = False
disconnecting_Timer.Enabled = True
Button1.Text = "Disconnecting"
Button1.Enabled = False
End If
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim str, str2 As String
str = lines("crt\stat.db", 4)
str2 = lines("crt\stat.db", 5)
If str <> "" Then
Label9.Text = FormatFileSize(Int32.Parse(Mid(str, 20))) 'FormatFileSize(bitt)
End If
If str2 <> "" Then
Label10.Text = FormatFileSize(Int32.Parse(Mid(str2, 21))) 'FormatFileSize(bitt)
End If
End Sub

Dim disconnecting_Timer_ctr As Integer

Private Sub disconnecting_Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles disconnecting_Timer.Tick
disconnecting_Timer_ctr += 1
If disconnecting_Timer_ctr >= 5 Then
pror("openvpn")
Timer1.Enabled = False
Label5.ForeColor = Color.Maroon
Label5.Text = "Disconnected"
Label5.Location = New Point(Int((GroupBox4.Width - Label5.Width) / 2), 18)
Button1.Text = "Connect"
Button1.Enabled = True
disconnecting_Timer_ctr = 0
disconnecting_Timer.Enabled = False
End If
End Sub

Dim last_reciv As Integer = 0
Dim last_sent As Integer = 0
Dim time_out As Integer = 0
Dim speed_down As Integer = 0
Dim recon As Integer = 0
Dim recon_time_out As Integer = 0
Dim retry_in As Integer = 10

Private Sub speed_Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles speed_Timer.Tick
Dim str As String
Dim current_reciv As Integer
str = lines("crt\stat.db", 4)
If str <> "" Then
current_reciv = Int(Int32.Parse(Mid(str, 20)))
speed_down = Int(current_reciv - last_reciv)
last_reciv = current_reciv
'If speed_down = 0 Then
'time_out += 1
'Label13.Text = time_out
'End If
End If
'If time_out = 20 Then
'imer2.Enabled = False
' speed_Timer.Enabled = False
'speed2_Timer.Enabled = False
'disconnecting_Timer.Enabled = True
' Button1.Text = "Disconnecting"
' Button1.Enabled = False
' MsgBox("Connection Failed!")
'End If
If speed_down > 0 Then
' time_out = 0
Label4.Text = FormatFileSize(speed_down)
End If

End Sub

Private Sub speed2_Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles speed2_Timer.Tick
Dim str As String
Dim current_sent, speed_up As Integer
str = lines("crt\stat.db", 5)
If str <> "" Then
current_sent = Int32.Parse(Mid(str, 21))
speed_up = current_sent - last_sent
last_sent = current_sent
End If
If speed_up > 0 Then
Label12.Text = FormatFileSize(speed_up)
End If
End Sub

Private Sub connecting_Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles connecting_Timer.Tick
Dim str As String
Dim j As Long
str = lines("crt\stat.db", 6)
If str <> "" Then
j = Int32.Parse(Mid(str, 17))
End If
If i > 12 Then
Button1.Enabled = False
Button1.Text = "Pls wait..."
End If
If k <= 60 Then
If i <= 12 And j < 1 Then
k += 1
Button1.Text = "Stop"
Label5.Text = "Connecting"
Button1.Enabled = True
ElseIf i > 12 And j > 0 Then
k = 0
Button1.Text = "Disconnect"
Label5.ForeColor = Color.Green
Label5.Text = "Connected"
Button1.Enabled = True
connecting_Timer.Enabled = False
chck_Timer.Enabled = True
End If
Else
pror("openvpn")
Button1.Text = "Connect"
Label5.Text = "Disconnected"
Button1.Enabled = True
connecting_Timer.Enabled = False
k = 0
MsgBox("Connection Failed!")
End If
Label5.Location = New Point(Int((GroupBox4.Width - Label5.Width) / 2), 18)
End Sub

Private Sub chck_Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chck_Timer.Tick
If speed_down = 0 Then
time_out += 1
Else
time_out = 0
End If
Label13.Text = time_out
If time_out = 30 Then
recon += 1
pror("openvpn")
reconnecting_Timer.Enabled = True
chck_Timer.Enabled = False
time_out = 0
End If
End Sub

Private Sub recon_Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles recon_Timer.Tick
Dim str As String
Dim j As Long
str = lines("crt\stat.db", 6)
If str <> "" Then
j = Int32.Parse(Mid(str, 17))
End If
If i > 12 Then
Button1.Enabled = False
Button1.Text = "Pls wait..."
End If
If k <= 60 Then
If i <= 12 And j < 1 Then
k += 1
Button1.Text = "Stop"
Label5.Text = "Reconnecting"
Button1.Enabled = True
ElseIf i > 12 And j > 0 Then
k = 0
Button1.Text = "Disconnect"
Label5.ForeColor = Color.Green
Label5.Text = "Connected"
Button1.Enabled = True
recon_Timer.Enabled = False
reconnecting_Timer.Enabled = False
chck_Timer.Enabled = True
End If
Else
pror("openvpn")
Button1.Text = "Connect"
Label5.Text = "Disconnected"
Button1.Enabled = True
recon_Timer.Enabled = False
k = 0
MsgBox("Connection Failed!")
End If
Label5.Location = New Point(Int((GroupBox4.Width - Label5.Width) / 2), 18)
End Sub

Dim stopping_while_connecting As Integer = 0
Private Sub stopping_while_connecting_Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles stopping_while_connecting_Timer.Tick
If stopping_while_connecting >= 3 Then
speed_Timer.Enabled = False
speed2_Timer.Enabled = False
Timer1.Enabled = False
Label5.Text = "Disconnected"
Label5.Location = New Point(Int((GroupBox4.Width - Label5.Width) / 2), 18)
Button1.Text = "Connect"
Button1.Enabled = True
stopping_while_connecting = 0
stopping_while_connecting_Timer.Enabled = False
k = 0
Else
stopping_while_connecting += 1
End If
End Sub

Dim reconnecting As Integer = 10
Dim reconnecting_state As Integer = 10

Private Sub reconnecting_Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles reconnecting_Timer.Tick
If reconnecting = 0 Then
Shell("bin\openvpn --client --dev tun --remote x.x.x.x --proto udp --port 9200 --lport 53 --persist-key --persist-tun --ca crt\torrent_UDP.crt --comp-lzo --mute 3 --tun-mtu 1500 --auth-user-pass crt\account.txt --reneg-sec 0 --keepalive 10 120 --route-method exe --route-delay 2 --verb 3 --log crt\log.txt --status crt\stat.db 1", AppWinStyle.Hide)
recon_Timer.Enabled = True
reconnecting = 10
reconnecting_Timer.Enabled = false
Else
Button1.Text = "Retry in " & reconnecting
reconnecting_state = 1
reconnecting -= 1
End If
End Sub
End Class
 
Last edited:
ok lng poh basta ung source code... :salute:

EDIT: here's the source code

xenxa na wala kac attach button sa edit...

Note: wla pa poh yan ung sa log kac inuna ko ung auto reconnect ( di pa finalize kac 1 beses lng mag auto recon) reciv, sent bytes tas ung down at up speed nya...

sir, isang form lang to noh?
 
yep isang form lng poh... ung "intro.close()" sa splash screen ko poh yan... delete nyo nlng poh yan... mag eerror kac yan...
 
weee...! ito na OpenVPN gui ko...

rrlelh.jpg


btw i'm using VB.net 2008...

sir hindi mo ba pwede i attach ung lahat ng solution mo? un pag aralan ko. vb 6 lng kasi ako hehe. tnx. pero pag hindi ok lng sir. thanks
 
sir hindi mo ba pwede i attach ung lahat ng solution mo? un pag aralan ko. vb 6 lng kasi ako hehe. tnx. pero pag hindi ok lng sir. thanks

yan lng poh muna boss basta ung code eh working sa akin... dami kac pasaway... :salute:
 
yan lng poh muna boss basta ung code eh working sa akin... dami kac pasaway... :salute:

salamat sir ok na sa akin itong code na ito :) malaking tulong sa newbie na katulad ko... para mapag aralan ng mabuti ang vb6 :clap:

sana po wag kayong mag sawang tumulong... magpost din po ako dito kapag may natutunan ako mula sa mga tech na kasama ko
 
ok lng poh basta ung source code... :salute:

EDIT: here's the source code

xenxa na wala kac attach button sa edit...

Note: wla pa poh yan ung sa log kac inuna ko ung auto reconnect ( di pa finalize kac 1 beses lng mag auto recon) reciv, sent bytes tas ung down at up speed nya...
attach mo na xa mp3sniff ganda eh
 
visual studio 2008 or above dapat gamitin sir... :salute:

@ford_0008

iwas cloning poh boss... tsaka dami po buwaya sa paligid....
 
Last edited:
Status
Not open for further replies.
Back
Top Bottom