-
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
0 parents
commit e84d164
Showing
9 changed files
with
313 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,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.6.33723.286 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AntiFBT", "VRC-AntiFBTHeaven\AntiFBT.csproj", "{0C68A3A6-18EB-4A63-8268-1AA73297919E}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{0C68A3A6-18EB-4A63-8268-1AA73297919E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{0C68A3A6-18EB-4A63-8268-1AA73297919E}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{0C68A3A6-18EB-4A63-8268-1AA73297919E}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{0C68A3A6-18EB-4A63-8268-1AA73297919E}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {9849FBD8-7C68-4473-B968-7523E6E5D5F0} | ||
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,26 @@ | ||
using System.Net; | ||
using VRC_AntiFBTHeaven.Wrappers; | ||
|
||
namespace VRC_AntiFBTHeaven | ||
{ | ||
internal class APIClient | ||
{ | ||
public static string MutedUsers = "https://pastebin.com/raw/VjXi7YRP"; | ||
public static string AdminUsers = "https://pastebin.com/raw/FVZUy0XG"; | ||
public static string BannedUsers = "https://pastebin.com/raw/vEZVMirL"; | ||
|
||
public static async Task<string> DownloadList(string URL) | ||
{ | ||
HttpClient Client = new(new HttpClientHandler { UseCookies = false, AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }); | ||
Client.DefaultRequestHeaders.Add("User-Agent", $"Mozilla/5.0 ({Utils.RandomString(25)})"); | ||
Client.DefaultRequestHeaders.Host = "pastebin.com"; | ||
|
||
HttpRequestMessage payload = new(HttpMethod.Get, URL); | ||
|
||
HttpResponseMessage Resp = await Client.SendAsync(payload); | ||
if (Resp.IsSuccessStatusCode) return await Resp.Content.ReadAsStringAsync(); | ||
|
||
return null; | ||
} | ||
} | ||
} |
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,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0-windows</TargetFramework> | ||
<RootNamespace>VRC_AntiFBTHeaven</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>disable</Nullable> | ||
</PropertyGroup> | ||
|
||
</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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<_LastSelectedProfileId>C:\Users\Umbra\source\repos\VRC-AntiFBTHeaven\VRC-AntiFBTHeaven\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId> | ||
</PropertyGroup> | ||
</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,149 @@ | ||
using System.Diagnostics; | ||
using System.Security.Principal; | ||
using VRC_AntiFBTHeaven.Wrappers; | ||
|
||
namespace VRC_AntiFBTHeaven | ||
{ | ||
internal class Boot | ||
{ | ||
public static void Main() | ||
{ | ||
Console.Title = "ANTI FBT HEAVEN BY UMBRA"; | ||
|
||
WindowsIdentity identity = WindowsIdentity.GetCurrent(); | ||
WindowsPrincipal principal = new WindowsPrincipal(identity); | ||
if (!principal.IsInRole(WindowsBuiltInRole.Administrator)) | ||
{ | ||
|
||
ProcessStartInfo startInfo = new() | ||
{ | ||
FileName = Environment.GetCommandLineArgs()[0], | ||
UseShellExecute = true, | ||
Verb = "runas", | ||
Arguments = "/runas" | ||
}; | ||
|
||
Process.Start(startInfo); | ||
return; | ||
} | ||
|
||
ToggleHostBlock(false); | ||
|
||
Task ListDumper = Task.Run(async () => | ||
{ | ||
string MutedUsers = await APIClient.DownloadList(APIClient.MutedUsers); | ||
Logger.LogDebug("MUTED USERS: \n" + MutedUsers); | ||
string AdminUsers = await APIClient.DownloadList(APIClient.AdminUsers); | ||
Logger.LogDebug("ADMIN USERS: \n" + AdminUsers); | ||
string BannedUsers = await APIClient.DownloadList(APIClient.BannedUsers); | ||
Logger.LogDebug("BANNED USERS: \n" + BannedUsers); | ||
}); | ||
ListDumper.Wait(); | ||
|
||
ScanLog(); | ||
} | ||
|
||
private static void ToggleHostBlock(bool State) | ||
{ | ||
string hostsFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "drivers/etc/hosts"); | ||
string targetDomain = "0.0.0.0 pastebin.com"; | ||
List<string> savedFile = File.ReadAllLines(hostsFilePath).ToList(); | ||
|
||
if (State) | ||
{ | ||
if (savedFile.Contains(targetDomain)) return; | ||
savedFile.Add(targetDomain); | ||
Logger.LogSuccess("Joining FBT Heaven, Anti enabled"); | ||
} | ||
else | ||
{ | ||
if (!savedFile.Contains(targetDomain)) return; | ||
savedFile.Remove(targetDomain); | ||
Logger.LogSuccess("Leaving FBT Heaven, Anti disabled"); | ||
} | ||
|
||
File.WriteAllLines(hostsFilePath, savedFile); | ||
} | ||
|
||
private static void ScanLog() | ||
{ | ||
var directory = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"Low\VRChat\VRChat"); | ||
if (directory != null && directory.Exists) | ||
{ | ||
FileInfo target = null; | ||
foreach (var info in directory.GetFiles("output_log_*.txt", SearchOption.TopDirectoryOnly)) | ||
{ | ||
if (target == null || info.LastWriteTime.CompareTo(target.LastWriteTime) >= 0) target = info; | ||
} | ||
|
||
if (target != null) | ||
{ | ||
Process[] VRCProcs = Process.GetProcessesByName("VRChat"); | ||
if (VRCProcs != null && VRCProcs.Length > 0) | ||
{ | ||
Logger.Log($"Watching VRChat Process [{target.Name}]"); | ||
Process VRChat = VRCProcs[0]; | ||
|
||
ReadNewLines(target.FullName); | ||
|
||
while (!VRChat.HasExited) | ||
{ | ||
ReadLog(target.FullName); | ||
Thread.Sleep(1); | ||
} | ||
|
||
ToggleHostBlock(false); | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
private static void ReadLog(string Path) | ||
{ | ||
var lines = ReadNewLines(Path); | ||
|
||
foreach (var line in lines) | ||
{ | ||
if (line.Contains("Destination set: ")) | ||
{ | ||
ToggleHostBlock(line.Contains("Destination set: wrld_d319c58a-dcec-47de-b5fc-21200116462c")); | ||
} | ||
} | ||
} | ||
|
||
private static List<string> ReadNewLines(string filePath) | ||
{ | ||
List<string> lines = new(); | ||
|
||
try | ||
{ | ||
using var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); | ||
using var reader = new StreamReader(stream); | ||
|
||
// Set the file position to the last known position | ||
reader.BaseStream.Seek(LastReadOffset, SeekOrigin.Begin); | ||
|
||
string line; | ||
while ((line = reader.ReadLine()) != null) | ||
{ | ||
lines.Add(line); | ||
} | ||
|
||
// Update the last known position to the current end of the file | ||
LastReadOffset = reader.BaseStream.Position; | ||
} | ||
catch (IOException ex) | ||
{ | ||
Logger.LogError(ex); | ||
} | ||
|
||
return lines; | ||
} | ||
|
||
private static long LastReadOffset = 0; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
VRC-AntiFBTHeaven/Properties/PublishProfiles/FolderProfile.pubxml
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,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project> | ||
<PropertyGroup> | ||
<Configuration>Release</Configuration> | ||
<Platform>Any CPU</Platform> | ||
<PublishDir>bin\Release\net7.0-windows\publish\win-x64\</PublishDir> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<_TargetId>Folder</_TargetId> | ||
<TargetFramework>net7.0-windows</TargetFramework> | ||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
<SelfContained>false</SelfContained> | ||
<PublishSingleFile>true</PublishSingleFile> | ||
<PublishReadyToRun>false</PublishReadyToRun> | ||
</PropertyGroup> | ||
</Project> |
10 changes: 10 additions & 0 deletions
10
VRC-AntiFBTHeaven/Properties/PublishProfiles/FolderProfile.pubxml.user
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,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project> | ||
<PropertyGroup> | ||
<History>True|2023-05-29T16:14:35.6051419Z;True|2023-05-29T18:12:21.7609237+02:00;True|2023-05-29T18:11:39.7429795+02:00;True|2023-05-29T18:09:03.1009250+02:00;True|2023-05-29T18:08:42.7181996+02:00;True|2023-05-29T18:08:10.5221076+02:00;True|2023-05-29T18:07:27.4578659+02:00;True|2023-05-29T18:06:54.3900056+02:00;True|2023-05-29T18:05:22.2402936+02:00;True|2023-05-29T18:04:52.0403466+02:00;True|2023-05-29T18:03:36.9128387+02:00;True|2023-05-29T18:02:25.9292894+02:00;True|2023-05-29T17:59:57.4297030+02:00;True|2023-05-29T17:58:48.2702506+02:00;False|2023-05-29T17:58:38.6436782+02:00;True|2023-05-29T17:56:41.8811498+02:00;True|2023-05-29T17:53:44.9145059+02:00;True|2023-05-29T17:52:30.3990045+02:00;True|2023-05-29T17:51:04.1036087+02:00;True|2023-05-29T17:33:41.0664417+02:00;True|2023-05-29T17:32:42.6340121+02:00;</History> | ||
<LastFailureDetails /> | ||
</PropertyGroup> | ||
</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,41 @@ | ||
namespace VRC_AntiFBTHeaven.Wrappers | ||
{ | ||
internal class Logger | ||
{ | ||
public static void Log(object obj) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.DarkCyan; | ||
Console.WriteLine($"[{DateTime.Now.ToShortTimeString()}] [AntiFBT] {obj}"); | ||
} | ||
|
||
public static void LogDebug(object obj) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.DarkGray; | ||
Console.WriteLine($"[{DateTime.Now.ToShortTimeString()}] [AntiFBT] {obj}"); | ||
} | ||
|
||
public static void LogImportant(object obj) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.DarkMagenta; | ||
Console.WriteLine($"[{DateTime.Now.ToShortTimeString()}] [AntiFBT] {obj}"); | ||
} | ||
|
||
public static void LogSuccess(object obj) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.DarkGreen; | ||
Console.WriteLine($"[{DateTime.Now.ToShortTimeString()}] [AntiFBT] {obj}"); | ||
} | ||
|
||
public static void LogError(object obj) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Red; | ||
Console.WriteLine($"[{DateTime.Now.ToShortTimeString()}] [AntiFBT] {obj}"); | ||
} | ||
|
||
public static void LogWarning(object obj) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.DarkYellow; | ||
Console.WriteLine($"[{DateTime.Now.ToShortTimeString()}] [AntiFBT] {obj}"); | ||
} | ||
} | ||
} |
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,27 @@ | ||
namespace VRC_AntiFBTHeaven.Wrappers | ||
{ | ||
internal class Utils | ||
{ | ||
public static Random Random = new(Environment.TickCount); | ||
public static string RandomString(int length) | ||
{ | ||
char[] array = "abcdefghlijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".ToArray(); | ||
string text = string.Empty; | ||
for (int i = 0; i < length; i++) | ||
{ | ||
text += array[Random.Next(array.Length)].ToString(); | ||
} | ||
return text; | ||
} | ||
|
||
public static int RandomNumber(int Lowest, int Highest) | ||
{ | ||
return Random.Next(Lowest, Highest); | ||
} | ||
|
||
public static byte RandomByte() | ||
{ | ||
return (byte)Random.Next(0, 255); | ||
} | ||
} | ||
} |