Jump to content
Moopler Closing Read more... ×
Moopler
Razz

Snippet libmsauth - C# MapleStory Authentication Library

Recommended Posts

I wrote a small library in C# which uses Nexon's API to obtain a Passport Token. This token can be used to spawn a MapleStory instance, without having to login through Nexon Launcher or any other (supported) method.

GitHub link

Todo

  • Structure the project and auth methods ✔️
  • Reverse Web Auth ✔️
  • Reverse NMCO*.dll Auth

Example code

private async void ExampleFunction(string email, string password)
{
    WebAuthentication web = new WebAuthentication();
    NexonPassport passport = default(NexonPassport);

    try
    {
        passport = await web.GetNexonPassport(email, password);
    }
    catch (WebAuthenticationException wEx)
    {
        switch(wEx.ErrorCode)
        {
            case WebAuthenticationErrorCodes.InvalidEmail:
            case WebAuthenticationErrorCodes.InvalidPassword:
                MessageBox.Show(wEx.Message, "Authentication Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            case WebAuthenticationErrorCodes.InvalidClient:
            case WebAuthenticationErrorCodes.UntrustedDevice:
                MessageBox.Show(wEx.Message + "\r\n" + "Check your e-mail and manually verify your identity.", "API Configuration Error", MessageBoxButton.OK, MessageBoxImage.Stop);
                return;
        }
    }
    
    //Use the token here by accessing passport.Token;
    ...
}

Disclaimer

I wrote this library in a relatively short amount of time and it is the first library that was created with the intent to share. If you have any improvements feel free to contribute.

This library is created for the sole purpose of allowing people to roll their own launcher. The Nexon Launcher is a painfully awful launcher filled with unnecessary features. Use at your own risk, as I am unsure whether this is in violation of Nexon's Terms of Service.

Support is only provided on Moopler.net.

This is a working example on how to spawn a MapleStory instance using this library:

private async void StartInstanceAction(PasswordBox password)
        {
            WebAuthentication web = new WebAuthentication();
            NexonPassport passport = default(NexonPassport);

            try
            {
                passport = await web.GetNexonPassport(PassportEmail, password.Password);
            }
            catch (WebAuthenticationException wEx)
            {
                switch(wEx.ErrorCode)
                {
                    case WebAuthenticationErrorCodes.InvalidEmail:
                    case WebAuthenticationErrorCodes.InvalidPassword:
                        MessageBox.Show(wEx.Message, "Authentication Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    case WebAuthenticationErrorCodes.InvalidClient:
                    case WebAuthenticationErrorCodes.UntrustedDevice:
                        MessageBox.Show(wEx.Message + "\r\n" + "Check your e-mail and manually verify your identity.", "API Configuration Error", MessageBoxButton.OK, MessageBoxImage.Stop);
                        return;
                }
            }

            try
            {
                await Task.Run(() =>
                {
                    Process.Start(new ProcessStartInfo()
                    {
                        FileName = Properties.Settings.Default.MaplePath,
                        WorkingDirectory = Properties.Settings.Default.MaplePath.Replace("\\MapleStory.exe", string.Empty),
                        Verb = "runas",
                        Arguments = $"-nxl {passport.Token}"
                    });
                });
            }
            catch (FileNotFoundException)
            {
                MessageBox.Show("MapleStory.exe cannot be located at the configured file path. Please verify and try again.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (Win32Exception)
            {
                MessageBox.Show("MapleStory.exe can be found, but cannot be opened. Do you have the privileges to open this file?", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }

 

  • Like 4
  • Thanks 2

Share this post


Link to post
1 hour ago, wshh said:

you can run multiple instances with this ?

If you edited your client and have a bypass that allows it: sure.

Share this post


Link to post

Added support for the new login ticket used during login.

Sample snippet

WebAuthentication auth = new WebAuthentication();
string ticket = await auth.GetTicket("somemail@moopler.net", "somepassword");

For now every both passport and ticket API access is treated as a new connection. I have yet to add support for reuse of identity and access tokens.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×