important

This commit is contained in:
Bitl 2021-09-03 10:19:42 -07:00
parent 81a10bdee3
commit afcb3af13c
3 changed files with 60 additions and 3 deletions

View File

@ -267,12 +267,57 @@ public class SecurityFuncs
return ipAddress;
}
#if !BASICLAUNCHER
#if !BASICLAUNCHER
public static async Task<string> GetExternalIPAddressAsync()
{
var task = Task.Factory.StartNew(() => GetExternalIPAddress());
return await task;
}
#endif
#endif
#if LAUNCHER
//modified from https://stackoverflow.com/questions/14687658/random-name-generator-in-c-sharp
public static string GenerateName(int len)
{
CryptoRandom r = new CryptoRandom();
string[] consonants = { "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "l", "n", "p", "q", "r", "s", "sh", "zh", "t", "v", "w", "x" };
string[] vowels = { "a", "e", "i", "o", "u", "ae", "y" };
string Name = "";
Name += consonants[r.Next(consonants.Length)].ToUpper();
Name += vowels[r.Next(vowels.Length)];
int b = 2; //b tells how many times a new letter has been added. It's 2 right now because the first two letters are already in the name.
while (b < len)
{
Name += consonants[r.Next(consonants.Length)];
b++;
Name += vowels[r.Next(vowels.Length)];
b++;
}
return Name;
}
//https://www.c-sharpcorner.com/article/caesar-cipher-in-c-sharp/
public static char cipher(char ch, int key)
{
if (!char.IsLetter(ch))
{
return ch;
}
char d = char.IsUpper(ch) ? 'A' : 'a';
return (char)((((ch + key) - d) % 26) + d);
}
public static string Encipher(string input, int key)
{
string output = string.Empty;
foreach (char ch in input)
output += cipher(ch, key);
return output;
}
#endif
}
#endregion

View File

@ -11,6 +11,7 @@ namespace NovetusLauncher
#endregion
#region Commands
public static string important = "";
public static string important2 = "";
#endregion
}
#endregion

View File

@ -229,7 +229,7 @@ namespace NovetusLauncher
GlobalFuncs.CreateAssetCacheDirectories();
ProductVersionLabel.Text = Application.ProductVersion;
LocalVars.important = SecurityFuncs.GenerateMD5(Assembly.GetExecutingAssembly().Location);
SetupImportantData();
NovetusVersionLabel.Text = GlobalVars.ProgramInformation.Version;
SplashLabel.Text = SplashReader.GetSplash();
@ -548,6 +548,15 @@ namespace NovetusLauncher
}
}
public void SetupImportantData()
{
CryptoRandom random = new CryptoRandom();
string Name1 = SecurityFuncs.GenerateName(random.Next(4, 12));
string Name2 = SecurityFuncs.GenerateName(random.Next(4, 12));
LocalVars.important = Name1 + Name2;
LocalVars.important2 = SecurityFuncs.Encipher(LocalVars.important, random.Next(2, 9));
}
public void ConsoleProcessCommands(string cmd)
{
switch (cmd)
@ -630,6 +639,8 @@ namespace NovetusLauncher
GlobalFuncs.ConsolePrint("= dlldelete off | Turn off the deletion of opengl32.dll when ReShade is off.", 4, ConsoleBox);
GlobalFuncs.ConsolePrint("= dlldelete on | Turn on the deletion of opengl32.dll when ReShade is off.", 4, ConsoleBox);
GlobalFuncs.ConsolePrint("---------", 1, ConsoleBox);
GlobalFuncs.ConsolePrint(LocalVars.important2, 1, ConsoleBox);
GlobalFuncs.ConsolePrint("---------", 1, ConsoleBox);
}
public void SwitchStyles()