winstxnhdw / lc-hax

A powerful, feature-rich and highly performant internal cheat for the co-op indie horror video game, Lethal Company.
78 stars 25 forks source link

[Bug]: Anti kick module always loaded even if i exclude it in loader.cs #220

Closed cmmaio closed 5 months ago

cmmaio commented 5 months ago

What happened?

some modded lobbies wont let you join if antikick module is injected even if its off excluding it in loader.cs file only turns it off but it still gets injected ingame

Current Commit Hash

b01dfa188f9f90beb98893cd45587ad3cd4e8b0c

Injector

If you selected "Others" above, please specify the injector you are using.

No response

Log output

No response

Acknowledgement

winstxnhdw commented 5 months ago

Can we confirm whether it is actually the AntiKick patch? Try deleting this file and see if it still blocks you https://github.com/winstxnhdw/lc-hax/blob/main/lc-hax/Scripts/Patches/AntiKickPatch.cs.

tslpy1 commented 5 months ago

Can we confirm whether it is actually the AntiKick patch? Try deleting this file and see if it still blocks you https://github.com/winstxnhdw/lc-hax/blob/main/lc-hax/Scripts/Patches/AntiKickPatch.cs.

After enabling anti-kick, it seems that rooms with mods like kick mod installed can still kick us out.

winstxnhdw commented 5 months ago

Do you know which mod it is?

tslpy1 commented 5 months ago

Do you know which mod it is?

I can find several related mods, but I'm not sure which one it is.

https://thunderstore.io/c/lethal-company/p/gamendegamer/Lethal_Admin/source/ https://thunderstore.io/c/lethal-company/p/TeamTinyAdmin/Lethal_Company_Tiny_Admin/source/ https://thunderstore.io/c/lethal-company/p/LostAdmiration/ModerationMenu/source/

winstxnhdw commented 5 months ago

It's weird that they can kick you considering our names shouldn't even appear on their menu..

tslpy1 commented 5 months ago

It's weird that they can kick you considering our names shouldn't even appear on their menu..

Based on listening to their voice, they can kick us out even if our names are displayed as "Unknown" or "Nameless" or if we imitate other people's names.

They seem to be able to see our names through the mod.

winstxnhdw commented 5 months ago

Hmm..

I am wondering if we can just patch out this entire section and then spoof our Steam ID. What do you think @armorfid?

if (!GameNetworkManager.Instance.disableSteam && GameNetworkManager.Instance.currentLobby != null)
{
    if (!GameNetworkManager.Instance.steamIdsInLobby.Contains(newPlayerSteamId))
    {
        NetworkManager.Singleton.DisconnectClient(this.actualClientId);
        return;
    }
    if (StartOfRound.Instance.KickedClientIds.Contains(newPlayerSteamId))
    {
        NetworkManager.Singleton.DisconnectClient(this.actualClientId);
        return;
    }
}
winstxnhdw commented 5 months ago

I don't even have to do that. Just patch out DisconnectClient instead..

winstxnhdw commented 5 months ago

I managed to spoof my Steam ID, yes I become unkickable but the game becomes basically unplayable. You play as the host's body, and you can no longer see the host. Your original character just stands still for the rest of the match. When the round is over, your ship never leaves. When the host disconnects, you still stay in the game.

cmmaio commented 5 months ago

Can we confirm whether it is actually the AntiKick patch? Try deleting this file and see if it still blocks you https://github.com/winstxnhdw/lc-hax/blob/main/lc-hax/Scripts/Patches/AntiKickPatch.cs.

deleted the cs files from patches and modules and disabled it from Loader.cs rebuilt it but still see the Anti Kick: Off in the lobby and prevents me from joining

armorfid commented 5 months ago

I am wondering if we can just patch out this entire section

That chunk of code is server-side, it won't do anything if you patch it client-side, same with DisconnectClient

To be confirmed, but I think the anti-kick only actually works if you were the last player to join the lobby. All it does is prevent the game from putting you in the Esc menu player list as long as nobody joins after you, since AddUserToPlayerList is called from SendNewPlayerValuesClientRpc. If someone else joins, they will invoke the RPC and the whole player list will refresh. You will probably start showing up on there and can now get kicked.

The mods @tslpy1 mentioned will kick players directly using their Unity client ID from allPlayerScripts even if they don't show up in the Esc menu.

deleted the cs files from patches and modules and disabled it from Loader.cs rebuilt it but still see the Anti Kick: Off in the lobby and prevents me from joining

What's the error message? Is it "An error occurred", or something else?

winstxnhdw commented 5 months ago

deleted the cs files from patches and modules and disabled it from Loader.cs rebuilt it but still see the Anti Kick: Off in the lobby and prevents me from joining

The Anti Kick Off label you see actually has nothing to do with the Anti Kick patch so it's not Anti Kick that is blocking you from joining. It's something else.