-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc48b26
commit 561bb9c
Showing
5 changed files
with
367 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.11.34929.205 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlumBot", "BlumBot.csproj", "{80381389-DD56-423C-A92F-B70C67D145CA}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{80381389-DD56-423C-A92F-B70C67D145CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{80381389-DD56-423C-A92F-B70C67D145CA}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{80381389-DD56-423C-A92F-B70C67D145CA}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{80381389-DD56-423C-A92F-B70C67D145CA}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {CCF1DABB-52D3-4386-B2C6-98FD17B3E884} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
namespace BlumBot | ||
{ | ||
public class Helper | ||
{ | ||
public int platform() | ||
{ | ||
Console.WriteLine("Выберите платформу"); | ||
Console.WriteLine("1 - iPhone (15.0)"); | ||
Console.WriteLine("2 - iPhone (16.4)"); | ||
Console.WriteLine("3 - Android (13)"); | ||
Console.WriteLine("4 - Windows (10)"); | ||
Console.WriteLine("5 - MacOS (13.4)"); | ||
int choice = Int32.Parse(Console.ReadLine()); | ||
|
||
return choice; | ||
} | ||
|
||
public int replay() | ||
{ | ||
while (true) | ||
{ | ||
Console.Write("Введите количество повторений: "); | ||
int repetitions = Int32.Parse(Console.ReadLine()); | ||
|
||
if (repetitions < 1 || repetitions > 100) | ||
{ | ||
Console.WriteLine("Недопустимое количество повторений."); | ||
} | ||
else if (repetitions > 5) | ||
{ | ||
Console.WriteLine("Ты уверен? (y/n)"); | ||
string choice = Console.ReadLine().ToLower(); | ||
if (choice == "yes" || choice == "y") | ||
{ | ||
return repetitions; | ||
} | ||
else | ||
{ | ||
continue; | ||
} | ||
} | ||
else | ||
{ | ||
return repetitions; | ||
} | ||
} | ||
} | ||
|
||
public int scores() | ||
{ | ||
while (true) | ||
{ | ||
Console.Write("Введите баллы (рекомендуется от 200 до 280): "); | ||
string pointsInput = Console.ReadLine(); | ||
int points; | ||
|
||
if (string.IsNullOrEmpty(pointsInput)) | ||
{ | ||
Random random = new Random(); | ||
points = random.Next(260, 280); | ||
Console.WriteLine($"Никакие баллы не введены. Использование случайных точек: {points}"); | ||
return points; | ||
} | ||
else if (!int.TryParse(pointsInput, out points) || points < 200 || points > 280) | ||
{ | ||
Console.WriteLine("Неверное значение баллов. Пожалуйста, введите число от 200 до 280."); | ||
continue; | ||
} | ||
else | ||
{ | ||
return points; | ||
} | ||
} | ||
} | ||
|
||
public string GetAuthorizationToken() | ||
{ | ||
Console.WriteLine("\r\n██████╗░██╗░░░░░██╗░░░██╗███╗░░░███╗ ░█████╗░██╗░░░██╗████████╗░█████╗░ ██████╗░░█████╗░████████╗\r\n██╔══██╗██║░░░░░██║░░░██║████╗░████║ ██╔══██╗██║░░░██║╚══██╔══╝██╔══██╗ ██╔══██╗██╔══██╗╚══██╔══╝\r\n██████╦╝██║░░░░░██║░░░██║██╔████╔██║ ███████║██║░░░██║░░░██║░░░██║░░██║ ██████╦╝██║░░██║░░░██║░░░\r\n██╔══██╗██║░░░░░██║░░░██║██║╚██╔╝██║ ██╔══██║██║░░░██║░░░██║░░░██║░░██║ ██╔══██╗██║░░██║░░░██║░░░\r\n██████╦╝███████╗╚██████╔╝██║░╚═╝░██║ ██║░░██║╚██████╔╝░░░██║░░░╚█████╔╝ ██████╦╝╚█████╔╝░░░██║░░░\r\n╚═════╝░╚══════╝░╚═════╝░╚═╝░░░░░╚═╝ ╚═╝░░╚═╝░╚═════╝░░░░╚═╝░░░░╚════╝░ ╚═════╝░░╚════╝░░░░╚═╝░░░" + "\r\n\n"); | ||
while (true) | ||
{ | ||
Console.Write("Введите токен авторизации: "); | ||
string token = Console.ReadLine().Trim(); | ||
|
||
if (string.IsNullOrEmpty(token)) | ||
{ | ||
Console.WriteLine("Токен не может быть пустым. Пожалуйста, введите действительный токен авторизации."); | ||
continue; | ||
} | ||
|
||
if (!token.StartsWith("Bearer ")) | ||
{ | ||
token = "Bearer " + token; | ||
} | ||
|
||
return token; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
namespace BlumBot | ||
{ | ||
class Program | ||
{ | ||
static async Task Main(string[] args) | ||
{ | ||
Helper help = new Helper(); | ||
Requests requests = new Requests(); | ||
|
||
string authorizationToken = help.GetAuthorizationToken(); | ||
|
||
while (true) | ||
{ | ||
try | ||
{ | ||
int choice = help.platform(); | ||
int repetitions = help.replay(); | ||
int points = help.scores(); | ||
|
||
List<Task<string>> tasks = new List<Task<string>>(); | ||
|
||
for (int i = 0; i < repetitions; i++) | ||
{ | ||
tasks.Add(requests.MakeRequestsAsync(authorizationToken, points, i + 1, choice)); | ||
} | ||
|
||
string[] results = await Task.WhenAll(tasks); | ||
|
||
for (int i = 0; i < results.Length; i++) | ||
{ | ||
Console.WriteLine($"Результат итерации {i + 1}:\n{results[i]}\n"); | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine($"Ошибка: {ex.Message}"); | ||
} | ||
|
||
Console.WriteLine("Еще разок? (yes/no): "); | ||
string runAgain = Console.ReadLine().ToLower(); | ||
if (runAgain != "yes" && runAgain != "y") | ||
{ | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
using Newtonsoft.Json.Linq; | ||
using System.Text; | ||
|
||
namespace BlumBot | ||
{ | ||
public class Requests | ||
{ | ||
private static HttpClient choiceplatform(string authorizationToken, int choice) | ||
{ | ||
HttpClient result = new HttpClient(); | ||
|
||
switch(choice) | ||
{ | ||
case 1: | ||
result = iphone_old(authorizationToken); | ||
break; | ||
case 2: | ||
result = iphone_new(authorizationToken); | ||
break; | ||
case 3: | ||
result = android(authorizationToken); | ||
break; | ||
case 4: | ||
result = windows(authorizationToken); | ||
break; | ||
case 5: | ||
result = macos(authorizationToken); | ||
break; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
public static HttpClient iphone_old(string authorizationToken) | ||
{ | ||
var client = new HttpClient(); | ||
|
||
client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1"); | ||
client.DefaultRequestHeaders.Add("Accept", "application/json, text/plain, */*"); | ||
client.DefaultRequestHeaders.Add("accept-language", "en-US,en;q=0.9"); | ||
client.DefaultRequestHeaders.Add("authorization", authorizationToken); | ||
client.DefaultRequestHeaders.Add("origin", "https://telegram.blum.codes"); | ||
client.DefaultRequestHeaders.Add("priority", "u=1, i"); | ||
client.DefaultRequestHeaders.Add("sec-fetch-dest", "empty"); | ||
client.DefaultRequestHeaders.Add("sec-fetch-mode", "cors"); | ||
client.DefaultRequestHeaders.Add("sec-fetch-site", "same-site"); | ||
|
||
return client; | ||
} | ||
|
||
public static HttpClient iphone_new(string authorizationToken) | ||
{ | ||
var client = new HttpClient(); | ||
|
||
client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 16_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Mobile/15E148 Safari/604.1"); | ||
client.DefaultRequestHeaders.Add("Accept", "application/json, text/plain, */*"); | ||
client.DefaultRequestHeaders.Add("accept-language", "en-US,en;q=0.9"); | ||
client.DefaultRequestHeaders.Add("authorization", authorizationToken); | ||
client.DefaultRequestHeaders.Add("origin", "https://telegram.blum.codes"); | ||
client.DefaultRequestHeaders.Add("priority", "u=1, i"); | ||
client.DefaultRequestHeaders.Add("sec-fetch-dest", "empty"); | ||
client.DefaultRequestHeaders.Add("sec-fetch-mode", "cors"); | ||
client.DefaultRequestHeaders.Add("sec-fetch-site", "same-site"); | ||
|
||
return client; | ||
} | ||
|
||
public static HttpClient android(string authorizationToken) | ||
{ | ||
var client = new HttpClient(); | ||
|
||
client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Linux; Android 13; SM-G998B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36"); | ||
client.DefaultRequestHeaders.Add("Accept", "application/json, text/plain, */*"); | ||
client.DefaultRequestHeaders.Add("accept-language", "en-US,en;q=0.9"); | ||
client.DefaultRequestHeaders.Add("authorization", authorizationToken); | ||
client.DefaultRequestHeaders.Add("origin", "https://telegram.blum.codes"); | ||
client.DefaultRequestHeaders.Add("priority", "u=1, i"); | ||
client.DefaultRequestHeaders.Add("sec-fetch-dest", "empty"); | ||
client.DefaultRequestHeaders.Add("sec-fetch-mode", "cors"); | ||
client.DefaultRequestHeaders.Add("sec-fetch-site", "same-site"); | ||
|
||
return client; | ||
} | ||
|
||
public static HttpClient windows(string authorizationToken) | ||
{ | ||
var client = new HttpClient(); | ||
|
||
client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0"); | ||
client.DefaultRequestHeaders.Add("Accept", "application/json, text/plain, */*"); | ||
client.DefaultRequestHeaders.Add("accept-language", "en-US,en;q=0.9"); | ||
client.DefaultRequestHeaders.Add("authorization", authorizationToken); | ||
client.DefaultRequestHeaders.Add("origin", "https://telegram.blum.codes"); | ||
client.DefaultRequestHeaders.Add("priority", "u=1, i"); | ||
client.DefaultRequestHeaders.Add("sec-ch-ua", "\"Microsoft Edge\";v=\"126\", \"Chromium\";v=\"126\", \"Not.A/Brand\";v=\"8\", \"Microsoft Edge WebView2\";v=\"126\""); | ||
client.DefaultRequestHeaders.Add("sec-ch-ua-mobile", "?0"); | ||
client.DefaultRequestHeaders.Add("sec-ch-ua-platform", "\"Windows\""); | ||
client.DefaultRequestHeaders.Add("sec-fetch-dest", "empty"); | ||
client.DefaultRequestHeaders.Add("sec-fetch-mode", "cors"); | ||
client.DefaultRequestHeaders.Add("sec-fetch-site", "same-site"); | ||
|
||
return client; | ||
} | ||
|
||
public static HttpClient macos(string authorizationToken) | ||
{ | ||
var client = new HttpClient(); | ||
|
||
client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 13_4) AppleWebKit/537.36 (KHTML, like Gecko) Version/16.0 Safari/537.36"); | ||
client.DefaultRequestHeaders.Add("Accept", "application/json, text/plain, */*"); | ||
client.DefaultRequestHeaders.Add("accept-language", "en-US,en;q=0.9"); | ||
client.DefaultRequestHeaders.Add("authorization", authorizationToken); | ||
client.DefaultRequestHeaders.Add("origin", "https://telegram.blum.codes"); | ||
client.DefaultRequestHeaders.Add("priority", "u=1, i"); | ||
client.DefaultRequestHeaders.Add("sec-fetch-dest", "empty"); | ||
client.DefaultRequestHeaders.Add("sec-fetch-mode", "cors"); | ||
client.DefaultRequestHeaders.Add("sec-fetch-site", "same-site"); | ||
|
||
return client; | ||
} | ||
|
||
public async Task<string> MakeRequestsAsync(string authorizationToken, int points, int iteration, int choice) | ||
{ | ||
HttpClient client = new HttpClient(); | ||
|
||
client = choiceplatform(authorizationToken, choice); | ||
|
||
HttpResponseMessage response = await client.PostAsync("https://game-domain.blum.codes/api/v1/game/play", null); | ||
|
||
if (!response.IsSuccessStatusCode) | ||
{ | ||
if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized) | ||
{ | ||
Console.WriteLine("Срок действия токенов истек. Пожалуйста, введите действительный токен авторизации."); | ||
} | ||
else | ||
{ | ||
string errorMessage = await response.Content.ReadAsStringAsync(); | ||
Console.WriteLine($"Ошибка: {errorMessage}"); | ||
} | ||
return $"Итерация {iteration} не удалась."; | ||
} | ||
|
||
string responseContent = await response.Content.ReadAsStringAsync(); | ||
Console.WriteLine($"Ответ от /game/play (итерация {iteration}):"); | ||
Console.WriteLine(responseContent); | ||
|
||
var json = JObject.Parse(responseContent); | ||
string gameId = json["gameId"].ToString(); | ||
|
||
Console.WriteLine($"Итерация {iteration}: Ждите 32 секунды..."); | ||
await Task.Delay(32000); | ||
|
||
client.DefaultRequestHeaders.Clear(); | ||
client = choiceplatform(authorizationToken, choice); | ||
|
||
var payload = new | ||
{ | ||
gameId = gameId, | ||
points = points | ||
}; | ||
|
||
StringContent content = new StringContent(JObject.FromObject(payload).ToString(), Encoding.UTF8, "application/json"); | ||
|
||
response = await client.PostAsync("https://game-domain.blum.codes/api/v1/game/claim", content); | ||
responseContent = await response.Content.ReadAsStringAsync(); | ||
|
||
if (!response.IsSuccessStatusCode) | ||
{ | ||
string errorMessage = await response.Content.ReadAsStringAsync(); | ||
Console.WriteLine($"Ошибка от /game/claim (Итерация {iteration}): {errorMessage}"); | ||
return $"Итерация {iteration} не удалась."; | ||
} | ||
|
||
Console.WriteLine($"Ответ от /game/claim (Итерация {iteration}):"); | ||
Console.WriteLine(responseContent); | ||
|
||
return $"Итерация {iteration} завершена успешно."; | ||
} | ||
} | ||
} |