-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathForm1.vb
162 lines (140 loc) · 7.21 KB
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Text.RegularExpressions
Imports Microsoft.Win32
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Public Class Form1
Dim dteStart As Date = Nothing
Dim dteEnd As Date = Nothing
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "0", RegistryValueKind.DWord)
ValueDataGeoCountry()
End Sub
Private Sub btnApply_Click(sender As Object, e As EventArgs) Handles btnApply.Click
Timer1.Enabled = True
dteStart = DateTime.Now
Dim proxy As String = txtIP.Text
lbConnection.Text = "Connected!"
lbtxt1.Text = "Secure: Your internet traffic is encrypted and"
lbtxt2.Text = "your virtual online identity is private."
lbConnection.ForeColor = Color.Green
PictureBox1.Image = ImageList1.Images(0)
Dim matches As MatchCollection = Regex.Matches(proxy, "\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}")
For Each m As Match In matches ' Loop over matches.
For Each c As Capture In m.Captures ' Loop over captures.
lbIPProxy.Text = c.Value
ProxyDataGeoCountry(c.Value)
Next
Next
If My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", Nothing) Is Nothing Then
My.Computer.Registry.CurrentUser.CreateSubKey("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings")
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", proxy)
'Proxy Enable:
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "1", RegistryValueKind.DWord)
Else
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", proxy)
'Proxy Enable:
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "1", RegistryValueKind.DWord)
End If
End Sub
Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
dteEnd = DateTime.Now
Dim proxy As String = txtIP.Text
lbConnection.Text = "Not connected!"
lbtxt1.Text = "Warning: Your internet traffic is unencrypted and"
lbtxt2.Text = "your virtual online identity is exposed."
lbConnection.ForeColor = Color.Red
PictureBox1.Image = ImageList1.Images(1)
lbIPProxy.Text = "***.***.***.***"
lbCountryProxy.Text = "**"
'Proxy Enable:
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "0", RegistryValueKind.DWord)
Timer1.Enabled = False
End Sub
Private Function ValueDataGeoCountry()
Try
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
' old: https://ipapi.co/json
Dim json As String = New System.Net.WebClient().DownloadString("https://ipinfo.io/json")
Dim parsejson As JObject = JObject.Parse(json)
Dim ipadd As String = parsejson.SelectToken("ip").ToString()
Dim country As String = parsejson.SelectToken("country").ToString()
Dim country_name As String = parsejson.SelectToken("region").ToString() + ", " + parsejson.SelectToken("country").ToString()
lbIPPublic.Text = ipadd
lbCountry.Text = country_name
pbCountry.Image = Image.FromFile("flag\" + LCase(country) + ".png")
Return Nothing
Catch
Return Nothing
End Try
End Function
Private Function ProxyDataGeoCountry(ipproxy As String)
' old: https://ipapi.co/json
Dim URLTOGEO As String = "https://ipinfo.io/" + ipproxy + "/json"
Try
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
Dim json As String = New System.Net.WebClient().DownloadString(URLTOGEO)
Dim parsejson As JObject = JObject.Parse(json)
Dim ipadd As String = parsejson.SelectToken("ip").ToString()
Dim country As String = parsejson.SelectToken("country").ToString()
Dim country_name As String = parsejson.SelectToken("region").ToString() + ", " + parsejson.SelectToken("country").ToString()
lbIPProxy.Text = ipadd
lbCountryProxy.Text = country_name
pxCountry.Image = Image.FromFile("flag\" + LCase(country) + ".png")
Return Nothing
Catch
Return Nothing
End Try
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Form2.Show()
End Sub
Private Sub Notify_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles Notify.MouseDoubleClick
ShowInTaskbar = True
Me.WindowState = FormWindowState.Normal
Notify.Visible = False
End Sub
Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
If Me.WindowState = FormWindowState.Minimized Then
Notify.Visible = True
'Notify.Icon = SystemIcons.Application
Notify.BalloonTipIcon = ToolTipIcon.Info
Notify.BalloonTipTitle = "NextProxy"
Notify.BalloonTipText = "NextProxy will remain hidden."
Notify.ShowBalloonTip(10000)
'Me.Hide()
ShowInTaskbar = False
End If
End Sub
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
' FormClosing disconnect proxy connection.
Dim proxy As String = txtIP.Text
lbConnection.Text = "Not connected!"
lbtxt1.Text = "Warning: Your internet traffic is unencrypted and"
lbtxt2.Text = "your virtual online identity is exposed."
lbConnection.ForeColor = Color.Red
PictureBox1.Image = ImageList1.Images(1)
lbIPProxy.Text = "***.***.***.***"
lbCountryProxy.Text = "**"
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "0", RegistryValueKind.DWord)
Notify.Visible = False
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
TimeExact()
End Sub
Private Sub TimeExact()
' Sesion Time Elapsed.
Dim lngTimeElapsed = DateTime.Now - dteStart
Dim forTimeElapsed = String.Format("{0:HH:mm:ss}", New DateTime(lngTimeElapsed.Ticks))
lbSesion.Text = "Sesion Time: " & forTimeElapsed
End Sub
Private Sub txtIP_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtIP.KeyPress
' txtIP Only Numbers & "." & ":".
Dim allowedChars As String = ".:"
If Char.IsDigit(e.KeyChar) = False And Char.IsControl(e.KeyChar) = False And allowedChars.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End Sub
End Class