Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anticheat #644

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Anticheat-credits.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This project uses anticheat system, original code for which you can find at https://github.com/SS14AC/SS14.Anticheat.
16 changes: 16 additions & 0 deletions Anticheat.Inclusions/Anticheat.Inclusions.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Content.Server\Content.Server.csproj" />
<ProjectReference Include="..\..\RobustToolbox\Robust.Shared\Robust.Shared.csproj" />
<ProjectReference Include="..\Content.Anticheat.Server\Content.Anticheat.Server.csproj" />
<ProjectReference Include="..\Content.Anticheat.Shared\Content.Anticheat.Shared.csproj" />
</ItemGroup>

</Project>
Empty file.
53 changes: 53 additions & 0 deletions Anticheat.Inclusions/Server/Anticheat/AnticheatSystemProxy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// ***
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
// ***

using Content.Anticheat.Server.Systems;
using Content.Anticheat.Shared.Events;
using Content.Server.Administration;
using Content.Server.Chat.Managers;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;

namespace Content.Server.Anticheat;

public sealed class AnticheatSystemProxy : EntitySystem
{
/// <summary>
/// Adding a custom type would be better but would hurt the "drag and drop" aim we are going for.
/// </summary>
private const LogType Type = LogType.EventRan;

[Dependency] private readonly IPlayerLocator _locator = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLog = default!;
[Dependency] private readonly IChatManager _chat = default!;
[Dependency] private readonly ServerAnticheatSystem _serverAC = default!;

public override void Initialize()
{
base.Initialize();

SubscribeNetworkEvent<AnticheatJoinRespEvent>(OnACJoinResponse);
}

private async void OnACJoinResponse(AnticheatJoinRespEvent ev, EntitySessionEventArgs args)
{
if (_serverAC.ValidateJoinReply(ev, args.SenderSession.UserId))
return;

var sus = await _locator.LookupIdAsync(ev.User);
if (sus is null)
{
_adminLog.Add(Type, LogImpact.High, $"{args.SenderSession.Name} provided an invalid userid, might be deliberately tampering with residue file.");
_chat.SendAdminAlert($"{args.SenderSession.Name} provided an invalid userid, might be deliberately tampering with residue file.");
return;
}

_adminLog.Add(Type, LogImpact.High, $"{args.SenderSession.Name} provided userid of {sus.Username}, possible alt.");
_chat.SendAdminAlert($"{args.SenderSession.Name} provided userid of {sus.Username}, possible alt.");
}
}
Empty file.
25 changes: 25 additions & 0 deletions Content.Anticheat.Client/Content.Anticheat.Client.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<OutputPath>..\..\bin\Content.Client\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RootNamespace>Content.Anticheat.Client</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Content.Shared\Content.Shared.csproj" />
<ProjectReference Include="..\..\RobustToolbox\Robust.Client\Robust.Client.csproj" />
<ProjectReference Include="..\..\RobustToolbox\Robust.Shared\Robust.Shared.csproj" />
<ProjectReference Include="..\Content.Anticheat.Shared\Content.Anticheat.Shared.csproj" />
<ProjectReference Include="..\Content.Anticheat.Shared\Content.Anticheat.Shared.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Remove="Systems\JoinDataSystem.cs" />
</ItemGroup>

<Import Project="..\..\RobustToolbox\MSBuild\Robust.Properties.targets" />
</Project>
20 changes: 20 additions & 0 deletions Content.Anticheat.Client/EntryPoint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
// ***

using Robust.Shared.ContentPack;
using Robust.Shared.IoC;

namespace Content.Anticheat.Client;

public sealed class EntryPoint : GameClient
{
public override void PreInit()
{
base.PreInit();

IoCManager.BuildGraph();
}
}
Loading
Loading