8b7a3aea44
Added HostedNetwork project and .gitignore to match the project.
64 lines
1.8 KiB
C++
64 lines
1.8 KiB
C++
#include <Windows.h>
|
|
#include <string>
|
|
#include <iostream>
|
|
using namespace std;
|
|
|
|
int main()
|
|
{
|
|
int action[2];
|
|
bool exit = false;
|
|
string ssid, password;
|
|
|
|
do
|
|
{
|
|
system("cls");
|
|
cout << "1 - Change hostednetwork settings" << endl;
|
|
cout << "2 - Start hostednetwork" << endl;
|
|
cout << "3 - Check hostednetwork state" << endl;
|
|
cout << "4 - Stop hostednetwork" << endl;
|
|
cout << "5 - Exit" << endl;
|
|
cout << endl << "admin@hostednetwork:~$";
|
|
cin >> action[0];
|
|
switch(action[0])
|
|
{
|
|
case 1: system("cls");
|
|
cout << "1 - BJP Wi-Fi" << endl;
|
|
cout << "2 - Free Wi-Fi" << endl;
|
|
cout << "3 - Manually insert only for this time" << endl;
|
|
cout << "4 - Go back" << endl;
|
|
cout << endl << "admin@hostednetwork:~$";
|
|
cin >> action[1];
|
|
switch(action[1])
|
|
{
|
|
case 1: system("netsh wlan set hostednetwork mode=allow ssid=\"BJP Wi-Fi\" key=BJPR3t3W1f1 keyusage=persistent");
|
|
Sleep(3000);
|
|
break;
|
|
case 2: system("netsh wlan set hostednetwork mode=allow ssid=\"Free Wi-fi (pass:12345678)\" key=12345678 keyusage=persistent");
|
|
Sleep(3000);
|
|
break;
|
|
case 3: cout << "Insert SSID: ";
|
|
cin >> ssid;
|
|
cout << "Insert password: ";
|
|
cin >> password;
|
|
system(("netsh wlan set hostednetwork mode=allow ssid=" + ssid + " key=" + password + " keyusage=persistent").c_str());
|
|
Sleep(3000);
|
|
break;
|
|
default: break;
|
|
}
|
|
break;
|
|
case 2: system("netsh wlan start hostednetwork");
|
|
Sleep(3000);
|
|
break;
|
|
case 3: system("netsh wlan show hostednetwork");
|
|
cout << "Premi qualsiasi tasto per continuare ";
|
|
system("pause > nul");
|
|
break;
|
|
case 4: system("netsh wlan stop hostednetwork");
|
|
Sleep(3000);
|
|
break;
|
|
default: exit=true; break;
|
|
}
|
|
} while (!exit);
|
|
return 0;
|
|
}
|