Skip to content
This repository has been archived by the owner on Dec 24, 2022. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: XRadius/project-tanya
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: Kingwordking/project-tanya
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 10 commits
  • 23 files changed
  • 2 contributors

Commits on Oct 25, 2022

  1. feat: friendly lock configurable through appsettings.json

    lightbazinga committed Oct 25, 2022
    Copy the full SHA
    cf49709 View commit details
  2. feat: spectators counter, still need to work on.

    lightbazinga committed Oct 25, 2022
    Copy the full SHA
    ca164ff View commit details
  3. feat: gamemode offset for 'control'; still wip

    lightbazinga committed Oct 25, 2022
    Copy the full SHA
    6329406 View commit details
  4. feat: spectators

    lightbazinga committed Oct 25, 2022
    Copy the full SHA
    5e9f2fb View commit details

Commits on Jan 28, 2023

  1. Merge pull request #1 from piggydoggie/master

    B-K
    ElstaraNova authored Jan 28, 2023
    Copy the full SHA
    514b824 View commit details
  2. fix: aimbot offset

    Itsusinn committed Jan 28, 2023
    Copy the full SHA
    dabcecb View commit details
  3. chore: add a switch for sense

    Itsusinn committed Jan 28, 2023
    Copy the full SHA
    2dc7638 View commit details
  4. doc: update

    Itsusinn committed Jan 28, 2023
    Copy the full SHA
    da766b2 View commit details

Commits on Feb 1, 2023

  1. feat: add more switch for aimbot

    Itsusinn committed Feb 1, 2023
    Copy the full SHA
    d3c7453 View commit details

Commits on Feb 3, 2023

  1. fix: offset

    Itsusinn committed Feb 3, 2023
    Copy the full SHA
    755c88a View commit details
64 changes: 7 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -4,63 +4,13 @@

# Installation

This guide is written for *Ubuntu*. For other Linux flavors, adapt commands where needed.
## (1) Hide Process

## (1) Allow Root Login
> We'll ensure that non-root users are unable to see the `project-tanya` service.
We'll ensure that the `root` user can login.
See libprocesshider

1. Configure your `root` user password:

```
sudo passwd
```

See [this page for more information](https://www.cyberciti.biz/faq/how-can-i-log-in-as-root/) on the root user.

## (2) Enable Process Isolation

We'll ensure that non-root users are unable to see the `project-tanya` service.

1. Switch to the `root` user:

```
su
```

2. Install dependencies:

```
apt install -y vim
```

3. Open `/etc/fstab` with *vim*:

```
vim /etc/fstab
```

4. Add the following line:

```
proc /proc proc defaults,nosuid,nodev,noexec,relatime,hidepid=1 0 0
```

5. Reboot your system:

```
reboot
```

6. Check that your non-root user cannot see root processes:

```
ps aux
```

See [this page for more information](https://www.kernel.org/doc/Documentation/filesystems/proc.txt) on process isolation.

## (3) Disable Process Tracing
## (2) Disable Process Tracing

We'll ensure that non-root users cannot use `ptrace` capabilities.

@@ -96,7 +46,7 @@ sysctl kernel.yama.ptrace_scope

See [this page for more information](https://www.kernel.org/doc/Documentation/security/Yama.txt) on process tracing.

## (4) Install .NET
## (3) Install .NET

We'll ensure that `project-tanya` can be compiled with *.NET*.

@@ -117,7 +67,7 @@ su
apt update && apt install -y dotnet-sdk-6.0
```

## (5) Build Service
## (4) Build Service

We'll build `project-tanya`, so we can register it as a service:

@@ -163,7 +113,7 @@ chmod +x service-build.sh
./service-build.sh
```

## (6) Install Service
## (5) Install Service

We'll install `project-tanya` as a service:

Empty file modified service-build.sh
100644 → 100755
Empty file.
37 changes: 37 additions & 0 deletions src/Tanya.Core/Types/FloatType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.Runtime.CompilerServices;
using Tanya.Core.Interfaces;

namespace Tanya.Core.Types
{
public class FloatType : IType<float>
{
public static readonly FloatType Instance = new();

#region Constructors

private FloatType()
{
}

#endregion

#region Implementation of IType<ulong>

public float Get(byte[] buffer)
{
return Unsafe.ReadUnaligned<ulong>(ref buffer[0]);
}

public void Set(byte[] buffer, float value)
{
Unsafe.As<byte, float>(ref buffer[0]) = value;
}

public int Size()
{
return sizeof(ulong);
}

#endregion
}
}
1 change: 1 addition & 0 deletions src/Tanya.Game.Apex.Core/Constants.cs
Original file line number Diff line number Diff line change
@@ -7,5 +7,6 @@ public static class Constants
public const int EntityListSizePlayer = 64 * 32;
public const float UnitToMeter = 0.0254f;
public const int VisibilityTicks = (int)(TimeSpan.TicksPerMillisecond * 100);
public const int ControlGameMode = 1953394531;
}
}
3 changes: 2 additions & 1 deletion src/Tanya.Game.Apex.Core/Interfaces/IOffsets.cs
Original file line number Diff line number Diff line change
@@ -22,7 +22,8 @@ public interface IOffsets
uint PlayerTeamNum { get; }
uint PlayerVecPunchWeaponAngle { get; }
uint PlayerViewAngle { get; }

uint FYaw { get; }
uint GameMode { get; }
#endregion
}
}
14 changes: 14 additions & 0 deletions src/Tanya.Game.Apex.Core/Models/Player.cs
Original file line number Diff line number Diff line change
@@ -22,6 +22,8 @@ public class Player : IUpdatable
private readonly Access<byte> _teamNum;
private readonly Access<Vector> _vecPunchWeaponAngle;
private readonly Access<Vector> _viewAngle;
private readonly Access<float> _fYaw;
private readonly Access<ulong> _gameMode;

