Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
More improvements
Browse files Browse the repository at this point in the history
Embedded VAC Bypass
Used HttpClient instead of WebClient
  • Loading branch information
lnx00 committed Feb 17, 2022
1 parent aba2554 commit 4f0b627
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 22 deletions.
75 changes: 56 additions & 19 deletions Fedoraloader/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ int nHeightEllipse

private Point _mouseStartPos;
private string _workDir;
private string _fileDir;

public MainWindow()
{
Expand All @@ -52,6 +53,7 @@ public MainWindow()
}

_workDir = Path.GetTempPath() + Properties.Settings.Default.folderID;
_fileDir = _workDir + @"\Data\";
Debug.WriteLine(_workDir);

chkBypass.Checked = Properties.Settings.Default.bypass;
Expand All @@ -74,23 +76,35 @@ await Task.Run(() =>

private void RunLoader()
{
// Cleanup and preperation
UpdateStatus("Preparing files...");
try
{
if (Directory.Exists(_fileDir))
{
Directory.Delete(_fileDir, true);
}

Directory.CreateDirectory(_fileDir);
}
catch (Exception ex)
{
MessageBox.Show("Failed to create working directory:\n" + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}

Thread.Sleep(250);

// Wait for TF2
UpdateStatus("Searching for TF2...");
Process tfProcess = GetGameProcess();
if (tfProcess == null) { return; }
string dllFile = _workDir + @"Fware(Release).dll";
Process? tfProcess = GetGameProcess();
if (tfProcess == null) { MessageBox.Show("Invalid game process!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
string dllFile = _fileDir + @"Fware(Release).dll";

// Download latest build
try
{
string dlPath = _workDir + @"\" + Utils.RandomString(8) + ".zip";

// Cleanup and preperation
UpdateStatus("Preparing files...");
if (Directory.Exists(_workDir))
{
Directory.Delete(_workDir, true);
}
Directory.CreateDirectory(_workDir);
string dlPath = _fileDir + @"\" + Utils.RandomString(8) + ".zip";

// Add defender exception if enabled
if (chkDefender.Checked)
Expand All @@ -105,17 +119,34 @@ private void RunLoader()
}
}

Thread.Sleep(250);

// Download build
UpdateStatus("Downloading...");
WebClient wc = new();
wc.DownloadFile(ACTION_URL, dlPath);
/*WebClient wc = new();
wc.DownloadFile(ACTION_URL, dlPath);*/

HttpClientHandler clientHandler = new();
clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true;

using (var httpClient = new HttpClient())
{
using var request = new HttpRequestMessage(HttpMethod.Get, ACTION_URL);
using var contentStream = httpClient.Send(request).Content.ReadAsStream();
using var fileStream = new FileStream(dlPath, FileMode.Create, FileAccess.Write);
contentStream.CopyTo(fileStream);
}

Thread.Sleep(250);

// Extract build
UpdateStatus("Extracting files...");
ZipFile.ExtractToDirectory(dlPath, _workDir, true);
ZipFile.ExtractToDirectory(dlPath, _fileDir, true);
File.Delete(dlPath);

dllFile = Directory.GetFiles(_workDir, "*.dll").First();
Thread.Sleep(250);

dllFile = Directory.GetFiles(_fileDir, "*.dll").First();
}
catch (Exception ex)
{
Expand Down Expand Up @@ -232,6 +263,12 @@ private bool VacBypass()
Thread.Sleep(250);
} while (Process.GetProcesses().Count(p => p.ProcessName is "hl2" or "steam" or "steamwebhelper") > 0);

// Extract VAC Bypass
Directory.CreateDirectory(_workDir + @"\Bypass\");
File.WriteAllBytes(_workDir + @"\Bypass\VAC-Bypass.dll", Properties.Resources.VAC_Bypass);

Thread.Sleep(250);

// Start new steam process
UpdateStatus("Starting Steam...");
string steamPath = (string)Registry.GetValue(@"HKEY_CURRENT_USER\Software\Valve\Steam", "SteamExe", "");
Expand Down Expand Up @@ -262,8 +299,8 @@ private bool VacBypass()
} while (!moduleFound);

UpdateStatus("Loading VAC bypass...");
Injector steamInjector = new Injector();
InjectionResult injectionResult = steamInjector.Inject(steamProcess.Handle, AppDomain.CurrentDomain.BaseDirectory + @"\VAC-Bypass.dll");
Injector steamInjector = new();
InjectionResult injectionResult = steamInjector.Inject(steamProcess.Handle, _workDir + @"\Bypass\VAC-Bypass.dll");
if (injectionResult != InjectionResult.Success)
{
MessageBox.Show("VAC bypass failed! Could not inject into Steam.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
Expand All @@ -274,7 +311,7 @@ private bool VacBypass()

do
{
Thread.Sleep(1000);
Thread.Sleep(1500);
} while (Process.GetProcesses().Count(p => p.ProcessName is "hl2") == 0);

return true;
Expand Down
10 changes: 10 additions & 0 deletions Fedoraloader/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Fedoraloader/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,19 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=6.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=6.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=6.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\img\logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="gradient" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\img\gradient.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="VAC-Bypass" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\VAC-Bypass.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
Binary file added Fedoraloader/Resources/VAC-Bypass.dll
Binary file not shown.
1 change: 1 addition & 0 deletions VAC-Bypass/VAC-Bypass.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)$(ProjectName)\$(Configuration)</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
Expand Down
2 changes: 2 additions & 0 deletions VAC-Bypass/VAC-Bypass.vcxproj.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CppProjectProperties/LanguageStandard/@EntryValue">Cpp17</s:String></wpf:ResourceDictionary>

0 comments on commit 4f0b627

Please sign in to comment.