Prompted by "Google Chrome didn't shut down correctly.... " - google-chrome

Using Google Chrome 38.0.2125.111 m in a Windows 7 environment. It is launched by a batch file & set to go to a specific (internal) URL. The Windows environment is going to be locked down, permitting only a handful of options available to the user.
Chrome is being used because IE will be accessing a different site. Without going into boring detail, using both sites on a single browser allowed a user to access an account that wasn't theirs. Both browsers will be launched using one of two batch files. The Chrome batch file supplies the username & password to bypass a login screen on that application.
To keep from opening multiple windows in Chrome, the following batch file is used:
taskkill /f /t /im chrome.exe > NUL
ping -n 3 127.0.0.1 > NUL
START /max chrome "http://myinternalwebsite?uid=x&pwd=y"
Taskkill is used to close chrome (/f = force /t = terminates process & any child ones /im = image name).
If the Chrome session is closed (using the X at the upper right corner of the screen), the batch file works fine. However, if there is already a chrome instance running, we get the yellow bar with the frowning folder & a message saying:
Google Chrome didn't shut down correctly. To reopen the pages you had
open, click Restore.
I have tried several command line options when launching Google Chrome, but none will keep the message from displaying. Ones I have tried are:
--disable-restore-session-state
--disable-session-crashed-bubble
--incognito
among others. I've experimented with some of the settings in Chrome, but none have (yet) worked. The --incognito option works - sort of. It keeps blocking plugins, one of which is Silverlight - one of the chief components for the website to function. Even though it does get rid of the message, it leaves the site not functioning properly.
The intent on using Taskkill to flush any existing Chrome sessions was to prevent the user opening up a dozen different Chrome instances of the same thing.
Is there any way to keep a user from opening multiple instances of Chrome that won't leave Chrome thinking it didn't close properly? Given the user restrictions, I'm not sure that a script/batch file to edit the Preferences file in the Chrome folder will work. An extension may be an option, but a third party application will not be.
Would appreciate any thoughts or assistance.
Thanks!

Chromium writes exit status into Preferences file. When it starts it writes Preferences file with:
"exited_cleanly": false
and upon clean exit writes Preferences file with:
"exited_cleanly": true
To prevent message about unclean shut down make sure that you have "exited_cleanly": true written in your Preferences file
On my Linux kiosk running on Raspberry Pi this sed command line added to /etc/rc.local fixes issue permanently:
sed -i 's/exited_cleanly\":\ false/exited_cleanly\":\ true/g' /home/pi/.config/chromium/Default/Preferences

Related

SSLKEYLOGFILE environment variable doesn't populate any text file

