Import v1.0.7.1 from a.m.o.
This is a huge jump. Sorry, I will not manually import all intermediary versions to track development. Significant changes: - Major feature: Now works with Firefox 52 / current Tor Browser. Closes #2. - Major feature: Error page. Closes #3. - Major feature: Whitelist. Closes #4. - Regression: Indentation/style is busted. Reopens #1.
This commit is contained in:
parent
9c4cd9c984
commit
ce7503453c
Binary file not shown.
After Width: | Height: | Size: 508 B |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.3 KiB |
|
@ -1,15 +1,31 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Block Cloudflare MiTM Attack",
|
||||
"description": "If the destination use Cloudflare, block future request.",
|
||||
"version": "1.0.0",
|
||||
"description": "If the destination website use Cloudflare, block further request.",
|
||||
"version": "1.0.7.1",
|
||||
"homepage_url": "https://trac.torproject.org/projects/tor/ticket/24351",
|
||||
"permissions": ["webRequest","webRequestBlocking","<all_urls>"],
|
||||
"permissions": ["webRequest","webRequestBlocking","<all_urls>","storage","activeTab"],
|
||||
"options_ui": {
|
||||
"page": "setwhitelist.html",
|
||||
"browser_style": true
|
||||
},
|
||||
"icons": {
|
||||
"32": "icons/icon-32.png",
|
||||
"48": "icons/icon-48.png",
|
||||
"64": "icons/icon-64.png"
|
||||
},
|
||||
"background": {
|
||||
"scripts": ["stop_cf_mitm.js"]
|
||||
"browser_action": {
|
||||
"browser_style": true,
|
||||
"default_icon": {
|
||||
"16": "icons/icon-16.png",
|
||||
"32": "icons/icon-32.png"
|
||||
}
|
||||
},
|
||||
"background": {"scripts": ["stop_cf_mitm.js"]},
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "{d86b44dd-ef12-4f28-ab1c-ea32664490ac}",
|
||||
"strict_min_version": "52.0"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<html><head><meta charset="utf-8"></head><body><form>
|
||||
[Whitelist]<br>
|
||||
1. Add FQDN you want to ignore. One FQDN per line. Click "Save".<br>
|
||||
2. Open new tab and visit whitelisted website.<br>
|
||||
<textarea cols="50" rows="10" id="myset_cfwhite"></textarea><br>
|
||||
<br>
|
||||
[Advanced]<br>
|
||||
<label><input type="checkbox" id="myset_xincapsula"> Also detect and block Incapsula MiTM</label><br>
|
||||
<label><input type="checkbox" id="myset_xgshield"> Also detect and block Google's Project Shield MiTM</label><br>
|
||||
<label><input type="checkbox" id="myset_xsucuri"> Also detect and block Sucuri MiTM</label><br>
|
||||
<label><input type="checkbox" id="myset_xignhttp"> Ignore http:// resource (not recommend)</label><br>
|
||||
<label><input type="checkbox" id="myset_xigncj"> Ignore CSS|JS|Image|Font|Cursor resource (not recommend)</label><br>
|
||||
<label><input type="checkbox" id="myset_xsimplewarn"> Don't show warning message; just change title and favicon(<img src="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOzk4OKpMSkq6UE9PulRTU7pXV1e6W1tbul1dXbpbW1u6WFhYulVVVbpTU1O6UFBQukxMTLotLS2bAAAAOzY0NJ7Y3Nz/v9zh/8He4//D4eb/xuTp/8jm6//I5On/x+Po/8bj6f/E4ef/wt/l/8Hd4/+/2d//3N/f/xkZGYU2NTWd2N7e/xekxf8WueD/Frrh/xa74f8Ur9P/Iiwu/yIsLv8Ws9//F7De/xer3P8Xptr/IJS6/97g4f8ZGRmCAAAAV9HQ0O91s7z/F8Hj/xbC4/8Ww+T/FLbV/yArLf8gKy3/Frrh/xa13/8XsN7/FqbV/5G3vf+xsbHUAAAARQAAAC5oZ2eV2N7f/yWtv/8Xyub/Fsrm/xbJ5v8Zq8f/GavH/xbA4/8Wu+H/FrXf/zWguf/Z2dn/Ly8veAAAABwAAAAAAAAASsbFxd2gy87/KtTm/xnU6v8W0Oj/FEJI/xRCSP8WxeX/Fr/j/xWw0/+swsP/k5OTtgAAADoAAAAAAAAAAAAAACFFRUV+6evr/zq1vv8w5PH/J9/v/yIiIv8iIiL/Fsrm/xbE5P9Xq7n/19fX+BkZGW0AAAAKAAAAAAAAAAAAAAAAAAAAPre2tsnA3uD/LNrj/y/o8v8rKyv/Kysr/yvb7v8mvdD/xM/P/3d3d6AAAAA0AAAAAAAAAAAAAAAAAAAAAAAAABUbGxtt8PDw+FrAw/8u7PP/NDQ0/zQ0NP8w3e//gLu//8jIyOgAAABRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANJ2dnbTS4+T/KdDV/zQ8PP80QEH/NL3J/9XZ2f9WVlaLAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAABX39/f733Exv8t5vH/Ldrp/5rBw/+2trbUAAAARQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALm1tbZXf5ub/LLnD/0S7xP/d3d3/MTExeAAAABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABKx8fH3bHP0f+8zM3/l5eXtgAAADoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITIyMna+vr7Trq6uyRkZGW0AAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbAAAARAAAAD4AAAAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//8AAIABAAAAAAAAAAAAAIABAACAAwAAwAMAAOAHAADgBwAA8A8AAPAPAAD4HwAA+D8AAPw/AAD+fwAA//8AAA==">)</label><br>
|
||||
<label><input type="checkbox" checked disabled> I don't like Man-in-the-middle attack.</label><br><!-- justajokedonttakethisseriouslyLOL //-->
|
||||
<br>
|
||||
<input type="submit" value=" Save ">
|
||||
</form><script src="setwhitelist.js"></script>
|
||||
</body></html>
|
|
@ -0,0 +1,44 @@
|
|||
function saveWhitelist(e) {
|
||||
e.preventDefault();
|
||||
//WHITELIST
|
||||
// check each line and remove bad fqdn (simple check)
|
||||
var cf_tmpdata=document.querySelector("#myset_cfwhite").value.split("\n");
|
||||
for (var i=0;i<cf_tmpdata.length;i++){
|
||||
if (!/^([0-9a-z.-]{1,})\.([a-z]{2,20})$/.test(cf_tmpdata[i])||cf_tmpdata[i].startsWith(".")||cf_tmpdata[i].includes("..")||
|
||||
cf_tmpdata[i].endsWith(".cloudflare.com")||cf_tmpdata[i]=='cloudflare.com'||
|
||||
cf_tmpdata[i].endsWith(".incapsula.com")||cf_tmpdata[i]=='incapsula.com'||
|
||||
cf_tmpdata[i].endsWith(".withgoogle.com")||cf_tmpdata[i].endsWith(".google.com")){cf_tmpdata[i]='';}
|
||||
}
|
||||
cf_tmpdata=cf_tmpdata.slice().sort(function(a,b){return a>b}).reduce(function(a,b){if (a.slice(-1)[0]!==b){a.push(b);};return a;},[]);// -duplicate
|
||||
cf_tmpdata=cf_tmpdata.filter(v=>v!='');// -empty
|
||||
cf_tmpdata=cf_tmpdata.join("\n");
|
||||
browser.storage.local.set({myset_cfwhite: cf_tmpdata});
|
||||
document.querySelector("#myset_cfwhite").value=cf_tmpdata;
|
||||
//workaround - simplewarn didn't work as expected if igncj is active
|
||||
if (document.querySelector("#myset_xsimplewarn").checked){document.querySelector("#myset_xigncj").checked=false;}
|
||||
//ADVANCED
|
||||
if (document.querySelector("#myset_xincapsula").checked){browser.storage.local.set({myset_xincapsula: "y"});}else{browser.storage.local.set({myset_xincapsula: "n"});}
|
||||
if (document.querySelector("#myset_xgshield").checked){browser.storage.local.set({myset_xgshield: "y"});}else{browser.storage.local.set({myset_xgshield: "n"});}
|
||||
if (document.querySelector("#myset_xsucuri").checked){browser.storage.local.set({myset_xsucuri: "y"});}else{browser.storage.local.set({myset_xsucuri: "n"});}
|
||||
if (document.querySelector("#myset_xignhttp").checked){browser.storage.local.set({myset_xignhttp: "y"});}else{browser.storage.local.set({myset_xignhttp: "n"});}
|
||||
if (document.querySelector("#myset_xigncj").checked){browser.storage.local.set({myset_xigncj: "y"});}else{browser.storage.local.set({myset_xigncj: "n"});}
|
||||
if (document.querySelector("#myset_xsimplewarn").checked){browser.storage.local.set({myset_xsimplewarn: "y"});}else{browser.storage.local.set({myset_xsimplewarn: "n"});}
|
||||
}
|
||||
function loadWhitelist(){
|
||||
function setCurrentChoice(r){
|
||||
//WHITELIST
|
||||
document.querySelector("#myset_cfwhite").value = r.myset_cfwhite||"";
|
||||
//ADVANCED
|
||||
if (r.myset_xincapsula=='y'){document.querySelector("#myset_xincapsula").checked=true;}else{document.querySelector("#myset_xincapsula").checked=false;}
|
||||
if (r.myset_xgshield=='y'){document.querySelector("#myset_xgshield").checked=true;}else{document.querySelector("#myset_xgshield").checked=false;}
|
||||
if (r.myset_xsucuri=='y'){document.querySelector("#myset_xsucuri").checked=true;}else{document.querySelector("#myset_xsucuri").checked=false;}
|
||||
if (r.myset_xignhttp=='y'){document.querySelector("#myset_xignhttp").checked=true;}else{document.querySelector("#myset_xignhttp").checked=false;}
|
||||
if (r.myset_xigncj=='y'){document.querySelector("#myset_xigncj").checked=true;}else{document.querySelector("#myset_xigncj").checked=false;}
|
||||
if (r.myset_xsimplewarn=='y'){document.querySelector("#myset_xsimplewarn").checked=true;}else{document.querySelector("#myset_xsimplewarn").checked=false;}
|
||||
}
|
||||
function onError(e){console.log(`CFMITM_CFG Error:${e}`);}
|
||||
var getting=browser.storage.local.get();
|
||||
getting.then(setCurrentChoice, onError);
|
||||
}
|
||||
document.addEventListener("DOMContentLoaded", loadWhitelist);
|
||||
document.querySelector("form").addEventListener("submit", saveWhitelist);
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue