├── src ├── _locales │ ├── zh_TW │ │ └── messages.json │ └── en │ │ └── messages.json ├── manifest.json └── background.js ├── .gitignore ├── README.md └── LICENSE /src/_locales/zh_TW/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "appName" : { 3 | "message" : "Blockdu" 4 | }, 5 | 6 | "appDesc" : { 7 | "message" : "封鎖GitHub事件相關有問題的程式碼,防止出現煩人的訊息及被利用作為攻擊源。" 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /src/_locales/en/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "appName" : { 3 | "message" : "Blockdu" 4 | }, 5 | 6 | "appDesc" : { 7 | "message" : "Blocking offending scripts related to the GitHub DDoS incident, annoying messages and being exploited as source of attack." 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "background": { 3 | "scripts": ["background.js"], 4 | "persistent": true 5 | }, 6 | "description": "__MSG_appDesc__", 7 | "manifest_version": 2, 8 | "default_locale": "en", 9 | "minimum_chrome_version": "18", 10 | "name": "__MSG_appName__", 11 | "permissions": [ "webRequest", "webRequestBlocking", "http://*/*", "https://*/*"], 12 | "version": "0.1.4" 13 | } 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 27 | node_modules 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A Chrome extension to prevent your browser be used to attack Github 2 | =================================================================== 3 | 4 | This extension is now available in Chrome Web Store. The download link: 5 | 6 | [Blockdu - Chrome Web Store](https://chrome.google.com/webstore/detail/blockdu/effllpcngdchldpedlbehnipblaamnng) 7 | 8 | Installation Intructions for Developer 9 | ===================================== 10 | 11 | 1. Clone the project 12 | 1. Launch this URL in your Chrome: chrome://extensions/ 13 | 1. Enable "Developer Mode" 14 | 1. Press "Load unpacked extension..." 15 | 1. Open the project folder and set the path to "src/" 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/background.js: -------------------------------------------------------------------------------- 1 | 2 | var filterUrls = [ 3 | "*://*.baidu.com/*.js*", 4 | "*://*.baidustatic.com/*.js*", 5 | "*://sjs.sinajs.cn/blog7common/js/boot.js", 6 | 7 | 8 | /* Vicitm. It won't block direct access. 9 | It just block request as script and image */ 10 | "*://*.github.com/greatfire", 11 | "*://*.github.com/cn-nytimes" 12 | ]; 13 | 14 | chrome.webRequest.onBeforeRequest.addListener(function(info) { 15 | 16 | console.log("Blocked: " , info.url); 17 | 18 | return { cancel : true}; 19 | },{ 20 | urls: filterUrls, 21 | types: ["script","image"] 22 | },["blocking"] 23 | 24 | ); -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Ben Lau 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | --------------------------------------------------------------------------------