Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <windows.h>
- #include <shlobj.h>
- #include <iostream>
- #using <System.dll>
- using namespace System;
- using namespace System::Collections::Specialized;
- using namespace System::ComponentModel;
- using namespace System::Diagnostics;
- using namespace System::Net;
- using namespace System::IO;
- std::string FindMSFolder()
- {
- TCHAR path[MAX_PATH];
- BROWSEINFO bi = { 0 };
- bi.lpszTitle = ("Please select your MapleStory folder...\nDefault C:\\Nexon\\MapleStory");
- LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
- if (pidl != 0)
- {
- //get the name of the folder and put it in path
- SHGetPathFromIDList(pidl, path);
- //free memory used
- IMalloc * imalloc = 0;
- if (SUCCEEDED(SHGetMalloc(&imalloc)))
- {
- imalloc->Free(pidl);
- imalloc->Release();
- }
- return path;
- }
- return "C:\\Nexon\\Library\\maplestory";
- }
- static String^ RetrieveWebAuthToken(String^ username, String^ password)
- {
- WebClient^ wc = gcnew WebClient();
- String^ dID = Guid::NewGuid().ToString();
- NameValueCollection^ nvc = gcnew NameValueCollection();
- nvc->Add("userID", username);
- nvc->Add("password", password);
- nvc->Add("device_id", dID);
- try
- {
- wc->UploadValues("https://accounts.nexon.net/account/login/launcher", "POST", nvc);
- CookieContainer^ cookies = gcnew CookieContainer();
- cookies->SetCookies(gcnew Uri("https://accounts.nexon.net/account/login/launcher"), wc->ResponseHeaders["Set-Cookie"]);
- String^ token = cookies->GetCookies(gcnew Uri("https://accounts.nexon.net/account/login/launcher"))["NPPv2"]->Value;
- return token;
- }
- catch (WebException^ ex)
- {
- Console::WriteLine("\n\n" + ex->Message);
- }
- }
- int main()
- {
- SetConsoleTitle("MapleStory WebLogin Console");
- String^ folderPath = gcnew String(FindMSFolder().c_str());
- Console::Write("Email or ID: ");
- String^ user = Console::ReadLine();
- // hide password input
- HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
- DWORD mode = 0;
- GetConsoleMode(hStdin, &mode);
- SetConsoleMode(hStdin, mode & (~ENABLE_ECHO_INPUT));
- //
- Console::Write("Password: ");
- String^ pass = Console::ReadLine();
- String^ startToken = RetrieveWebAuthToken(user, pass);
- if (startToken->Contains("NP12"))
- Process::Start(folderPath + "\\MapleStory.exe", "WebStart " + startToken);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement