Skip to content

Commit

Permalink
Update v1.11
Browse files Browse the repository at this point in the history
Fixed a lot of bugs, added notifications, added status type selection, full localization
  • Loading branch information
Vlas-Omsk committed Feb 22, 2021
1 parent 8b138ce commit c737b6c
Show file tree
Hide file tree
Showing 66 changed files with 1,408 additions and 1,111 deletions.
6 changes: 3 additions & 3 deletions DiscordStatusGUI/AES.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ public static string EncryptString(string value, string key)

List<byte> encrypted = new List<byte>();

using (Aes myAes = Aes.Create())
using (Aes aes = Aes.Create())
{
encrypted.AddRange(EncryptStringToBytes(value, CreateKey(key, 32), myAes.IV));
encrypted.AddRange(myAes.IV);
encrypted.AddRange(EncryptStringToBytes(value, CreateKey(key, 32), aes.IV));
encrypted.AddRange(aes.IV);
}

return Convert.ToBase64String(encrypted.ToArray());
Expand Down
38 changes: 29 additions & 9 deletions DiscordStatusGUI/DiscordStatusGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5C106643-5AE7-46E0-867F-6331808D8F74}</ProjectGuid>
<OutputType>Exe</OutputType>
<OutputType>WinExe</OutputType>
<RootNamespace>DiscordStatusGUI</RootNamespace>
<AssemblyName>DiscordStatusGUI</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
Expand Down Expand Up @@ -87,16 +87,16 @@
<Compile Include="Controls\SmoothScrollViewer.cs" />
<Compile Include="Converters\BoolToMarginConverter.cs" />
<Compile Include="Converters\MultiStringConverter.cs" />
<Compile Include="Converters\TagToDouble.cs" />
<None Include="Converters\TagToDouble.cs" />
<Compile Include="Converters\BoolInverter.cs" />
<Compile Include="Converters\BoolToIntConverter.cs" />
<None Include="Converters\BoolToIntConverter.cs" />
<Compile Include="Converters\EventBinding.cs" />
<Compile Include="Converters\BoolToVisibilityConverter.cs" />
<Compile Include="Converters\IsEqualConverter.cs" />
<Compile Include="Converters\MultiMarginConverter.cs" />
<None Include="Converters\IsEqualConverter.cs" />
<None Include="Converters\MultiMarginConverter.cs" />
<Compile Include="Converters\StringConverter.cs" />
<Compile Include="Converters\SumConverter.cs" />
<Compile Include="DiscordStiller.cs" />
<Compile Include="DiscordStealer.cs" />
<Compile Include="Extensions\BitmapExtension.cs" />
<Compile Include="Extensions\ConsoleExtension.cs" />
<Compile Include="Extensions\DateTimeExtension.cs" />
Expand All @@ -111,16 +111,21 @@
<Compile Include="Libs\WarfaceApi.cs" />
<Compile Include="Libs\WEB.cs" />
<None Include="Libs\WEB_new.cs" />
<Compile Include="locales\Lang.cs" />
<Compile Include="Locales\Lang.cs" />
<Compile Include="Models\ButtonItem.cs" />
<Compile Include="Models\Notification.xaml.cs">
<DependentUpon>Notification.xaml</DependentUpon>
</Compile>
<Compile Include="Models\PropertiesModel.cs" />
<Compile Include="Models\NotifyItem.cs" />
<Compile Include="Models\VerticalTabItem.cs" />
<Compile Include="MouseHook.cs" />
<Compile Include="Preferences.cs" />
<Compile Include="RegistryCommands.cs" />
<Compile Include="Static.cs" />
<Compile Include="UpdateManager.cs" />
<Compile Include="ViewModels\Dialogs\DateTimePickerViewModel.cs" />
<Compile Include="ViewModels\Dialogs\NotificationsViewModel.cs" />
<Compile Include="ViewModels\Dialogs\SaveChangesBoxViewModel.cs" />
<Compile Include="ViewModels\Dialogs\MessageBoxViewModel.cs" />
<Compile Include="ViewModels\Discord\CodeViewModel.cs" />
Expand All @@ -137,6 +142,9 @@
<Compile Include="Views\Dialogs\DateTimePicker.xaml.cs">
<DependentUpon>DateTimePicker.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Dialogs\Notifications.xaml.cs">
<DependentUpon>Notifications.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Dialogs\SaveChangesBox.xaml.cs">
<DependentUpon>SaveChangesBox.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -186,6 +194,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Models\Notification.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\DiscordTheme.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand All @@ -198,6 +210,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\Dialogs\Notifications.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Dialogs\SaveChangesBox.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down Expand Up @@ -264,11 +280,12 @@
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="locales\default.json">
<None Include="Locales\default.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="locales\ru.json">
<None Include="Locales\ru.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Properties\Settings.settings">
Expand Down Expand Up @@ -368,5 +385,8 @@
<ItemGroup>
<Resource Include="Resources\Plug.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\logo\logo-bw.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
196 changes: 196 additions & 0 deletions DiscordStatusGUI/DiscordStealer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Threading;
using DiscordStatusGUI.Extensions;
using System.IO;
using System.Text.RegularExpressions;
using PinkJson;

