-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from phavekes/feature/TB78
Switch to messageDisplayScripts to be compatible with TB78
- Loading branch information
Showing
11 changed files
with
80 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/bin/sh | ||
|
||
NAME=unmangleOutlookSafelinks | ||
VERSION=2.0.2 | ||
VERSION=3.0.0 | ||
rm -Rf */*~ | ||
|
||
ZIPFILE=${NAME}-${VERSION}.xpi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
let registeredScripts = browser.messageDisplayScripts.register({ | ||
js: [{ | ||
file: "display.js" | ||
}, ], | ||
}); | ||
console.log('Registerd messageDisplayScript; unmangle outlook safelinks ready.'); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
//loop over all html links | ||
function unmangleAllLinks() { | ||
var links = document.body.getElementsByTagName("a"); | ||
for (var i = 0; i < links.length; i++) { | ||
unmangleLink(links[i]); | ||
} | ||
} | ||
|
||
//fix a link | ||
function unmangleLink(a) { | ||
if (a.hostname.endsWith('safelinks.protection.outlook.com') == false) { | ||
return; | ||
} | ||
//remember original url | ||
var orgUrl = a.href; | ||
|
||
var doInner = false; | ||
|
||
// This is a pretty lame test | ||
if (a.innerHTML.includes('safelinks.protection.outlook.com')) { | ||
doInner = true; | ||
} | ||
|
||
var terms = a.search.replace(/^\?/, '').split('&'); | ||
|
||
for (var i = 0; i < terms.length; i++) { | ||
var s = terms[i].split('='); | ||
if (s[0] == 'url') { | ||
a.href = decodeURIComponent(s[1]); | ||
a.title = "Outlook Unmangled from: " + orgUrl; | ||
console.log("Rewrote "+orgUrl+" to "+a.href); | ||
|
||
if (doInner) { | ||
a.textContent = a.href; | ||
} | ||
return; | ||
} | ||
} | ||
} | ||
|
||
function decodeURI(match, p1, offset, string) { | ||
return decodeURIComponent(p1); | ||
} | ||
|
||
function unmangleContent(text) { | ||
text = text.replace(/https:\/\/[^\.]+\.safelinks\.protection\.outlook\.com\/\?url=([^&]*)&[^>\s]*/g, decodeURI); | ||
return text; | ||
} | ||
|
||
console.log("Start unmangle links") | ||
//First, unmangle the links | ||
unmangleAllLinks() | ||
//Then unmangle any texts : | ||
//document.body.innerHTML = unmangleContent(document.body.innerHTML); |
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "Unmangle Outlook Safelinks", | ||
"description": "Thunderbird plugin to unmangle Outlook Protection Safelinks\n\nBased upon https://github.com/mbattersby/unmangleOutlookSafelinks\nOriginal version by [email protected]\n\nUsers of Office365 who have Advanced Thread Protection enabled will change\nall URL's in emails to redirect them to an Microsoft filter before opening.\nThis will leak information to Microsoft and makes it impossible to see if\nthe original URL was safe to open.\n\nE.g. a link to\n\thttp://phishingsite.fake.ru/you/are/hacked.php \nwill show as\n\thttps://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fphishingsite.fake.ru%2Fyou%2Fare%2Fhacked.phpdata=02%7C01%7Csender.mail%40domain.tld%7C8177af7905a4406ecae208d5dc1fb7c9%7C87c50b582ef2423da4dbaedde7c84efcfa%7C0%7C0%7C63453351150545403+sdata=Te0O1xGxxxULxdzbxQ%2xxxyql2QjTt4Ken%2F00JB%2BV%2FPUA%3D+reserved=0\n\nand will not be recognized by a user as dangerous.\n\nThis plugin will change the URL back to the original value.\n\nContributors:\nPeter Havekes - [email protected]\nJan Kiszka - [email protected]\nPetros Koutsolampros", | ||
"version": "3.0.0", | ||
"author": "Peter Havekes", | ||
"applications": { | ||
"gecko": { | ||
"id": "[email protected]", | ||
"strict_min_version": "68.0" | ||
"strict_min_version": "78.0" | ||
} | ||
}, | ||
"name": "Unmangle Outlook Safelinks", | ||
"author": "[email protected]", | ||
"developer": { | ||
"name": "Peter Havekes" | ||
}, | ||
"homepage_url": "https://github.com/phavekes/unmangleOutlookSafelinks", | ||
"description": "Thunderbird plugin to unmangle Outlook Protection Safelinks\n\nBased upon https://github.com/mbattersby/unmangleOutlookSafelinks\nOriginal version by [email protected]\n\nUsers of Office365 who have Advanced Thread Protection enabled will change\nall URL's in emails to redirect them to an Microsoft filter before opening.\nThis will leak information to Microsoft and makes it impossible to see if\nthe original URL was safe to open.\n\nE.g. a link to\n\thttp://phishingsite.fake.ru/you/are/hacked.php \nwill show as\n\thttps://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fphishingsite.fake.ru%2Fyou%2Fare%2Fhacked.phpdata=02%7C01%7Csender.mail%40domain.tld%7C8177af7905a4406ecae208d5dc1fb7c9%7C87c50b582ef2423da4dbaedde7c84efcfa%7C0%7C0%7C63453351150545403+sdata=Te0O1xGxxxULxdzbxQ%2xxxyql2QjTt4Ken%2F00JB%2BV%2FPUA%3D+reserved=0\n\nand will not be recognized by a user as dangerous.\n\nThis plugin will change the URL back to the original value.\n\nContributors:\nPeter Havekes - [email protected]\nJan Kiszka - [email protected]\nPetros Koutsolampros", | ||
"version": "2.0.2", | ||
"icons": { | ||
"32": "chrome/content/icon.png" | ||
"64": "images/icon64.png", | ||
"48": "images/icon48.png" | ||
}, | ||
"background": { | ||
"scripts": [ | ||
"background.js" | ||
] | ||
}, | ||
"legacy": { | ||
"type" : "bootstrap" | ||
} | ||
"permissions": [ | ||
"messagesModify", | ||
"messagesRead" | ||
] | ||
} |
Binary file not shown.