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

feat/fix: Defender whitelist script, stunclick bug, ESP bugs #172

Merged
merged 8 commits into from
Jan 5, 2024

Conversation

armorfid
Copy link
Contributor

@armorfid armorfid commented Jan 4, 2024

No description provided.

there were tons of NullReferenceException and IndexOutOfRangeException in the BepInEx console after end of round
@armorfid
Copy link
Contributor Author

armorfid commented Jan 4, 2024

Side-note, the ESP seems to interfere with ReservedItemSlot mods when joining, not idea why

I'm not 100% sure lc-hax is the problem, but those mods started getting unreliable around the time the ESP was added, further investigation needed

Comment on lines 1 to 22
@echo off
echo Windows Defender hates SharpMonoInjector, attempting to whitelist...

net session >nul 2>&1
if %errorlevel% neq 0 (
echo ERROR: This script must run as administrator.
pause
exit /b -1
)

for %%p in ("%~dp0" "%TEMP%\.net\SharpMonoInjector") do (
powershell -ExecutionPolicy Bypass -Command "Add-MpPreference -ExclusionPath "%%p"" || goto :failed
)

echo Success!
pause
exit /b 0

:failed
echo ERROR: Failed to whitelist.
pause
exit /b 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am terribly worried about adding this.. I think we should make this an opt-in conscious decision someone has to make and add this to docs instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it is technically opt-in, I didn't add it to the other bat files or anything. It's just a standalone script for whoever needs it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but the average user is going to press on that blindly. I'll shift it over to the docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having the bat directly in there is very convenient, otherwise Defender starts spewing plenty of blatantly false positives about SharpMonoInjector being a dozen different viruses

Copy link
Contributor Author

@armorfid armorfid Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, if you click "Allow threat" in Windows Defender, it will actually add the virus signature to the exclusions, instead of just that particular file path... So a real virus of that type could infect just fine... I'm having trouble believing Microsoft devs are that much brain-dead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved the script to submodules folder and mentioned in readme, should do the trick

lc-hax/Scripts/Helpers/FindNonNullObjectsOfType.cs Outdated Show resolved Hide resolved
lc-hax/Scripts/Modules/ESPMod.cs Show resolved Hide resolved
lc-hax/Scripts/Modules/ESPMod.cs Outdated Show resolved Hide resolved
@winstxnhdw
Copy link
Owner

Side-note, the ESP seems to interfere with ReservedItemSlot mods when joining, not idea why

I'm not 100% sure lc-hax is the problem, but those mods started getting unreliable around the time the ESP was added, further investigation needed

I think it's more likely that a patch is breaking the mods, since 99% of mods just use patches and our patches might be causing some race conditions.

@armorfid
Copy link
Contributor Author

armorfid commented Jan 5, 2024

I think it's more likely that a patch is breaking the mods, since 99% of mods just use patches and our patches might be causing some race conditions.

looks like reserved item mods are bugged even when not running lc-hax, so nevermind I guess

I dug a bit, the bug happens with ReservedItemSlotCore v1.7.2+ released last weekend, the dev added some server-client syncing code, but didn't add a syncing timeout in case the host doesn't have the mod, so the client never initializes... reverted to v1.7.1 and it's fine now, although that version has other bugs

@winstxnhdw winstxnhdw mentioned this pull request Jan 5, 2024
4 tasks
@winstxnhdw
Copy link
Owner

Honestly, I still don't think we should put that script in yet. It's really about the message we are giving to users. I want them to strongly, and consciously make the decision to exclude the injector from their AVs.

@winstxnhdw
Copy link
Owner

Thank you again for the great work!

@winstxnhdw winstxnhdw merged commit d975edd into winstxnhdw:main Jan 5, 2024
2 checks passed
@armorfid
Copy link
Contributor Author

armorfid commented Jan 5, 2024

Honestly, I still don't think we should put that script in yet. It's really about the message we are giving to users. I want them to strongly, and consciously make the decision to exclude the injector from their AVs.

In order to run the batch script, one would have to open the submodules folder, right-click the file, run as administrator, and accept the UAC dialog. That's a very conscious decision in my book... Also, the command you provided won't work unless they explicitly open PowerShell as admin and cd into the lc-hax folder. Something like this would probably be more obvious:

Set-MpPreference -ExclusionPath "PUT_THE_PATH_TO_LC_HAX_FOLDER_HERE"
Set-MpPreference -ExclusionPath "$env:TEMP\.net\SharpMonoInjector"

Although, from experience, asking the average user to modify a command line before usage is sometimes asking too much of them 😆

@winstxnhdw
Copy link
Owner

winstxnhdw commented Jan 5, 2024

If they don't have the mind to do it, then it's probably best they don't do anything.

@armorfid
Copy link
Contributor Author

armorfid commented Jan 5, 2024

lol maybe you're right, I guess I'm too used to people yelling at me if I don't hold their hands... I do think the readme could still benefit from having a mention about cd'ing into the lc-hax folder before using the command.

@winstxnhdw
Copy link
Owner

For sure, I'll add it tomorrow

@armorfid
Copy link
Contributor Author

armorfid commented Jan 6, 2024

also $MyInvocation doesn't exist outside a script, this is the proper command:

Add-MpPreference -ExclusionPath $pwd, "$env:TEMP\.net\SharpMonoInjector"

using Set-MpPreference overwrote all my previous exclusions.........

@winstxnhdw
Copy link
Owner

Oops, good catch. Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants