Giter Club home page Giter Club logo

cleanunwantedupdates's Introduction

CleanUnwantedUpdates.wsf

Initially started as fork of BlockWindows it was lately transformed into own solution.

This solution is a set of scripts to detect updates of Microsoft™ Windows™ OS which harm users’ privacy and uninstall them. It can be used as a submodule of BlockWindows.

End User License Agreement

  1. IN NO EVENT AND UNDER NO LEGAL THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL ANY CONTRIBUTOR BE LIABLE TO YOU FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING AS A RESULT OF THIS AGREEMENT OR OUT OF THE USE OR INABILITY TO USE THE WORK (INCLUDING BUT NOT LIMITED TO DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES) OR OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE, EVEN IF SUCH CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE WORK AND ASSUME ANY RISKS ASSOCIATED WITH YOUR EXERCISE OF PERMISSIONS UNDER THIS AGGREEMENT. YOU ALSO AUTHORIZE THE SOFTWARE TO ACCESS, MODIFY, DESTROY, CREATE AND TRANSFER INFORMATION STORED IN YOUR COMPUTER.

  2. Microsoft™, Windows™, Internet Explorer™, JScript™, ActiveX™ and Windows Update™ are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. JavaScript™ is either registered trademark or trademark of Oracle Corporation.

  3. This software uses some free (as in “freedom”) libraries by third parties. You can find them in lib subfolder. The license of each library is usually situated in the beginning of its file. To use this software you need to agree with them.

  4. Unwanted means that this kind of updates CAN be unwanted, but NOT that they ARE such. The trivial example is when you just want an update the tool considers unwanted; the tool has no telepathic and magic abilities to know whether the update is really unwanted by you, it uses only rough heuristics. Another example is the case when there is a problem in the tool causing uninstallation and/or hiding of WANTED update, for example update fixing a critical security vulnerability. There is always a risk that the tool will misclassify wanted update as unwanted (the inverse is also true), if you don’t accept this risk, please, don’t use the tool.

  5. The tool works noninteractively, all the control over the processing is made via configuration file (but you can try ^c to stop execution of them at your own risk). This means that the tool won’t ask you before uninstallation/hiding of updates, so there is a risk it can uninstall/hide the update you don’t want to be uninstalled/hidden without asking your permission to do so. You grant the tool such permission when you start using it. If you don’t, please, don’t use the tool.

  6. The tool uses Windows Script Host, which is a very old technology and based on IE6 JScript engine and ActiveX components. They have not been updated for a while and can contain critical security vulnerabilities. Though we have taken some mitigation measures like using pure JS implementations of a HTML parser instead of the ActiveX one, the risk of being hacked by remote attacker (for example the one who makes MiTM on your connection to MS site, or the one, who has hacked MS site) still persists, if you don’t accept the risk, please, don’t use the tool.

  7. This tool downloads webpages from Microsoft website in order to analyze them to detect whether the update is unwanted. Please don’t keep this option constantly enabled because I (and I’m sure most of yours too, because the MS site is the main source of information about updates, it’d be stupid to overload such a site) don’t want Microsoft’s site being overloaded. If you want to debug this tool, please use some caching proxy (like Fiddler with AutoResponder) (set proxy in util.js file in functions retrieveKB and retrievePage).

  8. At the moment there are problems in the tool: when given incorrect UTF-8 it behaves incorrectly and crashes with uncaught exception because of a trouble in WinHttpRequest. Use branch fixing-WinHttpRequest as a temporary solution. The abilities to detect unwanted updates are limited to the pages containing only valid Unicode. If you have any ideas how to bypass this issue, please, either create an PR or write the ideas to #1.

How-to use

Basic usage

To use it just launch its *.WSF file (CleanUnwantedUpdates.wsf) with cscript.exe from elevated command prompt. In fact you can launch it with wscript.exe (default doubleclick action in most of systems) and even not from elevated shell, in this case it will restart itself with the needed environment (elevated cscript.exe). The default configuration file (config.json) is suitable for the ones who want to quickly disable unwanted updates. The description and documentation of configuration file in JSON Schema format you can see in schemas folder (see config.schema.json file).

Advanced usage

Also you can allow the tool heuristically detect unwanted updates. To do this you need to enable heuristics.enable in configuration file. When heuristic is enabled, the tool cached heuristically detected files into configuration file to prevent their reevaluation and, allow you easily get their list and easily white/blacklist them.

WARNING: If you use it in non-english system, when offline is true, MS Update may provide localised strings for updates, which should cause false negatives. If you wanna use it offline, you should add localized keywords to the keywords.

To allow the tool download pages from MS site use heuristics.downloadKBPages. To show info about cached heuristically detected updates use heuristics.showPrevious. To make debugging faster use heuristics.debug which will cause info about updates being cached into into updates.json file and loaded from that cache.

Hacking

The folder structure is following

  • CleanUnwantedUpdates.wsf - A file with metainformation binding different files into the tool. You should launch it.
  • config.json - a configuration file. The documentation.
  • lib\ - is for libraries not written specially for this project, but needed for it.
  • src\ - code written specially for this project, but of course you can reuse it
    • CleanUnwantedUpdates.js - the main app file responsible for the tool main workflow and interface
    • utils.js - defines different functions and initializes objects without which nothing works.
    • PrepareEnvironment.js - responsible for environment preparation: folder detection, WSH environment detection, restarting the script in needed WSH environment with needed privileges
    • libMSUpdater.js - allow to mess with Microsoft Update from JavaScript without butthurt
    • libHTML2Text.js - converts HTML to text
    • detectors.js - contains detecting logic built upon the framework
    • Score.js - A framework class representing score. Call score.change(n) to increase score by n. When threshold exceeded the update is classified either as unwanted or as harmless or as unknown. The semantics is the responsibility of the programmer.
  • Checkers/ - contains the classes used to check whether the update is unwanted. The convention is following: the higher the score, the more signs of detection.
    • Checker.js - base class defining interface.
    • CheckersSet.js - A group of checkers. Checkers usually should be used inside of group.
    • IsUpdateListedChecker.js - Checks the presence of update in a list.
    • HasSubstringInPropertyChecker.js - Checks presence of values from the list in updates’ properties.
    • HasSubstringInPagesChecker.js - Checks presence of values from the list in updates KB page.
  • schemas/ - contains JSON Schema descriptions of different interfaces and configuration files. You should assume they are validated with respect to schemas.
    • config.schema.json - description and documentation of/on the configuration file format.

Thoughts, advices and warnings

  • WSH is an old technology, it does’t support even ECMAScript5 and it is very uncomfortable to debug. I’d be better if MS updated this, but it seems they won’t. I’ve googled a bit, and found some post about using Chakra engine, but to use it you it need it to be hosted on an app compiled for .net.
  • ActiveX is also a terrible and obsolete technology, use it very careful, especially with remote data.
  • You can easily add a new heuristic. To do this you need
  • Create a class extending Checker class. Constructor should initialize an instance, check should make check. When you make check, to report about the results of this check you need to modify the score. The Score class checks if the thresholds have been exceeded, and if they have it throws the exception, which is caught by CheckersSet class.
  • Create new instances, wrap them into CheckersSets.
  • Call CheckersSet.check and process the value returned.
  • Set debug in config.json to true to make the tool to cache the updates into updates.json, which will lower the latency of each tool launch. Use it only while debugging because it will use obsolete data.

cleanunwantedupdates's People

Contributors

kolanich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cleanunwantedupdates's Issues

WinHttpRequest throws "No mapping for the Unicode character exists in the target multi-byte code page".

Recently M$ changed something in their website, which made WinHttpRequest crash with error "No mapping for the Unicode character exists in the target multi-byte code page".
doesn't work.

whr = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
...
var oADO=new ActiveXObject("ADODB.Stream");
oADO.Type=1;
oADO.Mode=3;
oADO.Open();
oADO.Write(whr.ResponseBody);
oADO.Position=0;
oADO.Type=2;
oADO.Charset="x-ansi";
//oADO.Charset="utf-8";
res=oADO.ReadText();
oADO.Close();

doesn't work - it either throws error or puts in res few bytes from whole response body.
Another try

var isSuccessful=false;
whr.WaitForResponse(-1,isSuccessful);
res=whr.ResponseStream.Read();

throws an error that ResponseStream is either null or undefined.
I don't know how to use ResponseBody as an array, both tries to use it either as js array or as WSH collection have failed.

Unknown trust provider

I know that isn't really a CleanUnwantedUpdates issue, but still. I get the following error:
C:\Programs\CleanUnwantedUpdates-fixing-WinHttpRequest\CleanUnwantedUpdates.wsf( 152, 3) (null): Unknown trust provider.
CheckSUR and sfc /scannow detect no issues on the system.

Uninstall failure?

Every time I'm getting the same result:
`Getting list of updates...
230 updates found. Filtering ....
Updating config...
Detection results:
Following updates will be uninstalled:
{62c68477-0f45-46aa-8af8-d0c189d6dd8e} KB971033 | Update for Windows 7 for x64-based Systems (KB971033) [ http://go.microsoft.com/fwlink/?LinkId=161784
http://www.microsoft.com/genuine ]

Uninstalling...
Uninstallation failed:`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.