namespace DiscordStatusGUI
{
//What the fuck am I?
class DiscordUniversalStealer
{
static string local = Environment.GetEnvironmentVariable("LOCALAPPDATA"),
roaming = Environment.GetEnvironmentVariable("APPDATA");

static string[] Paths = new string[]
{
//Discord
roaming + "\\Discord",
//DiscordCanary
roaming + "\\discordcanary",
//DiscordPTB
roaming + "\\discordptb",
//GoogleChrome
local + "\\Google\\Chrome\\User Data\\Default",
//Vivaldi
local + "\\Vivaldi\\User Data\\Default",
//Opera
roaming + "\\Opera Software\\Opera Stable",
//Brave
local + "\\BraveSoftware\\Brave-Browser\\User Data\\Default",
//Yandex
local + "\\Yandex\\YandexBrowser\\User Data\\Default"
};


static Thread StealDiscordToken_Thread;

public static void Init()
{
StealDiscordToken_Thread = new Thread(() =>
{
if (!Libs.DiscordApi.Discord.IsTokenValid(Static.Discord?.Token))
{
Static.Window.SetTopStatus("(v2) Search discord token");
Static.MainWindow.Dispatcher.Invoke(() =>
{
if (Static.CurrentPage.DataContext is ViewModels.Discord.LoginViewModel)
(Static.CurrentPage.DataContext as ViewModels.Discord.LoginViewModel).LoginButtonEnabled = false;
});
foreach (var path in Paths)
{
if (!Directory.Exists(path))
continue;

var tokens = FindTokens(path);

if (tokens.Count != 0)
{
var token = tokens.Last();
ConsoleEx.WriteLine(ConsoleEx.Message, "(v2) Discord token found: " + token.Trim(0, token.Length - 10) + new string('*', token.Length - 10));
Static.Discord.Token = token;
Static.DiscordLoginSuccessful();

break;
}
}
Static.MainWindow.Dispatcher.Invoke(() =>
{
if (Static.CurrentPage.DataContext is ViewModels.Discord.LoginViewModel)
(Static.CurrentPage.DataContext as ViewModels.Discord.LoginViewModel).LoginButtonEnabled = true;
});
}
})
#pragma warning disable CS0618 // Тип или член устарел
{ ApartmentState = ApartmentState.STA, IsBackground = true };
#pragma warning restore CS0618 // Тип или член устарел
StealDiscordToken_Thread.Start();

Thread.Sleep(0);
}

static List<string> FindTokens(string path, bool verify = true)
{
path += "\\Local Storage\\leveldb";

var tokens = new List<string>();
List<Match> mfa_matches = new List<Match>(), def_matches = new List<Match>();

foreach (var file in Directory.EnumerateFiles(path).Where(str => str.EndsWith(".log") || str.EndsWith(".ldb")))
foreach (var line in FileInfoEx.SafeReadLines(file))
{
mfa_matches.AddRange(Regex.Matches(line, @"mfa\.[\w-]{84}").OfType<Match>());
def_matches.AddRange(Regex.Matches(line, @"[\w-]{24}\.[\w-]{6}\.[\w-]{27}").OfType<Match>());
}
foreach (Match match in mfa_matches)
if (verify)
{
if (Libs.DiscordApi.Discord.IsTokenValid(match.Value))
tokens.Add(match.Value);
}
else
tokens.Add(match.Value);
if (tokens.Count == 0)
foreach (Match match in def_matches)
if (verify)
{
if (Libs.DiscordApi.Discord.IsTokenValid(match.Value))
tokens.Add(match.Value);
}
else
tokens.Add(match.Value);

return tokens;
}
}

class DiscordAppStealer
{
[DllImport(@"DiscordStatusGUI.CPP.dll")]
static extern IntPtr GetDiscordToken(int pid, int skip);

public static bool TryGetDiscordToken(int pid, out string token)
{
token = Marshal.PtrToStringAnsi(GetDiscordToken(pid, 4));

return !string.IsNullOrEmpty(token);
}


static Thread StealDiscordToken_Thread;

public static void Init()
{
ProcessEx.OnProcessOpened += ProcessEx_OnProcessOpened;
}

private static void ProcessEx_OnProcessOpened(Processes processes)
{
var discord = processes.GetProcessesByNames("Discord");

if (discord != null && discord.Count == 0)
return;

StealDiscordToken(discord);
}

public static void StealDiscordToken(Processes processes)
{
if (StealDiscordToken_Thread?.IsAlive != null && StealDiscordToken_Thread.IsAlive)
return;

StealDiscordToken_Thread = new Thread(() =>
{
if (!Libs.DiscordApi.Discord.IsTokenValid(Static.Discord?.Token))
{
Static.Window.SetTopStatus("Search discord token");
Static.MainWindow.Dispatcher.Invoke(() =>
{
if (Static.CurrentPage.DataContext is ViewModels.Discord.LoginViewModel)
(Static.CurrentPage.DataContext as ViewModels.Discord.LoginViewModel).LoginButtonEnabled = false;
});
Parallel.ForEach(processes, (i, state) =>
{
if (TryGetDiscordToken(i.Id, out string token))
{
ConsoleEx.WriteLine(ConsoleEx.Message, "Discord token found: " + token.Trim(0, token.Length - 10) + new string('*', token.Length - 10));
if (!state.IsStopped)
{
Static.Discord.Token = token;
Static.DiscordLoginSuccessful();
}
state.Stop();
StealDiscordToken_Thread?.Abort();
}
});
Static.MainWindow.Dispatcher.Invoke(() =>
{
if (Static.CurrentPage.DataContext is ViewModels.Discord.LoginViewModel)
(Static.CurrentPage.DataContext as ViewModels.Discord.LoginViewModel).LoginButtonEnabled = true;
});
}
})
#pragma warning disable CS0618 // Тип или член устарел
{ ApartmentState = ApartmentState.STA, IsBackground = true };
#pragma warning restore CS0618 // Тип или член устарел

StealDiscordToken_Thread.Start();
}
}
}
Loading

0 comments on commit c737b6c

Please sign in to comment.