There is a way to enable/disable google chrome extension with a command line ?
I would like enabled un extension already installed by terminal.
Launch Chrome with extension parameter may help you.
Example:
launch chrome with cmd
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -no-first-run --load-extension="extension path"
Here's an architecture example for what wOxxOm proposed in comments:
An extension can enable/disable other extensions with chrome.management API and "management" permission.
An extension can spawn a companion daemon process that communicates with the rest of OS using Native Messaging's chrome.runtime.connectNative().
Said daemon can create a named pipe that you can write to from the command line, and pass whatever commands are sent to the pipe to the extension using the Native Messaging protocol.
Note that Chrome cannot be contacted from "outside" directly: it must spawn a process on its own, and then you can communicate with the process.
Alternatively (if you don't want to use the Native Messaging protocol, or want the daemon to exist independent of Chrome), your daemon can open a local WebSockets server and your extension can communicate through that. However, it would be possible to impersonate your extension in that case.
Related
I have a chrome extension that communicates with a native messaging host to get some data.
The issue is, when I launch the Chrome browser via the shortcut or via the pinned shortcut in the taskbar, the extension is not able to connect to the host. I always get the error:
Failed to start native messaging host.
However, if I launch the chrome.exe via command prompt, everything works fine.
Things I tried with no success:
The taskbar shortcut has no extra flags. The target field has the
following value: "C:\Program Files(x86)\Google\Chrome\Application\chrome.exe"
I tried with the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Google\Chrome\NativeMessagingHosts\com.company.extension
I tried with the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts\com.company.extension
I tried with the registry entry under
HKEY_CURRENT_USER\Software\Google\Chrome\NativeMessagingHosts\com.company.extension
Tried launching the chrome.exe as administrator from the file explorer.
Update:
I added the flag --enable-logging --v=1 to the shortcut to enable logging and when I launch it I get the following output in the console:
[11036:4160:0302/113902.866:ERROR:native_process_launcher_win.cc(140)] COMSPEC is not set
[11036:11856:0302/113902.882:ERROR:native_process_launcher_win.cc(140)] COMSPEC is not set
Update
Upon investigating the chrome.exe process via Process Monitor, I found that there is no COMSPEC environment variable available to it when it is spawned via explorer.
Is there anything else that I can try or something that I am missing here?
As mentioned in the log, Chrome stumbles to start an external process, since COMSPEC, an environment variable pointing normally to cmd, is unset:
[11036:4160:0302/113902.866:ERROR:native_process_launcher_win.cc(140)] COMSPEC is not set
The behavior is different for launching Chrome from cmd itself, since it sets the variable for itself (ans spawned processes).
This can be confirmed by inspecting the Chrome process with Process Explorer.
One can run rundll32 sysdm.cpl,EditEnvironmentVariables as admin (e.g. from admin command line) to open the environment variable settings.
Alternatively, the dialog can be navigated to from Control Panel > System and Security > System > Advanced system settings > Advanced > Environment Variables...
ComSpec is usually set in System variables to
C:\WINDOWS\system32\cmd.exe
Adjust as necessary for your system install. For this setting to apply, you need to log out and log back in, or better yet restart the system.
How do I disable Google Chrome extension autoupdate?
Solutions I've found for this:
1. Disabling a concrete extension update
That's what I wanted!
You can do this by editing the extension's manifest.json file:
On Windows: C:\Users\<USERNAME>\AppData\Local\Google\Chrome\User Data\Default\Extensions\<EXTENSION-ID>\<VERSION>\manifest.json (find out the extension's ID by enabling Developer Mode in the extension settings page)
On MacOS: Open /Users/USERNAME/Library/Application Support/Google/Chrome/Default/Extensions/EXTENSION-ID/VERSION/manifest.json in a text editor.
On Ubuntu for Chromium: ${HOME}/.config/chromium/Default/Preferences
In this file, set the "update_url" property to something invalid like "https://localhost" for example. For the given url, it makes auto-updating that extension as simply impossible.
Source: https://productforums.google.com/d/msg/chrome/l3zOZeO-5-M/Y7VaR0KCWNIJ
2. Disabling all Google Chrome extension updates
For any OS: Just type chrome://plugins/ at address bar and turn Google Update plugin off. Source: How to disable Google Chrome auto update?
For Windows OS: Set Registry values:
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Update]
"AutoUpdateCheckPeriodMinutes"=dword:00000000
"UpdateDefault"=dword:00000000
Source: Making Google Chrome leave itself alone
If the chrome extension is on Github (which many if not most of them are), you can simply:
(1.) clone the Github repo,
(2.) reset the head to the version that you want, and
(3.) enable Developer Mode at chrome://extensions/
(4.) select the "Load unpacked" option from chrome://extensions/, and then select the folder enclosing the source code for the extension.
I recently used this technique to downgrade my version of Reddit Link Opener, which no longer supports users who have opted out of using that site's redesign. This worked for me on MacOS, but should work on all platforms.
If the extension is loaded as an unpacked extension (in the manner described above), it will NOT auto-update to a newer version.
Disabling update for a specific extension:
This can be achieved with the system policies, (more details here)
For Linux :
Get the installed extensions list (IDs), this can be found with ls -l ~/.config/google-chrome/Default/Extensions or chrome://extensions
Create the necessary directory if not present mkdir -p /etc/opt/chrome/policies/managed (with root)
Create the needed file policies file touch /etc/opt/chrome/policies/managed/google-chrome.json
Edit that file with the code bellow
open the page chrome://policy/ and reload the policies
{
"ExtensionSettings": {
"ghijklmnopabcdefghijklmnopabcdef": {
"update_url": "https://127.0.0.1/update_url",
"override_update_url": true
},
"YOUR-EXTENSION-ID-LIKE-THE-PREVIOUS-EXAMPLE": {
"update_url": "https://127.0.0.1/update_url",
"override_update_url": true
}
}
}
Note: this can not be applied widely to all extensions in a single rule and also for each newly installed extension the file need to be updated
Hi all those solitions for me have one disadvantage is that all extensions have no updates, I needed to stop only for one extension in this case and wanted al the other to keep making updates.
I think I found the solutuion for windows
Go to
C:\Users\YOUR_NAME_HERE\AppData\Local\Google\Chrome\User Data\Default\Extensions\YOUR_FOLDER APP HERE\
In that folder app click in properties and select read only an aplly that to all subfolders and files... for now for me solved the problem !!!
Regards xichas
this is a complementary answer to the accepted one https://stackoverflow.com/a/27657703/1422630 , allowing disable all at once on chromium
this is also only for linux (may be run on windows thru cygwin tho, not tested..)
this script will
backup the prefs file,
modify it,
if didnt succeed will output "FAILED"
show the differences using meld if installed
#!/bin/bash
set -ue
strPref="$HOME/.config/chromium/Default/Preferences"
cat "$strPref" |egrep "\"update_url[^,]*," -o |sort -u
read -p "existing unique urls above..." -n 1
strBkp="${strPref}.`date +"%Y%m%d%H%M%S"`.bkp"
if cp -v "$strPref" "$strBkp";then
strUpdUrl="clients2.google.com/service/update2/crx" #change this if needed #TODO should match any URL...
sed -i -r "s#(update_url\":\"https{,1}://)(${strUpdUrl})#\1127.0.0.1#g" "$strPref"
if grep "$strUpdUrl" "$strPref";then echo FAILED >&2;exit 1;fi
cmdDiff=colordiff
if which meld;then cmdDiff=meld;fi
#$cmdDiff <(cat "$strPref" |egrep "\"update_url[^,]*," -o) <(cat "$strBkp" |egrep "\"update_url[^,]*," -o)
$cmdDiff <(cat "$strPref" |sed -r 's#","#",\n"#g') <(cat "$strBkp" |sed -r 's#","#",\n"#g')
fi
tested on chromium: Version 63.0.3239.84 (Official Build) Built on Ubuntu , running on Ubuntu 16.04 (64-bit)
obs.: that script also works for google-chrome, just change the preferences file path
After updating Google Chrome to v60, no solution found on the Internet has helped me
So i just blocked IP addresses, used for updating, by doing following steps:
Opened Chrome with blank browser tab
Waited, until extension
autoupdate begins, by looking on to network tab in Resource
Monitor
Wrote out all the IP addresses with high download rate. My IP address list was:
64.233.161.94
64.233.161.102
64.233.163.95
74.125.238.132
108.177.14.138
173.194.73.132
173.194.222.102
216.58.209.110
216.58.209.97
173.194.222.99
173.194.32.227
173.194.113.172
173.194.32.224
195.216.237.77
74.125.232.170
143.215.130.61
74.125.238.147
173.194.122.137
173.194.44.66
173.194.44.67
173.194.44.95
173.194.122.136
74.125.232.183
74.125.232.171
Created outbound rule for chrome.exe in Windows Firewall and added listed IP addresses to blocklist
After I enabled this rule, chrome was unable to update my extensions.
Just (re)install the extension via Load unpacked.
Let's suppose "Roboform Password Manager" extension version 8.6.5.5 dropped some important functionality, so you want to keep version 8.6.2.2 installed.
Go to chrome://extensions/
Enable Developer mode
Get the required version of the plugin:
If Chrome still got the version you need:
Utilize Pack extension button on the plugin details page.
Just copy the extension folder, e.g. C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default\Extensions\pnlccmojcmeohlpggmfnbbiapkmbliob. The extension id is visible in the url bar, on the plugin details page, e.g. chrome://extensions/?id=pnlccmojcmeohlpggmfnbbiapkmbliob.
If the version you need was overwritten already:
Get appropriate ".crx" from some extensions archive
Look for ".crx" in "C:\Program Files\..." (applications/installers sometimes bundle original ".crx" versions, unaffected by any updates)
Unzip (e.g. with 7-zip) your ".crx" (or paste the extension folder contents) to a non-temporary folder - you would have to keep those files in place until you uninstall the extension.
Click Load unpacked, select that folder.
If you just drag&drop the ".crx" file, Chrome extension details would show Source=Chrome Web Store, and it would get updated as soon as you click Update extensions now. But for an unpacked extension, you get a special "Unpacked extension" overlay icon, Source=Unpacked extension and it won't get updated.
Just tested on Chrome 79.0.3945.88 (64-bit), Windows.
Now, Chrome shows "Disable developer mode extensions" popup on each startup. Personally, I just manually dismiss them each time. I do not re-start Chrome too often.
I am building a kiosk application using webrtc video. It is only served on the internal network and I would like to be able to always allow the webcam for my site over http. Using ssl isn't that important and is just an extra expense for a cert.
Is there any way to do this or am I stuck?
Yes, an admin can override the prompts with a policy.
VideoCaptureAllowedUrls
Patterns in this list will be matched against the security origin of the requesting URL. If a match is found, access to audio capture devices will be granted without prompt. NOTE: This policy is currently only supported when running in Kiosk mode.
On Windows, you create registry entries using regedit.
Software\Policies\Chromium\VideoCaptureAllowedUrls\1 = "http://www.example.com/"
Software\Policies\Chromium\VideoCaptureAllowedUrls\2 = "http://[*.]example.edu/"
On Linux you write the policies in a file:
mkdir -p /etc/opt/chrome/policies/managed
touch /etc/opt/chrome/policies/managed/test_policy.json
In test_policy.json:
{
"VideoCaptureAllowedUrls": ["http://www.example.com/", "http://[*.]example.edu/"]
}
Use command-line flag
use --use-fake-ui-for-media-stream command-line flag
example (OS X) : /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome http://html5-demos.appspot.com/static/getusermedia/record-user-webm.html --use-fake-ui-for-media-stream
More info here http://creativcoders.wordpress.com/2014/08/18/chrome-always-allow-access-to-webcam-and-microphone-over-http-webrtc/
More detailed solution.
In command line, target your browser and add after your instruction the --use-fake-ui-for-media-stream flag, like this:
//On windows
#Normal mode
start chrome "http://localhost" --use-fake-ui-for-media-stream
#Kiosk mode (full screen)
start chrome --kiosk "http://localhost" --use-fake-ui-for-media-stream
For Linux and Mac command line instructions, see this: https://creativcoders.wordpress.com/2014/08/18/chrome-always-allow-access-to-webcam-and-microphone-over-http-webrtc/
Right-click the webcam capturer
If you already allow just tick "remember"
I've written an extension for Google Chrome that will be released with the next version of our product. I want to understand what properties, paths for extraction, registry entries, etc. should I provide the installer of my product so that the end user doesn't have to install the extension on their own manually, and the installer does the complete job of installing the extension, and also notifies the user that the extension has been installed. As of now, the code that I have written is placed in a folder, and I use the "Load Unpackaged Extension" to load the extension. What should I do to achieve the aforementioned task?
Google's current policy on installing extensions via the registry (for Windows machines) is this:
Only extensions from the Google Extension Gallery (or Chrome Web Store - CWS) can be installed via the registry.
See this link - https://developer.chrome.com/extensions/external_extensions - for information on how this can be done. Keep in mind the following:
-This technique will still pop-up a msgbox to the user. its not completely silent.
-When using this technique, if the user subsequently removes the extension from her Chrome, the extension gets "blacklisted" on that chrome and will not re-auto-install until the user re-install it
manually. refer to Auto-installing a google chrome extension won't work ! for details.
Chrome has a couple ways of installing extensions programmatically:
http://www.chromium.org/administrators/pre-installed-extensions
Edit: yes, this policy has changed by now, as FuzzyAmi points out.
If you're using GNU/Linux, this is how you pre-install an extension from the chrome web store for all users:
/etc/chromium/policies/managed/yourextension_policy.json
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
{
"ExtensionInstallForcelist": [
"yourextensionuniqueidentifiersup;https://clients2.google.com/service/update2/crx",
"yourextensionuniqueidentifiersup"
]
}
Reference
metamask-chrome - AUR
As the title suggests, I want to write a shell command to open google chrome portable (with supplied parameter) which is installed on the flash drive also. I am trying to do it as follows:
open "/Volumes/NDCS/chrome/chromium.app/Contents/MacOS/Portable Chromium" --allow-file-access-from-files
Portable Chrome opens up, but the setting hasn't worked. I also wanted it to launch a default homepage (parameter is --homepage="[url or file path]", but for now have done that by setting the default homepage in the browser.
If anyone has any knowledge/advice on this, would be much appreciated. I have done the same scenario on PC recently, just struggling with the Mac deployment.
From man open you need to supply thr parameters to the executable using the --args argument, otherwise they are taken as arguments to open not the app.
Also Open works on the App bundle
So
open "/Volumes/NDCS/chrome/chromium.app" --args --allow-file-access-from-files
oruse the plain unix executable as you are doinf without the open
"/Volumes/NDCS/chrome/chromium.app/Contents/MacOS/Portable Chromium" --allow-file-access-from-files