Advertisement
Tropiz

Chrome custom new tab

Jul 30th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.55 KB | None | 0 0
  1. Create a folder wherever you want to store you .html file, create a manifest.json file in the same folder with this code inside:
  2.  
  3. {
  4. "name": "My custom new tab page",
  5. "description": "Overrides the new tab page",
  6. "version": "0.1",
  7. "incognito": "split",
  8. "chrome_url_overrides": {
  9. "newtab": "code.html"
  10. },
  11. "manifest_version": 2
  12. }
  13.  
  14. Replace "code.html" with the name of your .html file.
  15. Go to chrome extensions -> enable developer mode -> click "load unpacked extension" -> locate you folder with the .html and .json -> press Ok.
  16. ___________________________________________________________________________________________________________________________________________________________
  17.  
  18. After that you need to patch your chrome.dll so the "you have a developer mode extension enabled" popup doesn't show every time you start you browser.
  19.  
  20. Make sure to close Chrome and end all chrome.exe processes.
  21. Create a .bat file and name it `DevWarningPatch.bat`. Save this to the desktop.
  22. Add the code below to the .bat file:
  23.  
  24.  
  25. <# :
  26. @echo off
  27. copy/b "%~f0" "%temp%\%~n0.ps1" >nul
  28. powershell -ExecutionPolicy bypass -noprofile -file "%temp%\%~n0.ps1" "%cd% " "%~1"
  29. del "%temp%\%~n0.ps1"
  30. pause
  31. exit /b
  32. #>
  33. param([string]$cwd='.', [string]$dll)
  34.  
  35. function main {
  36. if ($dll -and (gi -literal $dll)) {
  37. doPatch "DRAG'n'DROPPED" ((gi -literal $dll).directoryName + '\')
  38. exit
  39. }
  40. doPatch CURRENT ((gi -literal $cwd).fullName + '\')
  41. ('HKLM', 'HKCU') | %{ $hive = $_
  42. ('', '\Wow6432Node') | %{
  43. $key = "${hive}:\SOFTWARE$_\Google\Update\Clients"
  44. gci -ea silentlycontinue $key -r | gp | ?{$_.CommandLine} | %{
  45. $path = $_.CommandLine -replace '"(.+?\\\d+\.\d+\.\d+\.\d+\\).+', '$1'
  46. doPatch REGISTRY $path
  47. }
  48. }
  49. }
  50. }
  51.  
  52. function doPatch([string]$pathLabel, [string]$path) {
  53. $dll = $path + "chrome.dll"
  54. if (!(test-path -literal $dll)) {
  55. return
  56. }
  57. "======================="
  58. "$pathLabel PATH $((gi -literal $dll).DirectoryName)"
  59. "`tREADING Chrome.dll..."
  60. $bytes = [IO.File]::ReadAllBytes($dll)
  61.  
  62. # process PE headers
  63. $BC = [BitConverter]
  64. $coff = $BC::ToUInt32($bytes,0x3C) + 4
  65. $is64 = $BC::ToUInt16($bytes,$coff) -eq 0x8664
  66. $opthdr = $coff+20
  67. $codesize = $BC::ToUInt32($bytes,$opthdr+4)
  68. if (!$is64) { $imagebase = $BC::ToUInt32($bytes,$opthdr+28) }
  69.  
  70. # patch the flag in data section
  71. $data = $BC::ToString($bytes,$codesize)
  72. $flag = "ExtensionDeveloperModeWarning"
  73. $stroffs = $data.IndexOf($BC::ToString($flag[1..99]))/3 - 1
  74. if ($stroffs -lt 0) {
  75. write-host -f red "`t$flag not found"
  76. return
  77. }
  78. $stroffs += $codesize
  79. if ($bytes[$stroffs] -eq 0) {
  80. write-host -f green "`tALREADY PATCHED"
  81. return
  82. }
  83. $bytes[$stroffs] = 0
  84. "`tPATCHED $flag flag"
  85.  
  86. # patch the channel restriction code for stable/beta
  87. $code = $BC::ToString($bytes,0,$codesize)
  88. $codepattern = "83-F8-03-7D-.{1,100}"
  89. try {
  90. if ($is64) {
  91. $pos = 0
  92. $rx = [regex] "$codepattern-48-8D"
  93. do {
  94. $m = $rx.match($code,$pos)
  95. if (!$m.success) { throw }
  96. $pos = $m.index + $m.length + 1
  97. $offs = $BC::ToUInt32($bytes,$pos/3+1)
  98. $diff = $pos/3+5+$offs - $stroffs
  99. } until ($diff -ge 0 -and $diff -le 4096 -and $diff % 1024 -eq 0)
  100. } else {
  101. $pattern = $BC::ToString($BC::GetBytes($stroffs+$imagebase)) `
  102. -replace '^(..-)..(.+)', "$codepattern-68-$1..$2"
  103. $m = [regex]::match($code,$pattern)
  104. if (!$m.success) { throw }
  105. }
  106. } catch {
  107. write-host -f red "`tUnable to find the channel code, try updating me"
  108. return
  109. }
  110. $bytes[$m.index/3+2] = 9
  111. "`tPATCHED Chrome release channel restriction"
  112.  
  113. "`tWriting to a temporary dll..."
  114. [IO.File]::WriteAllBytes("$dll.new",$bytes)
  115.  
  116. "`tBacking up the original dll..."
  117. move -literal $dll "$dll.bak" -force
  118.  
  119. "`tRenaming the temporary dll as the original dll..."
  120. move -literal "$dll.new" $dll -force
  121.  
  122. "DONE.`n"
  123. }
  124.  
  125. main
  126.  
  127. _____________________________________________________________________________________________________________________________________________________________________
  128.  
  129.  
  130.  
  131. Rightclick the batch file and run it as administrator: it will find & patch all applicable chrome.dll.
  132. Alternatively you can drag'n'drop chrome.dll onto the batch file.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement