Initial commit

This commit is contained in:
2026-09-19 16:13:20 +03:00 Unverified
commit d60d5b98d4
24 changed files with 1278 additions and 0 deletions
+365
View File
@@ -0,0 +1,365 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
onnx-models
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Application
x:Class="IPClab3.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="using:IPClab3.Converters"
xmlns:local="using:IPClab3">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>
+69
View File
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using IPClab3.Services;
using IPClab3.ViewModels;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Microsoft.UI.Xaml.Shapes;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace IPClab3;
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : Application
{
public static IServiceProvider Services
{
get;
private set;
}
private Window? _window;
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
InitializeComponent();
Services = ConfigureServices();
}
/// <summary>
/// Invoked when the application is launched.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
_window = Services.GetRequiredService<MainWindow>();
_window.Activate();
}
private static ServiceProvider ConfigureServices()
{
var services = new ServiceCollection();
services.AddTransient<FilePickerService>();
services.AddTransient<ProcessHackerService>();
services.AddTransient<MainWindow>();
services.AddTransient<MainWindowViewModel>();
return services.BuildServiceProvider();
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

+61
View File
@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Markup;
namespace IPClab3.Converters;
public class MemoryAddressConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is IntPtr ptr)
{
if (ptr == IntPtr.Zero)
return "0x0";
ulong numericAddress = (ulong)ptr;
// Format dynamically: 8 digits for 32-bit (x86), 16 digits for 64-bit (x64)
string hexFormat = IntPtr.Size == 4 ? "X8" : "X16";
return $"0x{numericAddress.ToString(hexFormat, CultureInfo.InvariantCulture)}";
}
return "0x0";
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
if (value is string addressStr)
{
if (string.IsNullOrWhiteSpace(addressStr))
return IntPtr.Zero;
string cleanInput = addressStr.Trim();
if (cleanInput.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
{
cleanInput = cleanInput.Substring(2);
}
if (!ulong.TryParse(cleanInput, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out ulong numericAddress))
{
return IntPtr.Zero;
}
// Architecture safety overflow check
if (IntPtr.Size == 4 && numericAddress > uint.MaxValue)
{
return IntPtr.Zero;
}
return (IntPtr)numericAddress;
}
return IntPtr.Zero;
}
}
+157
View File
@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="utf-8"?>
<UserControl
x:Class="IPClab3.Hack.Hack"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:IPClab3"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:c="using:IPClab3.Converters"
mc:Ignorable="d">
<UserControl.Resources>
<c:MemoryAddressConverter x:Key="MemoryAddressConverter"/>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Margin="12" Background="{ThemeResource LayerFillColorDefaultBrush}" CornerRadius="8">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Выберите и запустите процесс" Style="{ThemeResource BodyLargeTextBlockStyle}" Margin="16"/>
<Grid Grid.Row="1" HorizontalAlignment="Stretch" Margin="16,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox IsReadOnly="True" Margin="0,0,8,0" Text="{x:Bind ViewModel.FilePath, Mode=OneWay}"/>
<Button Grid.Column="1" Content="Выбрать" Click="Button_Click"/>
</Grid>
<Button Grid.Row="2" Style="{ThemeResource AccentButtonStyle}" Margin="16" HorizontalAlignment="Stretch" Command="{x:Bind ViewModel.StartProcessCommand}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xF5B0;" />
<TextBlock Text="Запустить процесс" Margin="8,0"/>
</StackPanel>
</Button.Content>
</Button>
</Grid>
</Border>
<TextBlock Grid.Row="1" Text="или" HorizontalAlignment="Center" Style="{ThemeResource BodyLargeTextBlockStyle}"/>
<Border Grid.Row="2" Margin="12" Background="{ThemeResource LayerFillColorDefaultBrush}" CornerRadius="8">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Выберите запущенный процесс" Style="{ThemeResource BodyLargeTextBlockStyle}" Margin="16"/>
<AutoSuggestBox Grid.Row="1" PlaceholderText="Введите имя процесса" HorizontalAlignment="Stretch" Margin="16,0"
TextMemberPath="ProcessName" DisplayMemberPath="ProcessName" QueryIcon="Find"
Text="{x:Bind ViewModel.SearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{x:Bind ViewModel.Suggestions, Mode=OneWay}"
SuggestionChosen="AutoSuggestBox_SuggestionChosen" TextChanged="AutoSuggestBox_TextChanged"
/>
<Button Grid.Row="2" Style="{ThemeResource AccentButtonStyle}" Margin="16" HorizontalAlignment="Stretch" PointerEntered="Button_PointerEntered" Command="{x:Bind ViewModel.AttachProcessCommand}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE8CE;" />
<TextBlock Margin="8,0">
<Run Text="Подключить процесс: "/><Run Text="{x:Bind ViewModel.SelectedProcess.Pid, Mode=OneWay, TargetNullValue='', FallbackValue=''}"/>
</TextBlock>
</StackPanel>
</Button.Content>
</Button>
</Grid>
</Border>
<Border Grid.Row="3" Height="1" BorderThickness="0,1,0,0" BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}"/>
<Border Grid.Row="4" Margin="12" Background="{ThemeResource LayerFillColorDefaultBrush}" CornerRadius="8">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="{x:Bind ViewModel.ReadData, Mode=OneWay}" Style="{ThemeResource BodyLargeTextBlockStyle}" Margin="16"/>
<Grid Grid.Row="1" HorizontalAlignment="Stretch" Margin="16,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Grid Margin="0,0,8,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Margin="0,0,8,0" Text="Адрес: " VerticalAlignment="Center"/>
<TextBox Grid.Column="1" VerticalAlignment="Center" PlaceholderText="0x7FFF5000 или 00401000" Text="{x:Bind ViewModel.MemoryAddress, Converter={StaticResource MemoryAddressConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
<Grid Grid.Column="1" Margin="8,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Margin="0,0,8,0" Text="Длина: " VerticalAlignment="Center"/>
<NumberBox Grid.Column="1" SmallChange="1" Value="{x:Bind ViewModel.ReadLength, Mode=TwoWay}" Maximum="1024" VerticalAlignment="Center" SpinButtonPlacementMode="Compact"/>
</Grid>
</Grid>
<Button Grid.Row="2" Style="{ThemeResource AccentButtonStyle}" Margin="16" HorizontalAlignment="Stretch" Command="{x:Bind ViewModel.ReadMemoryCommand}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE773;" />
<TextBlock Margin="8,0" Text="Прочитать"/>
</StackPanel>
</Button.Content>
</Button>
</Grid>
</Border>
<Border Grid.Row="5" Margin="12" Background="{ThemeResource LayerFillColorDefaultBrush}" CornerRadius="8">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBox Text="{x:Bind ViewModel.WriteData, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="{ThemeResource BodyLargeTextBlockFontSize}" Margin="16"/>
<Grid Grid.Row="1" HorizontalAlignment="Stretch" Margin="16,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Grid Margin="0,0,8,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Margin="0,0,8,0" Text="Адрес: " VerticalAlignment="Center"/>
<TextBox Grid.Column="1" VerticalAlignment="Center" PlaceholderText="0x7FFF5000 или 00401000" Text="{x:Bind ViewModel.MemoryAddress, Converter={StaticResource MemoryAddressConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
<TextBlock Grid.Column="1" Margin="0,0,8,0" VerticalAlignment="Center" HorizontalAlignment="Center">
<Run Text="Длина: "/><Run Text="{x:Bind ViewModel.WriteData.Length, Mode=OneWay}"/>
</TextBlock>
</Grid>
<Button Grid.Row="2" Style="{ThemeResource AccentButtonStyle}" Margin="16" HorizontalAlignment="Stretch" Command="{x:Bind ViewModel.WriteMemoryCommand}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<FontIcon Glyph="&#xE929;" />
<TextBlock Margin="8,0" Text="Записать"/>
</StackPanel>
</Button.Content>
</Button>
</Grid>
</Border>
<InfoBar Severity="Success" Grid.RowSpan="7" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Margin="16" Title="Записано успешно!" IsOpen="{x:Bind ViewModel.IsSuccessOpen, Mode=TwoWay}"/>
</Grid>
</UserControl>
+52
View File
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using IPClab3.Models;
using IPClab3.ViewModels;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Windows.Foundation;
using Windows.Foundation.Collections;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace IPClab3.Hack;
public sealed partial class Hack : UserControl
{
public MainWindowViewModel ViewModel;
public Window window;
public Hack()
{
InitializeComponent();
}
private void AutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
{
ViewModel.SelectedProcess = (ProcessItem)args.SelectedItem;
}
private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
{
if (ViewModel.SelectedProcess?.ProcessName != sender.Text)
ViewModel.SelectedProcess = null;
}
private void Button_PointerEntered(object sender, PointerRoutedEventArgs e)
{
ViewModel.AttachProcessCommand.NotifyCanExecuteChanged();
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
await ViewModel.PickFile(WinRT.Interop.WindowNative.GetWindowHandle(window));
}
}
+73
View File
@@ -0,0 +1,73 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>IPClab3</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<WinUISDKReferences>false</WinUISDKReferences>
<EnableMsixTooling>true</EnableMsixTooling>
<Nullable>enable</Nullable>
<WindowsPackageType>None</WindowsPackageType>
<WindowsAppSdkBootstrapInitialize>true</WindowsAppSdkBootstrapInitialize>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>14.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
<!--
Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
Tools extension to be activated for this project even if the Windows App SDK Nuget
package has not yet been restored.
-->
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ProjectCapability Include="Msix" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.12" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="2.5.1" />
</ItemGroup>
<ItemGroup>
<Page Update="Hack.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Folder Include="Hack\" />
</ItemGroup>
<!--
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
Explorer "Package and Publish" context menu entry to be enabled for this project even if
the Windows App SDK Nuget package has not yet been restored.
-->
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>
<!-- Publish Properties -->
<PropertyGroup>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
</PropertyGroup>
</Project>
+13
View File
@@ -0,0 +1,13 @@
<Solution>
<Configurations>
<Platform Name="ARM64" />
<Platform Name="x64" />
<Platform Name="x86" />
</Configurations>
<Project Path="IPClab3.csproj">
<Platform Solution="*|ARM64" Project="ARM64" />
<Platform Solution="*|x64" Project="x64" />
<Platform Solution="*|x86" Project="x86" />
<Deploy />
</Project>
</Solution>
+25
View File
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Window
x:Class="IPClab3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:IPClab3"
xmlns:h="using:IPClab3.Hack"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="IPClab3">
<Window.SystemBackdrop>
<MicaBackdrop />
</Window.SystemBackdrop>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TitleBar Title="IPClab2" x:Name="AppTitleBar"/>
<h:Hack Grid.Row="1" x:Name="yeag"/>
</Grid>
</Window>
+38
View File
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using IPClab3.Models;
using IPClab3.ViewModels;
using Microsoft.UI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Windows.Foundation;
using Windows.Foundation.Collections;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace IPClab3;
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainWindow : Window
{
public MainWindow(MainWindowViewModel viewModel)
{
InitializeComponent();
yeag.ViewModel = viewModel;
yeag.window = this;
ExtendsContentIntoTitleBar = true;
SetTitleBar(AppTitleBar);
AppWindow.Resize(new Windows.Graphics.SizeInt32(550, 850));
}
}
+19
View File
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IPClab3.Models;
public class ProcessItem
{
public int Pid
{
get; set;
}
public string ProcessName
{
get; set;
}
}
+53
View File
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
xmlns:systemai="http://schemas.microsoft.com/appx/manifest/systemai/windows10"
IgnorableNamespaces="uap rescap systemai">
<Identity
Name="a3c918ae-1cbf-4dcf-a348-99bb7e1380c8"
Publisher="CN=retrd"
Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="a3c918ae-1cbf-4dcf-a348-99bb7e1380c8" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>IPClab3</DisplayName>
<PublisherDisplayName>retrd</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26226.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26226.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="IPClab3"
Description="IPClab3"
BackgroundColor="transparent"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
<systemai:Capability Name="systemAIModels"/>
</Capabilities>
</Package>
+10
View File
@@ -0,0 +1,10 @@
{
"profiles": {
"IPClab3 (Package)": {
"commandName": "MsixPackage"
},
"IPClab3 (Unpackaged)": {
"commandName": "Project"
}
}
}
+22
View File
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage.Pickers;
namespace IPClab3.Services;
public class FilePickerService
{
public async Task<string> RequestFileOpener(IntPtr hwnd)
{
var picker = new FileOpenPicker();
picker.FileTypeFilter.Add(".exe");
WinRT.Interop.InitializeWithWindow.Initialize(picker, hwnd);
var file = await picker.PickSingleFileAsync();
return file?.Path;
}
}
+68
View File
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace IPClab3.Services;
public partial class ProcessHackerService
{
private IntPtr _processHandle;
const int PROCESS_VM_READ = 0x0010;
const int PROCESS_VM_WRITE = 0x0020;
const int PROCESS_VM_OPERATION = 0x0008;
[LibraryImport("kernel32.dll", SetLastError = true)]
public static partial IntPtr OpenProcess(int dwDesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, int dwProcessId);
[LibraryImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out] byte[] lpBuffer, int dwSize, out IntPtr lpNumberOfBytesRead);
[LibraryImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, int dwSize, out IntPtr lpNumberOfBytesWritten);
[LibraryImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool CloseHandle(IntPtr hObject);
public int StartProcess(string target)
{
var process = Process.Start(target);
CloseHandle(_processHandle);
_processHandle = OpenProcess(process.Id);
return process.Id;
}
public int AttachProcess(int pid)
{
CloseHandle(_processHandle);
_processHandle = OpenProcess(pid);
return pid;
}
private IntPtr OpenProcess(int pid)
{
return OpenProcess(PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION, false, pid);
}
public bool ReadMemory(IntPtr address, int size, out byte[] bytes)
{
var buffer = new byte[size];
var result = ReadProcessMemory(_processHandle, address, buffer, buffer.Length, out var bytesRead);
bytes = buffer;
return result;
}
public bool WriteMemory(IntPtr address, string newMemory)
{
var newBytes = Encoding.UTF8.GetBytes(newMemory + "\0");
var result = WriteProcessMemory(_processHandle, address, newBytes, newBytes.Length, out var bytesWritten);
return result;
}
}
+217
View File
@@ -0,0 +1,217 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using IPClab3.Models;
using IPClab3.Services;
namespace IPClab3.ViewModels;
public partial class MainWindowViewModel(ProcessHackerService processHackerService, FilePickerService filePickerService) : ObservableObject
{
private ProcessHackerService _processHackerService = processHackerService;
private FilePickerService _filePickerService = filePickerService;
private CancellationTokenSource _cts;
private List<ProcessItem> _allProcesses;
[ObservableProperty]
private ObservableCollection<ProcessItem> _suggestions = [];
private string _searchText = string.Empty;
public string SearchText
{
get => _searchText;
set
{
if (SetProperty(ref _searchText, value))
{
_ = UpdateSuggestionsAsync(value);
}
}
}
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(AttachProcessCommand))]
public partial ProcessItem SelectedProcess
{
get;
set;
}
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(ReadMemoryCommand))]
[NotifyCanExecuteChangedFor(nameof(WriteMemoryCommand))]
public partial int StartedPid
{
get;
set;
}
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(ReadMemoryCommand))]
[NotifyCanExecuteChangedFor(nameof(WriteMemoryCommand))]
public partial IntPtr MemoryAddress
{
get;
set;
}
private async Task UpdateSuggestionsAsync(string query)
{
// 1. Cancel the previous running search task immediately
_cts?.Cancel();
_cts?.Dispose();
_cts = new CancellationTokenSource();
var token = _cts.Token;
if (string.IsNullOrWhiteSpace(query))
{
Suggestions.Clear();
return;
}
try
{
// Optional: Debounce briefly (e.g., wait 150ms) to ensure the user
// stopped typing before blasting the OS with process queries.
await Task.Delay(150, token);
// 2. Offload the heavy blocking OS operation to a pool thread
List<ProcessItem> filteredResults = await Task.Run(() =>
{
// Check token before starting the heavy lifting
token.ThrowIfCancellationRequested();
// Hit the live OS snapshot
var liveSnapshot = Process.GetProcesses();
token.ThrowIfCancellationRequested();
// Filter on the background thread
return liveSnapshot
.Where(p => p.ProcessName.Contains(query, StringComparison.OrdinalIgnoreCase))
.Select(p => new ProcessItem { Pid = p.Id, ProcessName = p.ProcessName })
.OrderBy(p => p.ProcessName)
.ToList();
}, token);
// 3. Check token one final time before updating the UI thread
token.ThrowIfCancellationRequested();
// Safely swap out items on the Main/UI thread
Suggestions.Clear();
foreach (var process in filteredResults)
{
Suggestions.Add(process);
}
}
catch (OperationCanceledException)
{
// Ignored: Expected when the user types quickly and cancels old operations
}
catch (Exception ex)
{
Debug.WriteLine($"Error fetching processes: {ex.Message}");
}
}
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(StartProcessCommand))]
public partial string FilePath
{
get;
set;
}
public async Task PickFile(IntPtr hwnd)
{
FilePath = await _filePickerService.RequestFileOpener(hwnd);
}
private bool CanStartProcess()
{
return File.Exists(FilePath);
}
[RelayCommand(CanExecute = nameof(CanStartProcess))]
public void StartProcess()
{
StartedPid = _processHackerService.StartProcess(FilePath);
}
private bool CanAttachProcess()
{
if (SelectedProcess == null) return false;
try
{
var process = Process.GetProcessById(SelectedProcess.Pid);
return true;
}
catch (ArgumentException) { return false; }
}
[RelayCommand(CanExecute = nameof(CanAttachProcess))]
public void AttachProcess()
{
StartedPid = _processHackerService.AttachProcess(SelectedProcess.Pid);
}
[ObservableProperty]
public partial string ReadData
{
get;
set;
} = "Прочитать из памяти";
[ObservableProperty]
public partial int ReadLength
{
get;
set;
}
[ObservableProperty]
public partial string WriteData
{
get;
set;
} = "Записать в память";
private bool CanWorkWithMemory()
{
return StartedPid != 0 && MemoryAddress != IntPtr.Zero;
}
[RelayCommand(CanExecute = nameof(CanWorkWithMemory))]
public void ReadMemory()
{
if (_processHackerService.ReadMemory(MemoryAddress, ReadLength, out var bytes))
ReadData = Encoding.UTF8.GetString(bytes);
}
[RelayCommand(CanExecute = nameof(CanWorkWithMemory))]
public void WriteMemory()
{
if (_processHackerService.WriteMemory(MemoryAddress, WriteData))
{
IsSuccessOpen = true;
Task.Run(() => { Task.Delay(10000); IsSuccessOpen = false; });
}
}
[ObservableProperty]
public partial bool IsSuccessOpen
{
get;
set;
}
}
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="IPClab3.app"/>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- The ID below informs the system that this application is compatible with OS features first introduced in Windows 10.
It is necessary to support features in unpackaged applications, for example the custom titlebar implementation.
For more info see https://docs.microsoft.com/windows/apps/windows-app-sdk/use-windows-app-sdk-run-time#declare-os-compatibility-in-your-application-manifest -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
</windowsSettings>
</application>
</assembly>