PDA

View Full Version : How do we create log file with time set



IRduranni
01-06-2014, 09:07 AM
Hello,
How do we create log file with time set? here what i mean
11060

Here is my timer code


Private Sub logtimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles logtimer.Tick

Dim textline(100000) As String
Dim log_ctr As Integer
Dim last_log As Integer


PictureBoxProgressbar.BackgroundImage = OreVPN.My.Resources.progress30
logs.Text = ""

'WARNING
'the file log.txt must exits or this will give an error, openvpn's configuration files must not disable logging.
Dim a As String = "Time:" + " " + Format(TimeOfDay)
FileOpen(1, Application.StartupPath & "\data\log.txt", OpenMode.Input, , OpenShare.LockRead)
Do Until EOF(1)

textline(log_ctr) = LineInput(1)
log_ctr = log_ctr + 1
If last_log <> log_ctr Then

For n = last_log To log_ctr - 1

If InStrRev(textline(n), "OreVPN") > 0 Then
PictureBoxProgressbar.BackgroundImage = OreVPN.My.Resources.progress40
logs.SelectedText = "Connecting to the Network......." & vbCrLf

ElseIf InStrRev(textline(n), "this configuration to call") > 0 Then
PictureBoxProgressbar.BackgroundImage = OreVPN.My.Resources.progress50
logs.SelectedText = "Bypassing ISP Sever Firewall......" & vbCrLf & "Accessing Server....please wait" & vbCrLf

ElseIf InStrRev(textline(n), "Peer Connection Initiated with 0.0.0.0:0") > 0 Then
PictureBoxProgressbar.BackgroundImage = OreVPN.My.Resources.progress60
logs.SelectedText = "Hacking Server System...." & vbCrLf

ElseIf InStrRev(textline(n), "TAP-WIN32 device") > 0 Then
PictureBoxProgressbar.BackgroundImage = OreVPN.My.Resources.progress70
logs.SelectedText = "Injecting Server with code OreVX01...." & vbCrLf

ElseIf InStrRev(textline(n), "NETSH: C:\WINDOWS\system32\netsh.exe interface ip set address {") > 0 Then
PictureBoxProgressbar.BackgroundImage = OreVPN.My.Resources.progress80
logs.SelectedText = "Warning!! You Have been detected!!" & vbCrLf & "Your IP have being save & send to the police!!" & vbCrLf

ElseIf InStrRev(textline(n), "Successful ARP Flush on interface") > 0 Then
PictureBoxProgressbar.BackgroundImage = OreVPN.My.Resources.progress90
logs.SelectedText = "Successful ARP Flush" & vbCrLf

ElseIf InStrRev(textline(n), "Initialization Sequence Completed") > 0 Then
'CONNECT SUCCESSFUL
'set the timer to a 30 sec interval to minimize file access but not too long to prevent a timeout
log_Timer.Interval = 30000
PictureBoxProgressbar.BackgroundImage = OreVPN.My.Resources.progress100
logs.SelectedText = "You're Connected to our System, Enjoy Your Browsing" & vbCrLf & "--OreVPN Team--"
status_lbl.Text = "Connected"
status_lbl.ForeColor = Color.Lime
title_lbl.Text = "OreVPN v" & myver & ""
title_lbl.ForeColor = Color.Lime
'ENABLE STATISTICS
'starts timer for bandwidth calculations and display
TimerBandwidth.Enabled = True
'starts timer for ping latency and display
TimerLatency.Enabled = True
GroupBox1.Visible = True
PictureBoxProgressbar.Visible = False
konekbtn.Enabled = False
dkonekbtn.Enabled = True


update_timer.Enabled = True


ElseIf InStrRev(textline(n), "Inactivity timeout (--ping-restart), restarting") > 0 Then
PictureBoxProgressbar.BackgroundImage = OreVPN.My.Resources.progress50
logs.SelectedText = TimeOfDay & "Connection Timeout"
status_lbl.Text = "Disconnected"
disconnectroutine()

ElseIf InStrRev(textline(n), "Exiting") > 0 Then
PictureBoxProgressbar.BackgroundImage = OreVPN.My.Resources.progress50
logs.SelectedText = TimeOfDay & "Connection Timeout"
disconnectroutine()

ElseIf InStrRev(textline(n), "AUTH: Received AUTH_FAILED control message") > 0 Then
disconnectroutine()
logs.Text = TimeOfDay & "***AUTH FAILED***" & vbCrLf & "Please Check Your Username and Password" & vbCrLf & vbCrLf & "Contact your reseller for help" & vbCrLf & vbCrLf & "======OreVPN Team======"
MessageBox.Show("Please Check Your Username & Password", "Authentication Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If

Next

last_log = log_ctr

End If
Loop
FileClose(1)


End Sub