#region Constructors

@@ -38,6 +40,8 @@ public Player(IDriver driver, IOffsets offsets, ulong address)
_teamNum = driver.Access(address + offsets.PlayerTeamNum, ByteType.Instance, 1000);
_vecPunchWeaponAngle = driver.Access(address + offsets.PlayerVecPunchWeaponAngle, VectorType.Instance);
_viewAngle = driver.Access(address + offsets.PlayerViewAngle, VectorType.Instance);
_fYaw = driver.Access(address + offsets.FYaw, FloatType.Instance);
_gameMode = driver.Access(address + offsets.GameMode, UInt64Type.Instance);
}

#endregion
@@ -46,6 +50,11 @@ public Player(IDriver driver, IOffsets offsets, ulong address)

public bool IsSameTeam(Player otherPlayer)
{
//Console.WriteLine("GameMode: {0}", _gameMode.Get());
//Console.WriteLine("Comparation: {0}", _gameMode.Get() == Constants.ControlGameMode);
if (_gameMode.Get() == Constants.ControlGameMode)
return (otherPlayer.TeamNum & 1) == (TeamNum & 1);

return TeamNum == otherPlayer.TeamNum;
}

@@ -131,6 +140,10 @@ public Vector ViewAngle
[JsonPropertyName("visible")]
public bool Visible => _lastVisibleTime.Visible;

[JsonPropertyName("fYaw")]
public float FYaw => _fYaw.Get();


#endregion

#region Implementation of IUpdatable
@@ -148,6 +161,7 @@ public void Update(DateTime frameTime)
_teamNum.Update(frameTime);
_vecPunchWeaponAngle.Update(frameTime);
_viewAngle.Update(frameTime);
_fYaw.Update(frameTime);
}

#endregion
13 changes: 13 additions & 0 deletions src/Tanya.Game.Apex.Feature.Aim/Config.cs
Original file line number Diff line number Diff line change
@@ -22,6 +22,10 @@ public Config(IConfiguration config)
[JsonPropertyName("distance")]
public int Distance => _config.GetProperty<int>();


[JsonPropertyName("aimDistance")]
public int AimDistance => _config.GetProperty<int>();

[JsonPropertyName("lockTime")]
public int LockTime => _config.GetProperty<int>();

@@ -49,6 +53,15 @@ public Config(IConfiguration config)
[JsonPropertyName("yawSpeed")]
public float YawSpeed => _config.GetProperty<float>();


[JsonPropertyName("friendlyLock")]
public bool FriendlyLock => _config.GetProperty<bool>();

[JsonPropertyName("ignoreKockDown")]
public bool IgnoreKockDown => _config.GetProperty<bool>();