My operating system is Windows 10 64 bits. I use the latest versions of Firefox and Chrome.
I want to save the pre-master keys in order to use them with WireShark.
For this, I have found many tutorials that all recommend using the SSLKEYLOGFILE environment variable.
However, no matter the path I put in this variable, no file is being created by Firefox (normal and developer editions) or Chrome. This is true even when I restart those browsers or the operating system. This is also true when I clear the cache on the browsers.
I found an alternative way of setting the SSLKEYLOGFILE variable with Chrome by launching the browser with the following argument:
--ssl-key-log-file=PATH
And while this argument does create a log file, it is never populated. It remains completely empty.
What makes this problem even more annoying is that I don't know if there's any debug log that would at least let me know what's happening.
Anyone have ideas on how to solve this issue?
Verified in both Chrome and Firefox
Windows 10 64bit [Version 10.0.17763.379]
I would not use the --ssl-key-log-file flag with Chrome. In my testing, it does not have an effect.
Steps to get SSL keylog file
Change your directory to one that you or your programs have access to. I am using the Desktop folder.
C:\> cd $HOME\Desktop
Set the SSLKEYLOGFILE variable. This sets it for the user (HKCU). To set it for the machine (HKLM), add the /m flag to the end of the command.
PS C:\Users\rj\Desktop> SetX SSLKEYLOGFILE "$(get-location)\ssl.log"
Verify that the variable has been set in a separate powershell window (SetX does not apply to the current window).
PS C:\Users\rj\Desktop> Get-ChildItem ENV: | findstr SSLKEYLOGFILE
SSLKEYLOGFILE C:\Users\rj\Desktop\ssl.log
You can also verify that SSLKEYLOGFILE is a user variable by going to the Control Panel > System and Security > System > Advanced System Settings > Advanced tab > Environment Variables > User Variables. You should see a listing like the powershell example where the value is a directory.
Open Chrome/Firefox and go to an https website like https://stackoverflow.com.
You should see an ssl.log show up on your desktop.
Image of end result
Further Reading
2018-12-07, F5, Decrypting SSL traffic: Great article on doing the above, but cross-platform
2019-03-18, Mozilla, NSS Key Log Format
: The SSLKEYLOGFILE format
2018-08-17, Wireshark Bugzilla, Add TLS 1.3 support: Has good test pcap/SSLKEYLOGFILE contents for TLS1.3 (See Comment 83)
You mentioned that you are using Wireshark. If you using it to export a file from a TLS-encrypted stream in a capture, this article may help you.
One thing I ran into is: Chrome doesn't always fully close when you close the window. Sometimes it stays open in the background. Use the Windows Process Explorer to list all the processes and make cure Chrome is closed. Also, after restarting Chrome, you can double click on it in Process Explorer and select the Environment tab to list all the variables set in it's environment. Make sure SSLKEYLOGFILE is shown in that list. Then Chrome will be sending keys to the specified file.
First off all the problem is that the browsers are protected better and that flaw is patched, thats why you cant capture no ssl. I dont know the details. But chrome with --no-sandbox(linux) option on ,when running will enable you to capture ssl/tls key without any issues from the first try, so you can play with decription of packets. Never tried on windows btw..
This worked for me...
set the SSKEYLOG env: variable as normal in Linux.
just point it to your pefererd save location of the sslkey.log
windows system/advance/env vars/user variables.
add SSLKEYLOGfile with the path to your preferred save location C:/user/sslkey.log
close and your done here.
NSS_ALLOW_SSLKEYLOG=1 is what's missing from the Booleans in Firefox's advanced options.
its been also removed from the general release but is still in the dev ops version. just not listed.
download and install the dev ops version of Firefox
open a terminal start it from its exe if on Linux.
windows just open it from the icon.
go to the about:config
create a new Boolean with NSS_ALLOW_SSLKEYLOG=1 and set it to true.
quit
now create a new symbolic/icon link to the new dev version fire fox version
when you run Firefox from the terminal in Linux the sskeylog should be created and start populating.
run it from the task bar icon in Linux and it doesn't make or update the keylog (just in case you dont want it populating every time you open the browser).
in windows, you will have to disable the env var or it will keep populating every time you open any browser that supports sslkey logging.
on that note opera and vivaldi should work with no changes to the advanced option.
lastly.. open wireshark go to
edit/preferences/protocols/tls
and put the path to the sslkey.log in the pre master secret log box.
click ok.
close everything..
start Wireshark
start your browser (from terminal in linux).
you should start seeing sslkeylog start populating and see extra options for decryption in the tabs of Wireshark.
have fun :)
1st solution:
Restart Chrome
2nd solution:
Use Firefox

Can't access internet through Google chrome

