- Uploaded source

master
VollRagm 4 years ago
parent 5b932bbbd9
commit 33ed11278b

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public static class Log
{
public static void Info(object value)
{
Log.Color(ConsoleColor.Yellow);
Console.WriteLine("[!] " + value.ToString());
Log.Color();
}
public static void Critical(object value)
{
Log.Color(ConsoleColor.Cyan);
Console.WriteLine("[+] " + value.ToString());
}
public static void Error(object value)
{
Log.Color(ConsoleColor.Red);
Console.WriteLine("[-] " + value.ToString());
Log.Color();
}
public static void Fatal(object value)
{
Error(value);
Console.ReadLine();
Environment.Exit(-1);
}
private static void Color(ConsoleColor color = ConsoleColor.White) => Console.ForegroundColor = color;
}

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UplayNameChecker
{
class Program
{
static void Main(string[] args)
{
Program.MainAsync().GetAwaiter().GetResult();
}
static async Task MainAsync()
{
if (!File.Exists("names.txt"))
Log.Fatal("names.txt not found.");
Log.Info("Reading names.txt...");
string[] namesToCheck;
try
{
namesToCheck = File.ReadAllLines("names.txt");
}
catch (Exception ex)
{
Log.Error("Could not read names.txt: " + ex.Message);
return;
}
R6dbAPI r6db = new R6dbAPI();
await Task.Delay(100);
Log.Info("Starting to check...\n");
foreach (var name in namesToCheck)
{
bool available = await r6db.IsNameAvailable(name);
Log.Critical($"{name} is {(available ? "" : "not ")} available.");
if (available)
File.AppendAllLines("availableNames.txt", new string[] { name });
}
Console.WriteLine();
Log.Info("Written results to availableNames.txt.");
Console.ReadLine();
}
}
}

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UplayNameChecker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UplayNameChecker")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("324bda05-3e1b-456c-8cd9-a364846db2cd")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace UplayNameChecker
{
public class R6dbAPI
{
private HttpClient httpClient = new HttpClient();
private const string URI = "https://api.statsdb.net/r6/namecheck/";
public async Task<bool> IsNameAvailable(string name)
{
try
{
var reqUri = URI + System.Net.WebUtility.UrlEncode(name);
var timestamp = GetCurrentTimestamp();
var apiKey = GenerateAuthToken(timestamp);
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, reqUri);
request.Headers.Add("x-api-key", apiKey);
request.Headers.Add("origin", "https://r6db.net");
var response = await httpClient.SendAsync(request);
return (await response.Content.ReadAsStringAsync()).Contains("exists\":false");
}
catch (Exception ex)
{
Log.Error($"Could not check name {name}: {ex.Message}");
return false;
}
}
public string GenerateAuthToken(ulong timestamp)
{
var seed = "a3d6b18fa919072d65d890c47b336f1f78fc11c4";
var sTimestamp = timestamp.ToString();
var code = "";
for(int i = 0; i < sTimestamp.Length; i++)
{
var t = int.Parse(sTimestamp[i].ToString());
var c = (int)seed[i % seed.Length];
switch (t)
{
case 0: break;
case 1:
c = c - 1;
break;
case 2:
c = c >> 1;
break;
case 3:
c = c << 1;
break;
case 4:
c = (int)Math.Pow(t, c % 4);
break;
case 5:
c = (int)Math.Round(Math.Sqrt(c));
break;
case 6:
c = c << t;
goto case 7;
case 7:
c = c - 12;
break;
case 8:
c = 0;
break;
default:
c = -69420;
break;
}
if (c == -69420) continue;
code += c.ToString();
}
var str2 = "authscript:" + code + ":" + timestamp + $":{GetTodaysTimestamp()}";
return Convert.ToBase64String(Encoding.UTF8.GetBytes(str2));
}
private ulong GetCurrentTimestamp()
{
return (ulong)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
}
private ulong GetTodaysTimestamp()
{
return (ulong)DateTime.Today.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
}
}
}

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{324BDA05-3E1B-456C-8CD9-A364846DB2CD}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>UplayNameChecker</RootNamespace>
<AssemblyName>UplayNameChecker</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Log.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="R6dbAPI.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Loading…
Cancel
Save