Skip to content

Commit

Permalink
Better Readme and added customPath argument #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Ceiridge committed Jan 27, 2020
1 parent de00dce commit 2bca7b3
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 6 deletions.
36 changes: 35 additions & 1 deletion ChromeDevExtWarningPatcher/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;

// Ugly and uncommented code ahead
namespace ChromeDevExtWarningPatcher
{
class Program
{
private const string CHROME_INSTALLATION_FOLDER = @"C:\Program Files (x86)\Google\Chrome\Application";
private static string CHROME_INSTALLATION_FOLDER = @"C:\Program Files (x86)\Google\Chrome\Application";

private static readonly byte[] SHOULDINCLUDEEXTENSION_FUNCTION_PATTERN = { 0x56, 0x48, 0x83, 0xEC, 0x20, 0x48, 0x89, 0xD6, 0x48, 0x89, 0xD1, 0xE8, 0xFF, 0xFF, 0xFF, 0xFF, 0x89, 0xC1 }; // 0xFF is ?
private static readonly byte[] MAYBEADDINFOBAR_FUNCTION_PATTERN = { 0x41, 0x57, 0x41, 0x56, 0x56, 0x57, 0x53, 0x48, 0x81, 0xEC, 0xFF, 0xFF, 0xFF, 0xFF, 0x48, 0x89, 0xCE, 0x48, 0x8B, 0x05, 0xFF, 0xFF, 0xFF, 0xFF, 0x48, 0x31, 0xE0, 0x48, 0x89, 0x84, 0x24, 0xFF, 0xFF, 0xFF, 0xFF, 0x48, 0x8D, 0x4A, 0x08 }; // 0xFF is ?; debugPatch
Expand All @@ -32,6 +34,7 @@ public static void Main(string[] args)
RemovePatches(SHOULDPREVENTELISION_FUNCTION_PATTERN);
if (ContainsArg(args, "noDebugPatch"))
RemovePatches(MAYBEADDINFOBAR_FUNCTION_PATTERN);
SetNewFolder(args);

DirectoryInfo chromeFolder = new DirectoryInfo(CHROME_INSTALLATION_FOLDER);

Expand Down Expand Up @@ -153,5 +156,36 @@ private static void RemovePatches(byte[] pattern)
i++;
}
}

private const string PATH_REGEX = @"\\([a-zA-Z]{4,})";
private static void SetNewFolder(string[] args) {
StringBuilder sb = new StringBuilder();

for (int i = 0; i < args.Length; i++) {
sb.Append(args[i] + " ");
}
if(sb.Length > 0)
sb.Remove(sb.Length - 1, 1);
string fullArgs = sb.ToString().ToLower();

string arg = "-custompath ";
int pathIndex = fullArgs.IndexOf(arg);
if(pathIndex != -1) {
pathIndex += arg.Length;
fullArgs = fullArgs.Substring(pathIndex).Replace("\"", "");

var regMatches = Regex.Matches(fullArgs, PATH_REGEX);
if (regMatches.Count == 0) {
Console.WriteLine("Invalid path given");
Environment.Exit(1);
return;
}
Match regMatch = regMatches[regMatches.Count - 1];
string regMatchGroup = regMatch.Groups[0].Value;

CHROME_INSTALLATION_FOLDER = fullArgs.Substring(0, regMatch.Index + regMatchGroup.Length);
Console.WriteLine("New installation folder set: " + CHROME_INSTALLATION_FOLDER);
}
}
}
}
40 changes: 35 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,54 @@
# Disable Chrome's Developer Mode Extension Warning Popup
Download it in the [release section](https://github.com/Ceiridge/Chrome-Developer-Mode-Extension-Warning-Patcher/releases).
# Disable Chrome's and Chromium's Developer Mode Extension Warning Popup
**Download** it in the [release section](https://github.com/Ceiridge/Chrome-Developer-Mode-Extension-Warning-Patcher/releases).

## Supported browsers
See below for the custom paths (commandline option).
```javascript
- All Chromium-based browsers, including:
- Chrome
- Chromium
- Brave
- New Edge
- Opera?
- Vivaldi
- Blisk
- Colibri
- Epic Browser
- Iron Browser
- Ungoogled Chromium?
```
## Message to Chromium contributors
This project is not meant for malicious use, especially because patching requires administrative rights. If an attacker wants to get rid of that notification, they will always be able to do it somehow, since it clientsided. Additionally, you can just install a crx-file and allow it with some group policies, which makes absolutely no sense, because it punishes developers with this annoying popup, but crx files that are already packed can be installed easily.
The idea originates from that one stackoverflow patching method, which forces a command line option in the `chrome.dll`.
## How the program works
It discovers your `chrome.dll` file of the latest installed Chrome version. Then it performs a pattern scan for a function that gets patched, so the dialog does not appear anymore.
It discovers your `chrome.dll` file of the latest installed Chrome/Chromium version. Then it performs a pattern scan for a function that gets patched, so the dialog does not appear anymore.
## Commandline Options
All commandline options are **optional** and not required.
```bash
ChromeDevExtWarningPatcher.exe [-noDebugPatch] [-noWWWPatch] [-noWarningPatch] [-noWait]
ChromeDevExtWarningPatcher.exe [-noDebugPatch] [-noWWWPatch] [-noWarningPatch] [-noWait] [-customPath "C:\Path"]

Explanation:
-noDebugPatch: Disables the patch for the warning of debugging extensions (chrome.debugger)
-noWWWPatch: Disables the patch for re-adding the `https` or `www` in a url, because it matters!
-noWarningPatch: Disables the patch for the warning of developer extensions

-noWait: Disables the almost-pointless wait after finishing

-customPath: Tell the patcher to use another patch to find the chrome.dll file, see below.
```

**Recommended `customPath`s:**
```java
Chrome (default): C:\Program Files (x86)\Google\Chrome\Application
Brave: C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application

Remember: The path always needs to include the version folders of the browser.
Please create a new issue with a path, if you want to contribute to this list.
```

## What is the pattern and what does it patch
Expand Down Expand Up @@ -109,4 +139,4 @@ bool ChromeLocationBarModelDelegate::ShouldPreventElision() const {
```

## How and when to run it
Run it after every chrome update with administrator rights.
Run it after every chrome/chromium update with administrator rights.

0 comments on commit 2bca7b3

Please sign in to comment.