• Salut Visiteur ! ✌
    Découvre nos partenaires officiels avec VeryLeak's. Des choix réfléchis, dignes de confiance pour tes avantages.

    StoryFound | REFUNDER TEAM

    StoryFound

    Rejoindre le Canal ✨ ou Plus d'information 📃

    Une question ? Rejoingnez nos différents canaux (Discord, Telegram, Revolt)

    Nos Canaux Communautaires

    Cet affichage peut se clôturer définitivement via la croix en haut à droite.

Visual Studio C# codage pour creer un VPN

𝙃ᵘ𝙂ᵒ ✧

⭐_⭐
Level 2

Torrents Stats

Messages
54
J'aime
2 591
Trophées
378
Inscrit
15 Juin 2018
1590588006446.png
BONJOUR PETIT TUTO POUR CREER UN VPN :
POUR VOUS CONNECTER AU VPN UNE FOIS CREER ENTRER VOS IDENTIFIANT POUR TROUVER SONT HÔTE ALLER SUR SE SITE : http://www.mon-ip.com/ VOUS Y AUREZ VOTRE HÔTE


POUR COMMENCER :
-CREER 3 TEXT BOX AVEC COMME NOM LA 1 txtHost | La 2 txtUsrname | La 3 txtPassword | La 1 pour l'hote , La 2 pour le nom , La 3 pour le mot de passe
-CREER 2 BOUTON AVEC COMME NOM : btnConnect , btnDisconnect | le 1 pour activer le 2 pour désactiver






En dessous de :

public Form1()
{
InitializeComponent();
}


mettre :

private static string FolderPath => string.Concat(Directory.GetCurrentDirectory(),
"\\VPN");


a mettre dans le bouton activer :

if (!Directory.Exists(FolderPath))
Directory.CreateDirectory(FolderPath);

var sb = new StringBuilder();
sb.AppendLine("[VPN]");
sb.AppendLine("MEDIA=rastapi");
sb.AppendLine("Port=VPN2-0");
sb.AppendLine("Device=WAN Miniport (IKEv2)");
sb.AppendLine("DEVICE=vpn");
sb.AppendLine("PhoneNumber=" + txtHost.Text);

File.WriteAllText(FolderPath + "\\VpnConnection.pbk", sb.ToString());

sb = new StringBuilder();
sb.AppendLine("rasdial \"VPN\" " + txtUsrname.Text + " " + txtPassword.Text + " /phonebook:\"" + FolderPath +
"\\VpnConnection.pbk\"");

File.WriteAllText(FolderPath + "\\VpnConnection.bat", sb.ToString());

var newProcess = new Process
{
StartInfo =
{
FileName = FolderPath + "\\VpnConnection.bat",
WindowStyle = ProcessWindowStyle.Normal
}
};

newProcess.Start();
newProcess.WaitForExit();
btnConnect.Enabled = false;
btnDisconnect.Enabled = true;
}


a mettre dans le bouton désactiver :

File.WriteAllText(FolderPath + "\\VpnDisconnect.bat", "rasdial /d");

var newProcess = new Process
{
StartInfo =
{
FileName = FolderPath + "\\VpnDisconnect.bat",
WindowStyle = ProcessWindowStyle.Normal
}
};

newProcess.Start();
newProcess.WaitForExit();
btnConnect.Enabled = true;
btnDisconnect.Enabled = false;
}
 

Fichiers joints

  • 1590587830090.png
    1590587830090.png
    210.6 KB · Affichages: 103
Dernière édition:

zebulon33

l'Actif 🥉
Level 1

Torrents Stats

Messages
18
J'aime
4
Trophées
46
Inscrit
21 Juin 2020
Intéressant comme code.
A essayer.
Merci pour l'info
 
Haut Bas