I can't access internet through my chrome browser,but can access net through all other browsers in the same system. Tried uninstalling and installing chrome but of no use...Is there any solution for this ?
this is the issue....
Since you have already uninstalled it let's start here:
Step 1: Enable the Hidden Files View.
To do that go to:
Start > Control Panel > Folder Options.
Click the View tab.
Click/Check the Show hidden files, folders, and drives option.
Uncheck the Hide protected operating system files option.
Press OK.
Step 2: Delete any Chrome or Google folders from your computer.
Navigate to the following locations and delete the Chrome folder(s). You can also choose to rename them. I would also search you computer for any google or chrome folder to make sure.
C:\Users\<YourUserName>\AppData\Local\Google\Chrome
C:\Program Files\Google\Chrome
Step 3: Schedule a check disk
To do this use:
chkdsk c: /r
where 'c' is the drive with chrome installed. You can add other drives as well just in case you had multiple installations. To do this basically replace c with the drive letter.
Step 5: Reboot PC and reinstall chrome.
Optional Step: if the above still fails. Download CCleaner. Restart in safe mode with networking. Repeat the above steps but run CCleaner as the final step.
What you need to do is check if there is a proxy turned on system-wide or even in chrome, turn it off. type that "chrome://settings" in your URL bar of chrome: and search for proxy

How to enable chrome crash dump collection during automated testing?

I know how to enable chrome's crash reporting interactively:
Menu > Settings > Show advanced settings > Tick "Automatically send usage statistics and crash reports to Google"
However, I'm using chrome in an automated testing setup where we set a new --user-data-dir for each run (so there are no persisted settings, we just get the defaults). Chrome is crashing occasionally (running our javascript/html application) and I would like to be able to report these crashes.
I thought I could add --enable-crash-reporter (according to the List of Chromium Command Line Switches), but that doesn't seem to do anything. (We already pass --enable-logging and a couple other flags on the command line.)
I have a test that triggered an "Aw, Snap":
But if I download the user-data-dir for that run and and point chrome at it, and then visit chrome://crashes, it says crash dumps are not enabled.
(The chrome_debug.log does not say anything about the Aw-Snap either.)
We're running chrome under Xvfb on Debian. We're driving chrome via the direct webdriver (from Protractor).
According to the "crashpad with content shell" docs, the steps for using crashpad with content shell (a stripped down version of Chrome):
Create some directory for your crash dumps to go to (the docs suggest tmp/crashes on Linux and Mac, %TEMP%\crashes on Windows, and /data/local/tmp/crashes on Android)
Start Chrome with --enable-crash-reporter --crash-dumps-dir=<your_dump_dir> (looks like you got half of this)
So I'd try adding the --crash-dumps-dir flag.

How to create a Chrome profile programmatically?

