Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Summpot committed Apr 19, 2024
1 parent 84c6a9e commit 9de9f0a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 10 deletions.
9 changes: 8 additions & 1 deletion dotnet/Bypass.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageOutputPath>nupkgs</PackageOutputPath>
<PackageId>Pixeval.$(AssemblyName)</PackageId>
<MinVerTagPrefix>v</MinVerTagPrefix>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup Condition="'$(Configuration)' == 'Debug'">
Expand All @@ -32,5 +35,9 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="PolySharp" Version="1.14.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
20 changes: 19 additions & 1 deletion dotnet/Injector.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
namespace Bypass;
using System.Runtime.InteropServices;

namespace Bypass;

public class Injector
{
[DllImport("bypass", EntryPoint = "injector_inject")]
public static extern nint Inject(uint pid, string payloadPath);

[DllImport("bypass", EntryPoint = "injector_eject")]
public static extern void Eject(nint injection);

[DllImport("bypass", EntryPoint = "injector_set_dns_hook_enabled")]
public static extern void SetDnsHookEnabled(nint injection, bool enabled);

[DllImport("bypass", EntryPoint = "injector_set_ssl_hook_enabled")]
public static extern void SetSchannelSslHookEnabled(nint injection, bool enabled);

[DllImport("bypass", EntryPoint = "injector_set_chrome_hook_enabled")]
public static extern void SetChromeHookEnabled(nint injection, bool enabled);

[DllImport("bypass", EntryPoint = "injector_set_chrome_ssl_hook_enabled")]
public static extern void SetChromeSllHookEnabled(nint injection, bool enabled);
}
8 changes: 4 additions & 4 deletions src/injector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ pub fn install_dns_hook(injection: &Injection, enabled: bool) {
remote.call(&enabled).unwrap();
}

pub fn install_ssl_hook(injection: &Injection, enabled: bool) {
pub fn install_schannel_ssl_hook(injection: &Injection, enabled: bool) {
let remote = unsafe {
injection
.syringe_ptr
.as_ref()
.unwrap()
.get_payload_procedure::<fn(bool) -> ()>(injection.module, "install_ssl_hook")
.get_payload_procedure::<fn(bool) -> ()>(injection.module, "install_schannel_ssl_hook")
}
.unwrap()
.unwrap();
Expand Down Expand Up @@ -113,13 +113,13 @@ pub fn set_dns_hook_enabled(injection: &Injection, enabled: bool) {
remote.call(&enabled).unwrap();
}

pub fn set_ssl_hook_enabled(injection: &Injection, enabled: bool) {
pub fn set_schannel_ssl_hook_enabled(injection: &Injection, enabled: bool) {
let remote = unsafe {
injection
.syringe_ptr
.as_ref()
.unwrap()
.get_payload_procedure::<fn(bool) -> ()>(injection.module, "set_ssl_hook_enabled")
.get_payload_procedure::<fn(bool) -> ()>(injection.module, "set_schannel_ssl_hook_enabled")
}
.unwrap()
.unwrap();
Expand Down
11 changes: 7 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ payload_procedure! {
}

payload_procedure! {
fn remove_ssl_hook() {
fn remove_schannel_ssl_hook() {
schannel_ssl_hook::remove();
}
}
Expand All @@ -64,7 +64,7 @@ payload_procedure! {
}
}
payload_procedure! {
fn set_ssl_hook_enabled(enabled: bool) {
fn set_schannel_ssl_hook_enabled(enabled: bool) {
*schannel_ssl_hook::ENABLED.lock().unwrap().get_mut() = enabled;
}
}
Expand Down Expand Up @@ -102,8 +102,11 @@ unsafe extern "C" fn injector_set_dns_hook_enabled(injection: *mut Injection, en
}

#[no_mangle]
unsafe extern "C" fn injector_set_ssl_hook_enabled(injection: *mut Injection, enabled: bool) {
injector::set_ssl_hook_enabled(injection.as_ref().unwrap(), enabled)
unsafe extern "C" fn injector_set_schannel_ssl_hook_enabled(
injection: *mut Injection,
enabled: bool,
) {
injector::set_schannel_ssl_hook_enabled(injection.as_ref().unwrap(), enabled)
}

#[no_mangle]
Expand Down

0 comments on commit 9de9f0a

Please sign in to comment.