Published June 6, 2023, 5:20 a.m. by Violet Harris
Source Code: https://github.com/shanesreal/vpn-application/
FileZilla: https://filezilla-project.org/download.php?type=client
Putty: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
openvpn-Installer: https://github.com/angristan/openvpn-install
You may also like to read about:
what's up guys Shane TV here and today
I'd like to show you how to create your
own VPN application everything in this
tutorial is completely free and I will
provide all the download links in the
description below I'd like to cover four
things this tutorial the first one being
coding our actual VPN application
secondly creating our VPN server that
we're going to connect to I'm using
digitalocean
just because they provide your first 30
days they provide like a 30 day trial
you guys can use I'll leave a link for
that in the description you guys can use
it as well
number three configuring our VPN server
for both so that we can connect with UDP
if we want to or if we want to connect
with TCP we can do that as well
and finally accessing restricted content
with the VPN that we're going to make
today I'm going to show you guys a
YouTube video that's blocked in my
country we're going to access it with
this VPN that we're about to make the
tools that you guys are going to need is
putty FileZilla and the community
edition version of Open VPN I'll leave a
link for that in case you don't know
what that is
everything was going to be in the
description all the download links so
now that we got that out of the way
let's go ahead and open visual studio
make sure you guys run it as an
administrator and go down to create a
new projects here you can scroll down
until you see Windows forms at net
framework hit next project name let's
just call it VPN and create now that we
have loaded that up you'll see a blank
form in the bottom right in the
properties box we can just name this
form 1 VPN and you can see it changed up
there to VPN
next open the toolbox search for combo
box search again for button double click
that twice we need two buttons and then
right underneath it the radio button
we're going to need two radio buttons
close the toolbox I've got both our
buttons both our radio buttons and our
combo box so let's start with radio
button one let's call that UDP let's
click on radio button two and call that
TCP I'm going to bring it
line it up a little bit let's call it
the button one connect and call button
to disconnect so now we've got a connect
button make it a little bit bigger and
we've got a disconnect button that all
looks good line it up a little bit if
you click on the background of the form
you can actually resize it I'm gonna
make it just about that that looks fine
you can start the program and see how it
looks make it a little bit bigger
actually and that's perfect so click on
the combo box and at the top you're
going to see an arrow like a black arrow
click on that and hit edit items in here
we're gonna name our server we'll just
call it server and also in the
properties box we can scroll down and so
it says text and let's just type select
your server
so if we go ahead and run that again
you'll see it says select your server
server that's our server name and we can
connect with UDP or we can connect with
TCP now we also have a disconnect button
so to get started on this let's double
click the connect button and you see
it's creates a private void button
underscore click go up to the top here
delete all these extra system namespaces
and I'm just going to add using system
Diagnostics you should have you should
only need to use three namespaces for
this tutorial so now that we have button
one click private void you can double
click on disconnect as well if you want
that's also going to create a private
void for that and that should be good so
now we can begin writing some code let's
start this off with our button one our
connect button with an if statement so
if combobox one text is equal to server
remember how bare woops finish that if
statement off remember how I made it say
server here so that if the combo box
equals server and the radio button one
is checked then it'll run whatever's
inside here we can also do it else if
combobox one text equals server and
radio button 2 just checked meaning if
the only server that we have is server
right
if UDP is selected it'll connect this is
radio button 1 and then in our else--if
statement radio button 2 if this is
checked then this will connect with tcp
instead so now that we have our if and
else if statements set up we can start
by writing some code so process start
with a new process let's also add a
process start info we're going to use a
lot of start info in this tutorial
whoops
so new process new process starting Phil
let's add some start info let's start
with a filename this is actually the
file what's kind of that's going to
connect to the VPN so Open File Explorer
go to your local disk program files Open
VPN this should it should be here for
everybody but if not it's good to double
check that your Open VPN exe is in here
so I'm just going to copy this Open VPN
dot exe copy all that and paste it in
there
next we'll add some arguments this is
actually going to be the open VPN
configuration file that we're going to
make so config I don't really know a
server name so I'm just gonna say a
server to VPN not sure where what region
I'll use yet start info again we'll do a
verb run as this is this ensures that
you're running as an administrator and
then process start info start info
process start and that's about it you
can go ahead and copy that and paste it
in our other else if statement also
another thing you could add here is a
message box and say something like
you've connected to server with UDP copy
that and also paste it down here also I
accidentally didn't copy that
make sure you so make sure that you can
just copy paste this and post it in your
other else if statement and it should
work fine down here is our button to
click you remember but button to is our
disconnects button so we're actually
going to need to create a function or a
method for this you can start with
saying like disconnects and it'll
automatically generate a method down
here
so private void disconnects the way we
can start this is let's start with
process start new process start info
close that off with waits for exit
and that should be good
rush it start info whoops I think I
added an extra I messed up somewhere
there we go and what this function is
going to do here is it's basically going
to kill our OpenVPN exe so that we
disconnect from the VPN so start with
file name tasks or it will just say
tasks he'll all right we'll give us some
arguments and this is what is going to
kill the process so if I am and then our
OpenVPN exe you see right here it says
OpenVPN exe this is a file we're going
to be killing create no window set
that's a true use shell execute so
that's a false oops and that's good this
so this is our function our disconnect
function as soon as somebody hits the
disconnect button this function will
execute and kill the OpenVPN if it's
running so let's double check this
server UDP connect you've connected to
the server with UDP TCP you've connected
to server with UDP oh shoot I change
this to TCP obviously run that you've
connected to server TCP there we go
everything's running good everything
looks good I guess we can go ahead and
begin configuring our server or creating
our server and then configuring it for
UDP and TCP protocol
so like I said I'm using digital ocean
for this it's all free it's like a free
30-day trial go to your projects go to
get started with a droplet this will
load you've been to eighteen point oh
four point three is fine starter plan
five bucks a month region I'm gonna go
with London United Kingdom
you guys can choose any of these I just
prefer to go with this one one time
password and create triplet
this should only take a couple seconds
to create
and it's made good to my Inbox
your new droplet your new droplet is all
set to go your IP address right here
copy that and let's open our putty open
up putty and it should say hostname or
IP address this is where we put our IP
address it'll say it'll bring up a
security alert you can just hit
yesterday login our username is root our
password is right here
a change in password for root current
UNIX password enter that password again
and then create a new password and we're
in so now that we're into our server we
can begin configuring it and installing
open VPN on it the first thing we want
to do is go to the github of our Open
VPN installer I'll leave a link to this
github in the description if you guys
want basically this guy made a really
quick way to install Open VPN on really
any any any distro so copy that run
these commands right here it'll ask you
some information like your server IP
address do you want to use a custom port
we'll just use the default
UDP enter enter enter and then it'll
make it in the meantime while this
server is being created let's go ahead
and copy our IP address again and open
FileZilla
login with root and the password that we
just made and port 22 quick connects
you might get an update from FileZilla
just close out of that go back to our
putty client it says tell me a name for
the client I'm going to name this UK UDP
and no password and then hit refresh on
FileZilla and you'll see our UK UDP Open
VPN file has been made we can drag this
onto our desktop
that successfully transferred don't sour
desktop and now what we're going to do
is we're going to create a TCP
configuration and that's actually done
because the owner of this github didn't
actually add a TCP option to run UDP and
TCP at the same time you see we can
check by running this command here and
this basically checks port one one nine
four and you can see we do have UDP
running OpenVPN UDP running but there's
no tcp well there's no option to add tcp
i'm going to show you guys how to do
that real quick here simply go to the
remote site here at the top of FileZilla
it type in /etc forward slash Open VPN
you'll see a server config file drag
that on your desktop copy it paste it on
the desktop and name it server to that
config and if we go ahead and open the
first server config you'll see it says
proto meaning protocol UDP on port one
194 using server ten point eight point
zero point zero let's go ahead and open
our server to config
and let's change protocol UDP to TCP
let's replace server ten point eight to
ten point nine and save drag that back
into the server hit refresh
oops you should see a server to config
show up I'm going to drag it and drop it
again see there we go so now I have
server duck config and I also have a
server to that config which is good we
can delete these off of our desktop now
and open our putty back up and let's put
some IP tables in here so let me extend
this so you guys can see it a little bit
better
IP tables all the stuff will be in the
description
this is opening port 1 1 9 4 4 TCP
accept and this command here will open
that new server we just created 10.9
accepts and all we got to do now is we
start our Open VPN server so service of
MVP enters restart and then type the
same command Open VPN s over to or start
go back into files of the forward slash
routes in here you'll see a Open VPN
slash install that Sh hit view or edit
on that make it a little bit bigger and
what we're gonna do here is we're gonna
find or actually we're going to go to
line 8 8 3 it's gonna be a little bit
different for you guys because the
github owner if he were to change some
code in here
you know this obviously wouldn't be line
III anymore because he could add you
know GGG here
and this this is now line 886 so
anywhere that looks like around this
coat area it should be fine we're only
pasting one line of code in here and
that's this line of code right here
said I server to the server to config
that we just made
ctrl save close would you like to save
yes
refresh and that's all good we can go
ahead and restart again if you we could
have done that art before but it doesn't
really matter and now when we run that
command from earlier look at this we've
got TCP running now open VPN and we also
have UDP running Open VPN all we got to
do now copy the UK UDP paste it let's
call this UK TCP open with notepad
change that protocol to TCP safe now
we've got both of our Open VPN
configuration files UK UDP and UK TCP
open our file explorer go to local disk
go to Program Files I believe all right
now I'm sorry go to users Shane or
whatever your name is on the PC source
repos VPN VPN bin-debug
and here is where we can paste those
configuration files go back into our VPN
back out of that a little bit and I'll
zoom in so you guys can see make sure
the configuration file we made earlier
it's the same name so UK UDP for a radio
button one that's UDP and this one has
to be UK TCP and that should be fine so
now we both we have all of our
configuration setup on our server we can
close out of putty we can close out of
FileZilla let's go ahead and give this a
test select your server server UDP
connect and you can see you've connected
the server with UDP and you'll see a CMD
open in the background this is actually
Open VPN DXE running and connecting you
to the server I'm going to open my
Chrome backup go to what is my IP
address comm and now I'm located digital
ocean United Kingdom let's go ahead and
disconnect hit f5 and now I'm back in
the United States with Verizon Wireless
so our VPN has successfully been made oh
we should probably test the TCP protocol
that we just made as well so go to
what's my IP address comm connect with
TCP you've connected to server with TCP
let all this run and then go and hit f5
now I'm back in United Kingdom with
digital ocean
so we've confirmed that UDP and TCP are
both working we can disconnect and let's
actually add something in here so that
that black CMD screen doesn't pop up in
the background we can start that or we
can do that by saying Start info window
style process window style hidden copy
that and paste it into our other else if
statement also go down here I'm going to
add a message box just so that we know
we disconnected we hit a disconnect
button you've disconnected from Terr
server
that's fine start our program up again
select server UDP connect if connected
to the server with UDP f5
I'm in the United Kingdom and there's no
of that background CMD coming up hit
disconnect you've disconnected from the
server
let's hit f5 I'm back in the United
States
ok now let's test it with TCP hit
connect
you've connected the server with TCP
let's hit f5 whoops give it another
second and digitalocean United Kingdom
so disconnect from that open our notes
back up and the fourth thing of this I
wanted to talk about was accessing
restricted content with the VPN we just
made so I'm going to go to youtube and
we are disconnected from the VPN right
now so open a tab and go to youtube.com
you see this video here is unavailable
this video contains content from Viacom
who has blocked in your country on
copyright grounds I can't see the video
I can't see comments or turned off I
can't see anything let's connect to our
server you've connected server with UDP
let's hit f5
and the video is loaded I can look at
all the comments all the videos we just
bypassed the YouTube restriction with a
simple VPN client like this hit
disconnect you've disconnected from the
server let's go ahead hit f5 on YouTube
and I'm blocked I can't see comments I
can't see the videos everything's
blocked
let's try connecting with TCP connect
you've connected to the server with TCP
hit f5 and the video is loaded all the
comments are loaded disconnect at 5 and
we're blocked so that's just a
real-world example of how this VPN this
simple tool we just made today can you
can access any website any YouTube video
that is restricted in your country so I
hope you guys enjoyed we covered all
four things today yep I think that's
about it for this video I hope you guys
enjoyed if you'd like to see some more
videos like this comment down below what
you'd like to see if you enjoyed this
video please leave a like or subscribe
and that's it thanks for watching you
guys
2CUTURL
Created in 2013, 2CUTURL has been on the forefront of entertainment and breaking news. Our editorial staff delivers high quality articles, video, documentary and live along with multi-platform content.
© 2CUTURL. All Rights Reserved.