Development, testing, staging environments are controlled via different proxy servers in my setup. I want to script creation of multiple Chrome profiles (sometimes called "user" or "person") and connect to a different proxy server for each of them. Finally I want to share this script with colleagues so that they have access to the exactly same setup.
The latter can be done via scripted installation of extensions such as Falcon Proxy or Proxy Helper to the Chrome profile. I would like to know how to script creation of the different profiles.
A profile is a folder inside ~/.config/google-chrome (Linux, ~/Library/Application Support/Google/Chrome (Mac OS X) and %USERPROFILE%\AppData\Local\Google\Chrome\User Data (Windows). But how to create and initialize one? Where do I register the new profile?
Creating a user
The following example applies to Windows, but the basic procedure should be the same.
First, change to the UserData folder in your Chrome installation:
cd "%APPDATA%\..\Local\Google\Chrome\User Data"
This method will copy the current user as a template for the new user. If the new user should be blank, you need to delete (CTRL + SHIFT + DEL the current browser data).
Now create a new user:
mkdir NewUser && copy Default NewUser
Change your directory to the chrome installation:
cd "C:\Program Files (x86)\Google\Chrome\Application"
Factory-Reset all user parameters:
chrome.exe --user-data-dir="..\User Data\NewUser" -first-run
where --user-data-dir is the path (full or relative) to the previously created NewUser directory.
Running as NewUser
To run chrome again using this profile, simply run chrome without the -first-run flag.
From this documentation, I finally found a way to create a user/person, rather than a separate profile. The difference is especially important in Mac OS X since different profiles can be opened concurrently using the same Chrome process.
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --profile-directory="StagingEnv" --first-run
The only unfortunate fact is that this new person doesn't inherit the name from the profile directory. Instead, it is always called Person X where X is an increment number.
I need to go to the Local State file to change it.
grep -o '"StagingEnv":{[^}]*}' ~/Library/Application\ Support/Google/Chrome/Local\ State
"StagingEnv":{"active_time":1437709453.172762,"avatar_icon":"chrome://theme/IDR_PROFILE_AVATAR_6","background_apps":false,"is_ephemeral":false,"is_omitted_from_profile_list":false,"is_using_default_avatar":true,"is_using_default_name":true,"managed_user_id":"","name":"<b>Person 3</b>","user_name":""}
This file is overridden when Chrome quits, so I need to kill Chrome, change the file and run Chrome again.
I think the easiest way to create multiple chrome profile is
On your computer, open Chrome.
At the top right, click Profile.
Click Manage people.
Click Add person.
Choose a name and a photo/picture.
Select Create a short cut on the desktop.
Click Save. A new window will open and ask you to turn on sync which is
optional.
By this, each chrome profile will be created and you can check on C:\Users\youname\AppData\Local\Google\Chrome\User Data.

Run chrome in fullscreen mode on Windows

I want to configure my computer to launch Google Chrome Windows start up. It should start in full screen mode and open some web page.
I tried to run Chrome with the following command line:
chrome.exe --start-fullscreen --app=https://google.com
However Chrome opens in windowed mode, not in full screen mode.
Is there any way to run chrome in full screen mode?
Update 03-Oct-19
new script that displays 10second countdown then launches chrome/chromiumn in fullscreen kiosk mode.
more updates to chrome required script update to allow autoplaying video with audio. Note --overscroll-history-navigation=0 isn't working currently will need to disable this flag by going to chrome://flags/#overscroll-history-navigation in your browser and setting to disabled.
#echo off
echo Countdown to application launch...
timeout /t 10
"C:\Program Files (x86)\chrome-win32\chrome.exe" --chrome --kiosk http://localhost/xxxx --incognito --disable-pinch --no-user-gesture-required --overscroll-history-navigation=0
exit
might need to set chrome://flags/#autoplay-policy if running an older version of chrome (60 below)
Update 11-May-16
There have been many updates to chrome since I posted this and have had to alter the script alot to keep it working as I needed.
Couple of issues with newer versions of chrome:
built in pinch to zoom
Chrome restore error always showing after forced shutdown
auto update popup
Because of the restore error switched out to incognito mode as this launches a clear version all the time and does not save what the user was viewing and so if it crashes there is nothing to restore. Also the auto up in newer versions of chrome being a pain to try and disable I switched out to use chromium as it does not auto update and still gives all the modern features of chrome. Note make sure you download the top version of chromium this comes with all audio and video codecs as the basic version of chromium does not support all codecs.
Chromium download link
#echo off
echo Step 1 of 2: Waiting a few seconds before starting the Kiosk...
"C:\windows\system32\ping" -n 5 -w 1000 127.0.0.1 >NUL
echo Step 2 of 5: Waiting a few more seconds before starting the browser...
"C:\windows\system32\ping" -n 5 -w 1000 127.0.0.1 >NUL
echo Final 'invisible' step: Starting the browser, Finally...
"C:\Program Files (x86)\Google\Chromium\chrome.exe" --chrome --kiosk http://127.0.0.1/xxxx --incognito --disable-pinch --overscroll-history-navigation=0
exit
Outdated
I use this for exhibitions to lock down screens. I think its what your looking for.
Start chrome and go to www.google.com drag and drop the url out onto the desktop
rename it to something handy for this example google_homepage
drop this now into your c directory, click on my computer c: and drop this file in there
start chrome again go to settings and under on start up select open a specific page and set your home page here.
Next part is the script that I use to start close and restart chrome again in kiosk mode. The locations is where I have chrome installed so it might be abit different for you depending on your install.
Open your text editor of choice or just notepad and past the below code in, make sure its in the same format/order as below. Save it to your desktop as what ever you like so for this example chrome_startup_script.txt next right click it and rename, remove the txt from the end and put in bat instead. double click this to launch the script to see if its working correctly.
A command line box should appear and run through the script, chrome will start and then close down the reason to do this is to remove any error reports such as if the pc crashed, when chrome starts again without this it would show the yellow error bar at the top saying chrome did not shut down properly would you like to restore it. After a few seconds chrome should start again and in kiosk mode and will point to what ever homepage you have set.
#echo off
echo Step 1 of 5: Waiting a few seconds before starting the Kiosk...
"C:\windows\system32\ping" -n 31 -w 1000 127.0.0.1 >NUL
echo Step 2 of 5: Starting browser as a pre-start to delete error messages...
"C:\google_homepage.url"
echo Step 3 of 5: Waiting a few seconds before killing the browser task...
"C:\windows\system32\ping" -n 11 -w 1000 127.0.0.1 >NUL
echo Step 4 of 5: Killing the browser task gracefully to avoid session restore...
Taskkill /IM chrome.exe
echo Step 5 of 5: Waiting a few seconds before restarting the browser...
"C:\windows\system32\ping" -n 11 -w 1000 127.0.0.1 >NUL
echo Final 'invisible' step: Starting the browser, Finally...
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --kiosk --overscroll-history-navigation=0"
exit
Note: The number after the -n of the ping is the amount of seconds (minus one second) to wait before starting the link (or application in the next line)
Finally if this is all working then you can drag and drop the .bat file into the startup folder in windows and this script will launch each time windows starts.
Update:
With recent versions of chrome they have really got into enabling touch gestures, this means that swiping left or right on a touchscreen will cause the browser to go forward or backward in history. To prevent this we need to disable the history navigation on the back and forward buttons to do that add the following --overscroll-history-navigation=0 to the end of the script.
It's very easy.
"your chrome path" -kiosk -fullscreen "your URL"
Example:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -kiosk -fullscreen http://google.com
Close all Chrome sessions first !
To exit:
Press ALT-TAB > hold ALT and press X in the windows task. (win10)
I would like to share my way of starting chrome - specificaly youtube tv - in full screen mode automatically, without the need of pressing F11. kiosk/fullscreen options doesn't seem to work (Version 41.0.2272.89). It has some steps though...
Start chrome and navigate to page (www.youtube.com/tv)
Drag the address from the address bar (the lock icon) to the desktop. It will create a shortcut.
From chrome, open Apps (the icon with the multiple coloured dots)
From desktop, drag the shortcut into the Apps space
Right click on the new icon in Apps and select "Open fullscreen"
Right click again on the icon in Apps and select "Create shortcuts..."
Select for example Desktop and Create. A new shortcut will be created on desktop.
Now, whenever you click on this shortcut, chrome will start in fullscreen and at the page you defined. I guess you can put this shortcut in startup folder to run when windows starts, but I haven't tried it.
Running chrome.exe --start-fullscreen --app=https://google.com will not get you Chrome in fullscreen, but in kiosk mode.
However, running chrome --start-fullscreen --app=https://google.com (notice : it's chrome instead of chrome.exe) worked in my case.
You can also add --disable-session-crashed-bubble to eliminate the errors that come up after a crash or improper shutdown.
Right click the Google Chrome icon and select Properties.
Copy the value of Target, for example: "C:\Users\zero\AppData\Local\Google\Chrome\Application\chrome.exe".
Create a shortcut on your Desktop.
Paste the value into Location of the item, and append --kiosk <your url>:
"C:\Users\zero\AppData\Local\Google\Chrome\Application\chrome.exe" --kiosk http://www.google.com
Press Apply, then OK.
To start Chrome at Windows startup, copy this shortcut and paste it into the Startup folder (Start -> Program -> Startup).