[JsonPropertyName("lockWhenSpeed")]
public bool LockWhenSpeed => _config.GetProperty<bool>();
#endregion
}
}
9 changes: 6 additions & 3 deletions src/Tanya.Game.Apex.Feature.Aim/Extensions/StateExtensions.cs
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ public static class StateExtensions
{
#region Statics

public static TargetType GetTargetType(this State state, Player localPlayer)
public static TargetType GetTargetType(this State state, Player localPlayer, Config config)
{
if (localPlayer.BleedoutState != 0)
{
@@ -22,11 +22,14 @@ public static TargetType GetTargetType(this State state, Player localPlayer)
return state.Buttons.InSpeed != 0 ? TargetType.All : TargetType.Enemy;
}

if (state.Buttons.InSpeed != 0)
if (state.Buttons.InSpeed != 0 && state.Buttons.InAttack != 0)
{
return TargetType.Enemy;
}
if (state.Buttons.InSpeed != 0 && state.Buttons.InZoom != 0)
{
return TargetType.Enemy;
}

return TargetType.None;
}

13 changes: 9 additions & 4 deletions src/Tanya.Game.Apex.Feature.Aim/Feature.cs
Original file line number Diff line number Diff line change
@@ -39,10 +39,15 @@ public Feature(Config config)

foreach (var target in state.IterateTargets().Where(x => x.IsValid(localPlayer) && x.Visible))
{
// Check contidions
if (_config.IgnoreKockDown && target.BleedoutState != 0) continue;

// Calculate the distance.
var distance = localPlayer.LocalOrigin.Distance2(target.LocalOrigin) * Constants.UnitToMeter;
if (distance >= _config.Distance) continue;

if (
(distance >= _config.Distance && state.Buttons.InZoom == 0) ||
(distance >= _config.AimDistance && state.Buttons.InZoom != 0)
) continue;
// Calculate the view angle delta.
var desiredAngle = AdjustSelf(localPlayer).GetDesiredAngle(AdjustTarget(target));
var deltaX = MathF.Abs(localPlayer.ViewAngle.X - desiredAngle.X);
@@ -117,7 +122,7 @@ public void Tick(DateTime frameTime, State state)
{
if (state.Players.TryGetValue(state.LocalPlayer, out var localPlayer))
{
var targetType = state.GetTargetType(localPlayer);
var targetType = state.GetTargetType(localPlayer, _config);
if (targetType == TargetType.None)
{
_target = null;
@@ -128,7 +133,7 @@ public void Tick(DateTime frameTime, State state)
}
else if (_target == null || _targetPreviousOrigin == null)
{
var target = Find(state, localPlayer, targetType == TargetType.All);
var target = Find(state, localPlayer, targetType == TargetType.All && _config.FriendlyLock);
if (target == null) return;
_target = target;
_targetLockTicks = frameTime.Ticks;
2 changes: 2 additions & 0 deletions src/Tanya.Game.Apex.Feature.Sense/Config.cs
Original file line number Diff line number Diff line change
@@ -18,6 +18,8 @@ public Config(IConfiguration config)
#endregion

#region Properties
[JsonPropertyName("enable")]
public bool Enable => _config.GetProperty<bool>();

[JsonPropertyName("distance")]
public int Distance => _config.GetProperty<int>();
3 changes: 3 additions & 0 deletions src/Tanya.Game.Apex.Feature.Sense/Feature.cs
Original file line number Diff line number Diff line change
@@ -20,6 +20,9 @@ public Feature(Config config)

public void Tick(DateTime frameTime, State state)
{
if (!_config.Enable){
return;
}
if (state.Players.TryGetValue(state.LocalPlayer, out var localPlayer))
{
foreach (var (_, player) in state.Players)
25 changes: 25 additions & 0 deletions src/Tanya.Game.Apex.Feature.Spectators/Bootstrap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.Extensions.DependencyInjection;
using Tanya.Game.Apex.Core.Interfaces;
using System.Net.Http;

namespace Tanya.Game.Apex.Feature.Spectators
{
public static class Bootstrap
{
#region Statics

public static void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<Config>();
services.AddTransient<IFeature, Feature>();
var client = new HttpClient();
try {
client.GetAsync("http://127.0.0.1:3000/safe").GetAwaiter().GetResult();
}
catch (Exception) { }

}

#endregion
}
}
18 changes: 18 additions & 0 deletions src/Tanya.Game.Apex.Feature.Spectators/Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.Extensions.Configuration;

namespace Tanya.Game.Apex.Feature.Spectators
{
public class Config
{
private readonly IConfigurationSection _config;

#region Constructors

public Config(IConfiguration config)
{
_config = config.GetSection(typeof(Config).Namespace);
}

#endregion
}
}
Loading