Skip to content

Commit

Permalink
Initial code commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
OrfeasZ committed Jul 21, 2014
1 parent d864914 commit 149021e
Show file tree
Hide file tree
Showing 7 changed files with 400 additions and 3 deletions.
22 changes: 22 additions & 0 deletions LinkFilterDisabler.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LinkFilterDisabler", "LinkFilterDisabler.vcxproj", "{3319ACD7-1AB3-4575-8061-E76637C090A6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3319ACD7-1AB3-4575-8061-E76637C090A6}.Debug|Win32.ActiveCfg = Debug|Win32
{3319ACD7-1AB3-4575-8061-E76637C090A6}.Debug|Win32.Build.0 = Debug|Win32
{3319ACD7-1AB3-4575-8061-E76637C090A6}.Release|Win32.ActiveCfg = Release|Win32
{3319ACD7-1AB3-4575-8061-E76637C090A6}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
94 changes: 94 additions & 0 deletions LinkFilterDisabler.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3319ACD7-1AB3-4575-8061-E76637C090A6}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>LinkFilterDisabler</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v100</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v100</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Src\stdafx.h" />
<ClInclude Include="Src\targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Src\LinkFilterDisabler.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
30 changes: 30 additions & 0 deletions LinkFilterDisabler.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Src\stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Src\targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Src\LinkFilterDisabler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
SteamLinkFilterDisabler
=======================
# Steam - Link Filter Disabler

Disables Steam's check for 'malicious' links, making it instantly launch any clicked link.
This is a small program that aims to disable Steam's 'malicious' link checks.
To use it, simply run it as an administrator and wait while it patches Steam.

You will have to re-patch Steam every time you launch it, since this is a simple in-memory patch.

After Steam is patched, you should be able to click on any link sent on chat and have it open instantly!

----------

## Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

This software is in no way sponsored, endorsed, or supported by, or associated with, Valve, Steam, or any of their partners.

**USE THIS AT YOUR OWN RISK!**
211 changes: 211 additions & 0 deletions Src/LinkFilterDisabler.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
/**
* Author: Orfeas Zafeiris (https://github.com/OrfeasZ)
* Project: LinkFilterDisabler
* Original Filename: LinkFilterDisabler.cpp
* Creation Date: 22/07/2014 23:30
*/

#include "stdafx.h"

#include <tlhelp32.h>
#include <conio.h>
#include <stdlib.h>
#include <psapi.h>

#pragma comment(lib, "Psapi.lib")

DWORD FindProcessID(const char* p_ProcessName)
{
PROCESSENTRY32 s_ProcessEntry;
s_ProcessEntry.dwSize = sizeof(PROCESSENTRY32);

HANDLE s_Snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
DWORD s_ProcessID = NULL;

if (Process32First(s_Snapshot, &s_ProcessEntry))
{
while (Process32Next(s_Snapshot, &s_ProcessEntry))
{
if (_stricmp(s_ProcessEntry.szExeFile, p_ProcessName) == 0)
{
s_ProcessID = s_ProcessEntry.th32ProcessID;
break;
}
}
}

CloseHandle(s_Snapshot);

return s_ProcessID;
}

HMODULE FindModule(HANDLE p_Process, const char* p_ModuleName)
{
HMODULE s_Modules[1024];
DWORD s_CbNeeded;

// Get a list of all the modules in this process.
if (!EnumProcessModules(p_Process, s_Modules, sizeof(s_Modules), &s_CbNeeded))
return NULL;

for (size_t i = 0; i < (s_CbNeeded / sizeof(HMODULE)); i++)
{
char s_ModuleName[MAX_PATH];

// These are not the modules you're looking for!
if (!GetModuleBaseNameA(p_Process, s_Modules[i], s_ModuleName, sizeof(s_ModuleName) / sizeof(char)))
continue;

if (_stricmp(s_ModuleName, p_ModuleName) == 0)
return s_Modules[i];
}

return NULL;
}

