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

[BUG]: Privacy Cleanup/Clear (Reset) Network Data Usage is trying to delete *.dll files in Windows directory #265

Closed
selivan opened this issue Oct 3, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@selivan
Copy link

selivan commented Oct 3, 2023

Description

Privacy Cleanup/Clear (Reset) Network Data Usage is trying to delete *.dll files in Windows directory

OS

Windows 11 22H2 build 22621.2361
privacy.sexy — v0.12.4

Reproduction steps

  • select [x] Privacy Cleanup/Clear (Reset) Network Data Usage
  • press "Run"
  • see errors in the cmd window

Scripts

@echo off
:: https://privacy.sexy — v0.12.4 — Tue, 03 Oct 2023 15:55:39 GMT
:: Ensure admin privileges
fltmc >nul 2>&1 || (
    echo Administrator privileges are required.
    PowerShell Start -Verb RunAs '%0' 2> nul || (
        echo Right-click on the script and select "Run as administrator".
        pause & exit 1
    )
    exit 0
)


:: ----------------------------------------------------------
:: -------------Clear (Reset) Network Data Usage-------------
:: ----------------------------------------------------------
echo --- Clear (Reset) Network Data Usage
setlocal EnableDelayedExpansion 
    SET /A dps_service_running=0
    SC queryex "DPS"|Find "STATE"|Find /v "RUNNING">Nul||(
        SET /A dps_service_running=1
        net stop DPS
    )
    del /F /S /Q /A "%windir%\System32\sru*"
    IF !dps_service_running! == 1 (
        net start DPS
    )
endlocal
:: ----------------------------------------------------------


pause
exit /b 0

Screenshots

Additional information

C:\WINDOWS\System32\srumapi.dll
Access is denied.
C:\WINDOWS\System32\srumsvc.dll
Access is denied.
C:\WINDOWS\System32\en-US\srumapi.dll.mui
Access is denied.
C:\WINDOWS\System32\en-US\srumsvc.dll.mui
Access is denied.
C:\WINDOWS\System32\migwiz\replacementmanifests\srumon-replacement.man
Access is denied.
@selivan selivan added the bug Something isn't working label Oct 3, 2023
@undergroundwires
Copy link
Owner

Thank you. This is unintended and bad. This will be fixed in next minor version. I guess the intention was to delete %windir%\System32\sru\* folder (according to linked article in the script). I will do some more research on this and make this script as secure and robust possible.

@undergroundwires
Copy link
Owner

undergroundwires commented Oct 4, 2023

I've done research on this. It seems like we do not need to delete any other file but C:\System32\sru\SRUDB.dat which is the SRUM database file 1 2 3.

I will do following changes:

  • Change the script to delete only SRUDB.dat file, nothing more.
  • Handle explicitly and better if DPS service is missing.
  • Improve script to not attempt to start/stop the service if the file is missing.
  • Add more documentation.
  • Rename script to Clear System Resource Usage Monitor (SRUM) data for better clarity.
  • Migrate script from batchfile to PowerShell for better maintainability and readability.
  • Add user-friendly output messages to the script.

undergroundwires added a commit that referenced this issue Oct 8, 2023
Fix `Clear (Reset) Network Data Usage` trying to delete other files from
Windows system directory.

Changes:

- Precisely target the deletion of `C:\System32\sru\SRUDB.dat`.
- Improve documentation.
- Handle explicitly and better if `DPS` service is missing.
- Rename script from `Clear (Reset) Network Data Usage` to `Clear System
  Resource Usage Monitor (SRUM) data` for clearer representation.
- Migrate script from batchfile to PowerShell for better
  maintainability and readability.
- Add user-friendly output messages.
- Improve script logic to avoid unnecessary service start/stop when the
  file doesn't exist.
undergroundwires added a commit that referenced this issue Oct 8, 2023
Fix `Clear (Reset) Network Data Usage` trying to delete other files from
Windows system directory.

Changes:

- Precisely target the deletion of `C:\System32\sru\SRUDB.dat`.
- Improve documentation.
- Handle explicitly and better if `DPS` service is missing.
- Rename script from `Clear (Reset) Network Data Usage` to `Clear System
  Resource Usage Monitor (SRUM) data` for clearer representation.
- Migrate script from batchfile to PowerShell for better
  maintainability and readability.
- Add user-friendly output messages.
- Improve script logic to avoid unnecessary service start/stop when the
  file doesn't exist.
@undergroundwires
Copy link
Owner

The fix is released in 0.12.5 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants