Permalink
Browse files

First commit

  • Loading branch information...
compvid30 committed Mar 26, 2015
1 parent 767598c commit 95fc0a7cf7f34b531b8bba581571fd0a3e3d25d5
Showing with 4,724 additions and 0 deletions.
  1. +20 −0 CHANGE__PASSWORD__HERE.js
  2. +196 −0 License.txt
  3. +12 −0 background.html
  4. +75 −0 background.js
  5. +41 −0 bg.js
  6. +56 −0 blockAfter.js
  7. +583 −0 blockStart.js
  8. +683 −0 common/common.js
  9. +476 −0 common/config.js
  10. +7 −0 common/cryptoJS-md5-min.js
  11. +39 −0 common/sjcl.js
  12. BIN css/custom-theme/images/animated-overlay.gif
  13. BIN css/custom-theme/images/ui-bg_flat_0_aaaaaa_40x100.png
  14. BIN css/custom-theme/images/ui-bg_flat_75_ffffff_40x100.png
  15. BIN css/custom-theme/images/ui-bg_glass_55_fbf9ee_1x400.png
  16. BIN css/custom-theme/images/ui-bg_glass_65_ffffff_1x400.png
  17. BIN css/custom-theme/images/ui-bg_glass_75_dadada_1x400.png
  18. BIN css/custom-theme/images/ui-bg_glass_75_e6e6e6_1x400.png
  19. BIN css/custom-theme/images/ui-bg_glass_95_fef1ec_1x400.png
  20. BIN css/custom-theme/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  21. BIN css/custom-theme/images/ui-icons_222222_256x240.png
  22. BIN css/custom-theme/images/ui-icons_2e83ff_256x240.png
  23. BIN css/custom-theme/images/ui-icons_454545_256x240.png
  24. BIN css/custom-theme/images/ui-icons_888888_256x240.png
  25. BIN css/custom-theme/images/ui-icons_cd0a0a_256x240.png
  26. +700 −0 css/custom-theme/jquery-ui-1.10.3.custom.css
  27. BIN img/allowed.png
  28. BIN img/disabled.png
  29. BIN img/forbidden.png
  30. BIN img/icon128.png
  31. BIN img/icon16.png
  32. BIN img/icon48.png
  33. BIN img/temp.png
  34. +6 −0 js/jquery-1.10.2.min.js
  35. +6 −0 js/jquery-ui-1.10.3.custom.min.js
  36. +36 −0 manifest.json
  37. +729 −0 options.html
  38. +133 −0 options.js
  39. +108 −0 optionsinit.js
  40. +246 −0 popup.html
  41. +572 −0 popup.js
View
@@ -0,0 +1,20 @@
+/*
+Choose a password for ScriptBlock with the following restrictions:
+
+Length: 20 minimum, 100 maximum
+Allowed Characters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_1234567890
+Spaces: Allowed
+
+Put your password in between the quotes of the line below that contains the word "ENCRYPTION_PASSWORD".
+
+Save the file and close it when finished. Then, restart Google Chrome.
+You will see an error message in ScriptBlock if there is something wrong with the password.
+Also, make a backup copy of this file because when ScriptBlock updates, Google Chrome will overwrite this file.
+If you change to a different password, make sure that you clear your browser HTML5 storage by clearing the cookies.
+*/
+
+
+
+
+
+const ENCRYPTION_PASSWORD = "1gnepnvj387fb3f3f8bhB6fvgzvgVTCFCFCGC4sfd";
View
@@ -0,0 +1,196 @@
+ScriptBlock gives you greater control over what javascript, iframes, and plugins runs in your browser to increase security and lower the CPU usage. It is useful to help mitigate attacks like cross-site scripting (XSS) and drive by downloads by minimizing the third party content run.
+
+For more information, updates, and to view the change log, please visit the project homepage at:
+https://code.google.com/p/scriptblock/
+
+To contact the author, visit the project homepage above and leave a comment, or you can e-mail:
+compvid30@gmail.com
+
+ScriptBlock
+ Copyright © 2013 Oliver von Schleusen
+ Parts Copyright © 2010 Eric Wong
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+Stanford Javascript Crypto Library
+
+Copyright © 2010 Emily Stark, Mike Hamburg and Dan Boneh. All rights reserved. (http://crypto.stanford.edu/sjcl/)
+
+Redistribution and use in source and binary forms, with or without modification, are
+permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice, this list of
+ conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ of conditions and the following disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY Emily Stark, Mike Hamburg and Dan Boneh ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation are those of the
+authors and should not be interpreted as representing official policies, either expressed
+or implied, of Emily Stark, Mike Hamburg and Dan Boneh.
+
+
+AdBlock for Chrome and Safari (port.js file - To be used to port ScriptBlock to Apple Safari in the future)
+
+ Copyright © 2010 Michael Gundlach (http://code.google.com/p/adblockforchrome/)
+
+And distributed under the following license ("MIT"):
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+
+AdThwart ("relativeToAbsoluteUrl" function)
+
+ Copyright © 2010 Tom Joseph (http://code.google.com/p/adthwart/)
+
+ The contents of this file are subject to the Mozilla Public License Version
+ 1.1 (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS" basis,
+ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ for the specific language governing rights and limitations under the
+ License.
+
+
+jQuery
+
+Copyright (c) 2010 John Resig, http://jquery.com/
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+
+parseUri 1.2.2
+
+ (c) Steven Levithan (stevenlevithan.com)
+
+And distributed under the following license ("MIT"):
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+
+Intermapper IPv6 Parser
+
+ (c) Intermapper (http://www.intermapper.com)
+
+Free use with link back to site.
+
+
+
+Public Suffix List (http://publicsuffix.org/, For recognizing common top level domains)
+
+ The contents of this file are subject to the Mozilla Public License Version
+ 1.1 (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+ http:www.mozilla.org/MPL/
+ Software distributed under the License is distributed on an "AS IS" basis,
+ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ for the specific language governing rights and limitations under the
+ License.
+
+ The Original Code is the Public Suffix List.
+
+ The Initial Developer of the Original Code is
+ Jo Hermans <jo.hermans@gmail.com>.
+ Portions created by the Initial Developer are Copyright (C) 2007
+ the Initial Developer. All Rights Reserved.
+
+ Contributor(s):
+ Ruben Arakelyan <ruben@wackomenace.co.uk>
+ Gervase Markham <gerv@gerv.net>
+ Pamela Greene <pamg.bugs@gmail.com>
+ David Triendl <david@triendl.name>
+ The kind representatives of many TLD registries
+
+
+
+Crypto-JS (http://code.google.com/p/crypto-js/)
+
+Copyright (c) 2009, Jeff Mott. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+Neither the name Crypto-JS nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
@@ -0,0 +1,12 @@
+<html>
+<head>
+<script src="CHANGE__PASSWORD__HERE.js"></script>
+<script src="common/cryptoJS-md5-min.js"></script>
+<script src="common/common.js"></script>
+<script src="common/config.js"></script>
+<script src="background.js"></script>
+<script src="bg.js"></script>
+</head>
+</html>
+
+
View
@@ -0,0 +1,75 @@
+function showOptionsPage() {
+ chrome.windows.getAll({populate: true}, function (windowsArray) {
+ var optionsPageURL = chrome.extension.getURL("options.html");
+ for (var i = 0; i < windowsArray.length; i++) {
+ var currWindow = windowsArray[i];
+ for (var j = 0; j < currWindow.tabs.length; j++) {
+ if (currWindow.tabs[j].url == optionsPageURL)
+ chrome.tabs.remove(currWindow.tabs[j].id);
+ }
+ }
+ chrome.tabs.create({"url": optionsPageURL});
+ });
+}
+
+function updateAllTabs(refreshLists) {
+ chrome.windows.getAll({populate: true}, function (windowsArray) {
+ if (refreshLists) {
+ whitelist = config.get('whitelist');
+ }
+
+ var newSettings = generateAllSettings();
+ for (var i = 0; i < windowsArray.length; i++) {
+ var currWindow = windowsArray[i];
+ for (var j = 0; j < currWindow.tabs.length; j++) {
+ chrome.tabs.sendMessage(currWindow.tabs[j].id, newSettings);
+ }
+ }
+ });
+}
+
+function resetSiteStorage(currTabId) {
+ var newSettings = generateAllSettings();
+ newSettings.type = "reset all storage";
+ newSettings.reload = true;
+ chrome.tabs.sendMessage(currTabId, newSettings);
+}
+
+/*
+ Generates a json object with all the applicable settings for a website of "url".
+ */
+function generateAllSettings() {
+ var tempAllowListHash = sessionConfig.get("tempAllowListHash");
+ return {"type": "update settings",
+ "whitelist": {"whitelist": whitelist, "whitelistHash": config.get("whitelistHash"),
+ "globalAllowAll": sessionConfig.get("globalAllowAll"),
+ "tempAllowList": tempAllowList, "tempAllowListHash": tempAllowListHash,
+ "tempExpiry": (tempAllowListHash === EMPTY_MD5 ? 0 : (new Date()).getTime() + 1000 * 3600), // Expire after 1 hour
+ "blacklist": blacklist, "blacklistHash": config.get("blacklistHash")},
+ "reload": config.get('reloadCurrentTabOnToggle')};
+}
+
+/*
+ Listens for messages from our content scripts to provide settings information.
+ */
+chrome.extension.onMessage.addListener(function (msg, src, send) {
+ if (msg.type === "get settings block start") {
+ //console.log("get settings block start msg: " + msg.url);
+ //console.log("get settings block start src: " + src);
+ // If src is null, we are very likely blocking something inside of another Google Chrome extension.
+ // However, we don't have a good way of showing the whitelister.
+ var theSettings = generateAllSettings(); //msg.url, ((src && src.tab) ? src.tab.url : "")
+ send(theSettings);
+ }
+ else if (msg.type === "get block harmful search") {
+ send({"setting": config.get('hideHarmfulSearches')});
+ }
+ else if (msg.type === "test") {
+ send({"result": true});
+ }
+ else {
+ send({});
+ }
+});
+
+
View
41 bg.js
@@ -0,0 +1,41 @@
+if (config.get('currVersion') < 10000) {
+ // Because we introduced lastVersion in 9001
+ if (config.get('currVersion') == 10000)
+ config.set('lastVersion', 10000);
+
+ config.set('currVersion', 10000);
+ config.set('currDisplayVersion', "1.0.0");
+}
+
+if (isPasswordGood() !== PASSWORD_STATUS.okay) {
+ showOptionsPage();
+}
+
+
+chrome.tabs.onUpdated.addListener(function (tabid, changeinfo, tab) {
+ if (config.get('showPageActionButton')) {
+
+ chrome.tabs.sendMessage(tab.id, {type: "get sources for top window"}, function (response) {
+ if (response.globalAllowAll)
+ chrome.browserAction.setIcon({path: "img/disabled.png", tabId: tab.id});
+ else if (response.pageSourcesAllowedLength > 0)
+ chrome.browserAction.setIcon({path: "img/allowed.png", tabId: tab.id});
+ else
+ chrome.browserAction.setIcon({path: "img/forbidden.png", tabId: tab.id});
+
+ if (response.pageSourcesTempAllowedLength > 0)
+ chrome.browserAction.setIcon({path: "img/temp.png", tabId: tab.id});
+
+ // show badge
+
+
+ const tabBlockedCount = response.pageSourcesForbiddenLength;
+ chrome.browserAction.setBadgeBackgroundColor({ color: [51, 0, 51, 230] });
+ chrome.browserAction.setBadgeText({text: tabBlockedCount + '', tabId: tab.id});
+ });
+ }
+ else {
+ chrome.browserAction.hide(tab.id);
+ }
+
+});
Oops, something went wrong.

0 comments on commit 95fc0a7

Please sign in to comment.