Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Disable Google Incognito Mode


  • Please log in to reply
23 replies to this topic

#1 Sapient

Sapient

    Seeker

  • Active Members
  • 18 posts

Posted 21 November 2010 - 08:29 PM

Here is the source code for a program to detect and kill any Google Incognito windows that pop-up. This is useful for people who are relying on extensions such as Chrome Nanny to help the users be more productive. To set it up, save the code as "SpyVsSpy.au3" then open the code with SciTE Editor and Build the executabe (Tools->Build), then schedule it through Windows Task Scheduler. (If you think of a better way to run it in the background to prevent non-admin task kill, let me know.)

Plain Text         
; author: Patrick Parker <patrick_x99 (email at) hotmail.com> ; this code is provided free for personal use and provided as-is with no warranty or promise of fitness for any purpose #NoTrayIcon #include <Misc.au3> if _Singleton("SpyVsSpy",1) = 0 Then     Exit ; already running EndIf $loop = 1 While $loop   $wins = WinList("[REGEXPCLASS:Chrome.*; REGEXPTITLE:.* - Google Chrome]")   For $i = 1 to $wins[0][0]     $win = $wins[$i][1] ; save the handle     If IsVisible($win) and IsActive($win) Then       $dim = WinGetPos($win)       If IsMaximized($win) Then         $x = $dim[0] + ($dim[2] - 49)     ; x = window x + (window width - 49)         $y = $dim[1] + 40                 ; y = window y + (40 if maximized)       Else         $x = $dim[0] + ($dim[2] - 45)     ; x = window x + (window width - 45)         $y = $dim[1] + 48                 ; y = window y + (48 if not maximized)       EndIf         $color = Hex(PixelGetColor( $x , $y , $win), 6)       If $color = "FFFFFF" Then ;         MsgBox(0, "Details", "Title=" & $wins[$i][0] & @LF & "Handle=" & $win & @LF & "The hex color is " & $color & " at position " & $x & "," & $y)           WinKill($win) ;         $loop = 0       EndIf     EndIf   Next Sleep(500) ; 1/2 second WEnd Func IsVisible($handle)   If BitAnd( WinGetState($handle), 2 ) Then     Return 1   Else     Return 0   EndIf EndFunc Func IsActive($handle)   If BitAnd( WinGetState($handle), 8 ) Then     Return 1   Else     Return 0   EndIf EndFunc Func IsMaximized($handle)   If BitAnd( WinGetState($handle), 32) Then     Return 1   Else     Return 0   EndIf EndFunc


{edit: note, a new and improved version of this code has been posted below. continue reading the thread for details }

Edited by Sapient, 11 February 2011 - 06:45 PM.








#2 James

James

    Universalist

  • MVPs
  • 10,364 posts

Posted 21 November 2010 - 08:53 PM

This is useful for people who are relying on extensions such as Chrome Nanny to help the users be more productive.

But surely if they had the willpower not to be in Incognito mode whilst using Google Nanny, they wouldn't need this. And if they did need this, they'd still be able to disable it and so we're in a cycle.

#3 Sapient

Sapient

    Seeker

  • Active Members
  • 18 posts

Posted 21 November 2010 - 09:05 PM

But surely if they had the willpower not to be in Incognito mode whilst using Google Nanny, they wouldn't need this. And if they did need this, they'd still be able to disable it and so we're in a cycle.


If you are someone who uses Chrome Nanny extension then you are aware that the user CAN disable it, but it requires prolonged conscious effort to do so (typing out a long series of keystrokes). However, they can work around the whole thing with one click by entering incognito mode, which makes it take almost no time or conscious thought. This is an attempt to fix that.

If there is no value in such an approach to you, then fine, but I assure you some people (maybe a small minority) who do find it useful and you can read the feedback on that extension for more details. Now I'm no expert on human psychology but I do know that some people find it useful. If you don't, then that's fine, don't download it. Your choice.

#4 UEZ

UEZ

    Never say never

  • MVPs
  • 5,041 posts

Posted 21 November 2010 - 09:41 PM

Spy vs. Spy - hmmm an old C64 game...

Br,
UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#5 Werty

Werty

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 404 posts

Posted 21 November 2010 - 10:21 PM

Spy vs. Spy - hmmm an old C64 game...

Br,
UEZ


Spy vs Spy was from MAD magazine, which was made into a computer game, I read the mags and played the game, not on C64 but on ZX Spectrum. :graduated:

http://en.wikipedia.org/wiki/Spy_vs._Spy

#6 James

James

    Universalist

  • MVPs
  • 10,364 posts

Posted 21 November 2010 - 11:00 PM

If there is no value in such an approach to you, then fine, but I assure you some people (maybe a small minority) who do find it useful and you can read the feedback on that extension for more details. Now I'm no expert on human psychology but I do know that some people find it useful. If you don't, then that's fine, don't download it. Your choice.


Sorry, I didn't mean to offend you.

The code is nice and does what it's intended to do. But I just see it as another thing to turn off before I can continue my wrong doings on the Internet whilst I should be working.

I really didn't mean to hurt you.

#7 snowboarder1087

snowboarder1087

    Seeker

  • New Members
  • 3 posts

Posted 02 January 2011 - 03:43 AM

Thanks a million for making this!! I had avoided using ChromeNanny simply because anytime I would want to "crack" ChomeNanny all I had to do was hit control + shift + n and bam I could circumvent ChromeNanny and then procrastinate all I wanted.

The problem is I'm not hugely programmer savvy... I mean I downloaded the "single file executable called Sc1 (610K)" here

Once downloaded I end up with a file called "Sc223.exe" which opens fine, I can open the "SpyVsSpy.au3" in it which had created by copying your script into Notepad and saving it as "SpyVsSpy.au3" obviously. I also tried saving it in SciTE Editor - (neither notepad nor SciTE have an option to choose .au3 as the file extension though.)

Once I select Tools>Build I get the following:

C:\program files\autoit3\aut2exe\aut2exe.exe /in "C:\Users\Phillip\Downloads\SpyVsSpy.au3"
'C:\program' is not recognized as an internal or external command,
operable program or batch file.
>Exit code: 1


What did I do wrong?? -- Edit: Also sorry for bringing back a thread that was a little over a month old, but I really need help! :x

Edited by snowboarder1087, 02 January 2011 - 03:56 AM.


#8 snowboarder1087

snowboarder1087

    Seeker

  • New Members
  • 3 posts

Posted 02 January 2011 - 06:21 AM

I`m sorry, but I feel like I`ve done everything correctly now.