DWORD FindPattern(HANDLE p_Process, DWORD p_StartAddress, DWORD p_SearchLength, PBYTE p_Pattern, const char* p_Mask)
{
size_t s_MaskLength = strlen(p_Mask);

for (DWORD i = 0; i < p_SearchLength - s_MaskLength; ++i)
{
int s_FoundBytes = 0;

for (DWORD j = 0; j < s_MaskLength; ++j)
{
BYTE s_ByteRead;

if (!ReadProcessMemory(p_Process, (void*)(p_StartAddress + i + j), &s_ByteRead, 1, NULL))
return NULL;

if (s_ByteRead != p_Pattern[j] && p_Mask[j] != '?')
break;

++s_FoundBytes;

if (s_FoundBytes == s_MaskLength)
return p_StartAddress + i;
}
}

return NULL;
}

void ConfirmExit()
{
printf("\nPress any key to exit...\n");

// Wait for keypress
while (!_kbhit())
Sleep(1);

_getch();
}

int main(int argc, char* argv[])
{
SetConsoleTitleA("Steam Link Filter Disabler - v1.0");

// Print disclaimer.
printf("DISCLAIMER:\n");
printf("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n");
printf("This software is in no way sponsored, endorsed, or supported by, or associated with, Valve, Steam, or any of their partners.\n\n");
printf("USE THIS AT YOUR OWN RISK!\n\n");
printf("You can find the source on GitHub at:\n");
printf("https://github.com/OrfeasZ/SteamLinkFilterDisabler\n\n");

printf("Press any key to confirm and continue...\n");

// Wait for keypress
while (!_kbhit())
Sleep(1);

_getch();

// Clear the console
system("cls");

//
printf("Locating Steam process... ");
DWORD s_ProcessID = FindProcessID("Steam.exe");

if (s_ProcessID == NULL)
{
printf("FAILED\n");
printf("\nPlease make sure Steam is running and try again.\n");
ConfirmExit();
return 1;
}

printf("DONE\n");

// Find target module
printf("Finding friends module... ");

// Try opening the process.
HANDLE s_Process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION, FALSE, s_ProcessID);

if (s_Process == NULL)
{
printf("FAILED\n");
printf("\nFailed to open process. Please make sure you have the appropriate permissions and try again.\n");
ConfirmExit();
return 1;
}

HMODULE s_FriendsModule = FindModule(s_Process, "friendsui.dll");

if (s_FriendsModule == NULL)
{
printf("FAILED\n");
printf("\nFailed to find friends module. Please make sure you are fully logged in and try again.\n");
ConfirmExit();
return 1;
}

printf("DONE\n");

// Find the byte we need to patch.
printf("Finding address to patch... ");

// NOTE: This is slow. Could've been done better.
DWORD s_Address = FindPattern(s_Process, (DWORD)s_FriendsModule, 0x100000,
(PBYTE)"\x75\x10\x83\xC6\x00\x81\xFE\x00\x00\x00\x00\x72\xE5\x5F\x5E\x5B",
"xxxx?xx?xxxxxxxx");

if (s_Address == NULL)
{
printf("FAILED\n");
printf("\nFailed to find patch address. Are you running an updated or already patched version?\n");
ConfirmExit();
return 1;
}

printf("DONE\n");

// Patch the link filter to consider all links as official links.
printf("Patching... ");

BYTE s_PatchByte = 0x71;
if (!WriteProcessMemory(s_Process, (void*)s_Address, &s_PatchByte, 1, NULL))
{
printf("FAILED\n");
printf("\nFailed to patch. Please make sure you have the appropriate permissions and try again.\n");
ConfirmExit();
return 1;
}

printf("DONE\n\n");

// Release the handle to the process.
CloseHandle(s_Process);

// We're done here!
printf("Steam has been successfully patched!\n");
printf("Exiting in 5 seconds...\n");

Sleep(5000);

return 0;
}

Loading

0 comments on commit 149021e

Please sign in to comment.