Downloaded SciTE4AutoIt3.exe
Created the SpyVsSpy.au3 file.
Built the SpyVsSpy.exe Application in SciEditor.
Even whitelisted it in my Spyware programs so it wasn`t marked as malware.

Opened Task scheduler, created a task and named it Disable Incognito (configured for Windows 7, Windows Server 2008 R2), Set the trigger for it to run at System Startup. Set the action to be `Start a program` and the program to start being ``C:\Users\Phillip\Documents\SpyVsSpy.exe`` with no Conditions set for it.

But I can still hit Control + Shift + n and get incognito...

Edited by snowboarder1087, 02 January 2011 - 06:31 AM.


#9 snowboarder1087

snowboarder1087

    Seeker

  • New Members
  • 3 posts

Posted 05 January 2011 - 09:35 PM

Bump... Anyone know why I can't get this script to work and block my ability to use Chrome incognito?

#10 Sapient

Sapient

    Seeker

  • Active Members
  • 18 posts

Posted 13 January 2011 - 04:28 AM

Bump... Anyone know why I can't get this script to work and block my ability to use Chrome incognito?



Hey snowboarder. Sorry I just noticed this reply.

Looks like you've done everything correctly so far, but the Task Scheduler in Windows 7 is a pain to configure correctly (I know because I'm also using Windows 7). My guess is that SpyVsSpy.exe isn't even running.

Try double-clicking SpyVsSpy.exe to run it, so that way you at least know it is running.
Then see if you can launch incognito windows.

This way you can isolate the problem to the script or the task scheduler.

I'm not an expert on the Windows Task Scheduler so I will only be able to give limited advice on it, but there are other resources and forums out there if that is the issue.
I will say to make sure you turn off all conditions that disable the task, for example when on battery power, when idle, etc. I set it to run every five minutes and at logon.

Edited by Sapient, 13 January 2011 - 04:30 AM.


#11 rmkbow

rmkbow

    Seeker

  • Normal Members
  • 3 posts

Posted 01 February 2011 - 01:59 AM

it looks like it's attempting to find the incognito head on the right side of the browser instead of the left side.

could you fix this?

#12 TheDarkLord

TheDarkLord

    Seeker

  • New Members
  • 2 posts

Posted 10 February 2011 - 05:09 AM

Hey Sapient, great post. It was exactly what I was looking for, but I'm stuck right now.
The part where you have to Build the .exe file...I get this:
>C:\program files\autoit3\aut2exe\aut2exe.exe /in "C:\Users\Admin\Documents\Vignesh\SpyVsSpy.au3" 'C:\program' is not recognized as an internal or external command, operable program or batch file. >Exit code: 1

Could anyone help me on what I'm doing wrong? I'm not much of a programmer or anything..

#13 Manadar

Manadar

         

  • MVPs
  • 10,893 posts

Posted 10 February 2011 - 12:46 PM

Hey Sapient, great post. It was exactly what I was looking for, but I'm stuck right now.
The part where you have to Build the .exe file...I get this:

>C:\program files\autoit3\aut2exe\aut2exe.exe /in "C:\Users\Admin\Documents\Vignesh\SpyVsSpy.au3" 'C:\program' is not recognized as an internal or external command, operable program or batch file. >Exit code: 1

Could anyone help me on what I'm doing wrong? I'm not much of a programmer or anything..

if you have AutoIt installed, right click the Source code (SpyVsSpy.au3) and press Compile script.

#14 Manadar

Manadar

         

  • MVPs
  • 10,893 posts

Posted 10 February 2011 - 12:54 PM

The post by rmkbow suggests that it checks the presence of the incognito head. That is not the case at all. It checks how far the address bar stretches to the right side of the window. The address bar width is affected by the presence of any addons, that place buttons next to the wrench. Like this one:
Posted Image

Extensions are by default disabled in incognito mode as seen here:
Posted Image

So, in order for to work:
1. You must have an extension installed that will place a button next to the wrench.
2. The extension must be disabled when the browser enters incognito mode (default).

This breaks when:
1. You disable all extensions (closes the window all the time)
2. You allow extensions to work in incognito mode (never closes the window)

All of this explains the comment in the first post: "useful for people who are relying on extensions such as Chrome Nanny". Because Chrome Nanny adds a similar button.

Proposed solution: Check the presence of the incognito mode head instead.

Edited by Manadar, 10 February 2011 - 12:56 PM.


#15 TheDarkLord

TheDarkLord

    Seeker

  • New Members
  • 2 posts

Posted 10 February 2011 - 11:21 PM

if you have AutoIt installed, right click the Source code (SpyVsSpy.au3) and press Compile script.


No, I don't have AutoIt installed.. Could you tell me where I could install it from?
Thanks for the help.

#16 Manadar

Manadar

         

  • MVPs
  • 10,893 posts

Posted 11 February 2011 - 08:22 AM

No, I don't have AutoIt installed.. Could you tell me where I could install it from?
Thanks for the help.

From the AutoIt website. There is a downloads page here: http://www.autoitscript.com/site/autoit/downloads/

#17 Sapient

Sapient

    Seeker

  • Active Members
  • 18 posts

Posted 11 February 2011 - 02:25 PM

Proposed solution: Check the presence of the incognito mode head instead.

Thanks for the feedback. I went with that simplistic approach because I didn't want to worry about all the possible skins out there or potential artistic tweaks to the incognito icon which may be pushed with future google updates.

However, here is version 2.2 below and it does address your concerns (and detects another vulnerability you didn't mention yet).

Plain Text         
; SpyVsSpy.au3, version: 2.2 ; author: Patrick Parker <patrick_x99 (email at) hotmail.com> ; this code is provided free for personal use and provided as-is with no warranty or promise of fitness for any purpose #NoTrayIcon #include <Misc.au3> #include <Math.au3> if _Singleton("SpyVsSpy",1) = 0 Then     Exit ; already running EndIf $loop = 1 $hat_fails = 0 $ref_fails = 0 While $loop   $wins = WinList("[REGEXPCLASS:Chrome.*; REGEXPTITLE:.* - Google Chrome]")   For $i = 1 to $wins[0][0]     $win = $wins[$i][1] ; save the handle     If IsVisible($win) and IsActive($win) Then       $dim = WinGetPos($win)       If IsMaximized($win) Then         $hat_x = 20         $hat_y = 2         $ref_x = 75         $ref_y = 28       Else         $hat_x = $dim[0] + 25         $hat_y = $dim[1] + 15         $ref_x = $dim[0] + 80         $ref_y = $dim[1] + 44       EndIf           $checksum = PixelChecksum($hat_x, $hat_y, $hat_x+8, $hat_y+5, 1, $win) ;     MsgBox(0, "Details", "Title=" & $wins[$i][0] & @LF & "Handle=" & $win & @LF & "The color checksum is " & $checksum) ;     Exit       If $checksum = 3044775763 Then         $hat_fails = $hat_fails+1 ; detected checksum of incognito hat, as sampled from Chrome 9.0.597.94       Else         $hat_fails = 0       EndIf       $colordiff = ColorDiff(PixelGetColor( $ref_x , $ref_y , $win), PixelGetColor( $ref_x , $ref_y+11 , $win)) ;     MsgBox(0, "Details", "Title=" & $wins[$i][0] & @LF & "Handle=" & $win & @LF & "The color 0x" & Hex(PixelGetColor($ref_x,$ref_y,$win),6) & " at " & $ref_x & "," & $ref_y & " is " & $colordiff & " shades different from color 0x" & Hex(PixelGetColor($ref_x,$ref_y+11,$win),6) & " at " & $ref_x & "," & ($ref_y+11)) ;     Exit       If $colordiff < 31 Then         $ref_fails = $ref_fails+1 ; unable to sample pixels because active window is obscured       Else         $ref_fails = 0       EndIf           If $hat_fails > 0 Or $ref_fails > 4 Then         WinKill($win)         $hat_fails = 0         $ref_fails = 0       EndIf     EndIf   Next   Sleep(500) ; 1/2 second WEnd Func IsVisible($handle)   If BitAnd( WinGetState($handle), 2 ) Then     Return 1   Else     Return 0   EndIf EndFunc Func IsActive($handle)   If BitAnd( WinGetState($handle), 8 ) Then     Return 1   Else     Return 0   EndIf EndFunc Func IsMaximized($handle)   If BitAnd( WinGetState($handle), 32) Then     Return 1   Else     Return 0   EndIf EndFunc Func ColorDiff($color1, $color2, $min_return = 0)   If $color1 = $color2 Then     Return $min_return   EndIf     Return ColorDiff(BitShift($color1,8), BitShift($color2,8), _Max($min_return, Abs(BitAnd($color1, 0xFF) - BitAnd($color2, 0xFF)))) EndFunc

Edited by Sapient, 12 February 2011 - 03:08 AM.


#18 maddhater

maddhater

    Seeker

  • New Members
  • 1 posts

Posted 25 April 2011 - 04:37 AM

Sapient,

The running the compiled executable closes all chrome windows, regardless if they were incognito or not.

Is this an issue you've heard or seen before? Is there a fix or workaround?

Thanks

~madd

#19 Sapient

Sapient

    Seeker

  • Active Members
  • 18 posts

Posted 25 April 2011 - 07:01 PM

Sapient,

The running the compiled executable closes all chrome windows, regardless if they were incognito or not.

Is this an issue you've heard or seen before? Is there a fix or workaround?

Thanks

~madd


Hi, that could happen for a couple of reasons. You could be using an odd skin that makes it fail the color reference checks. Or your computer is very slow and so it can't sample a valid color reference within the allowed threshold of time. Or your version of chrome renders the browser differently from mine.

The first thing I would try is go back to the default skin and increase the $ref_fails threshold. Find the line where it says $ref_fails > 4 and increase that number to 8, then recomopile.

If that doesn't solve your problem then uncomment both of the MsgBox lines, recompile, and let me know what messages pop up.

Also, remember you have to kill the running SpyVsSpy program and restart it for the changes to take effect.

If it turns out the problem was the skin, please let me know which skin you were using so I can adjust the algorithm. So far it works for all the ones I tested.

Edited by Sapient, 26 April 2011 - 01:11 PM.


#20 PAEz

PAEz

    Seeker

  • Active Members
  • 26 posts

Posted 14 August 2011 - 09:20 AM

Dont want to spoil your fun or anything, but theres a more Chrome way of doing this.....
http://dev.chromium.org/administrators/policy-list-3#IncognitoEnabled
....so on windows (only tested in xp) you can create a reg entry to disable incognito.
Create a text file called noIncognito.reg and enter this as its text.....
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome] "IncognitoEnabled"=dword:00000000

....save it and then double click the file to launch it and it should enter the right reg key and then you wont be able to open incognito mode.
Another useful policy for this sort of thing is the force install policy, this is good if you want to runny nanny software and dont want your kids getting past it......
http://dev.chromium.org/administrators/policy-list-3#ExtensionInstallForcelist
...the extension cant be installed before adding this policy, or just uninstall the extension after adding the policy and it will install the extension and they wont be able to uninstall or disable it.

These settings will apply to all instances of chrome regardless of what profile they are using.
  • ctl likes this




2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users