2019-08-10 19:11:08 +00:00
|
|
|
# [Unsanitize Safelinks](https://git.logicalhacking.com/adbrucker/unsanitize-safelinks): A Utility for Microsoft's Safelinks
|
2019-08-09 07:31:26 +00:00
|
|
|
|
2022-03-23 21:52:02 +00:00
|
|
|
Both the home/personal online offerings of Microsoft Outlook (e.g., Outlook.com, Office 365 Home,
|
2019-08-10 13:09:48 +00:00
|
|
|
or Office 365 Personal) and the professional Office 365 offerings (e.g., as part of Office 365 Advanced
|
|
|
|
Threat Detection) might rewrite links in received emails with the goal of protecting users against
|
2022-03-23 21:52:02 +00:00
|
|
|
certain threats (e.g., phishing).
|
2019-08-09 07:31:26 +00:00
|
|
|
|
2022-03-23 21:52:02 +00:00
|
|
|
For various reasons, one might to rewrite these "safelinks" back into their original form. The script
|
2019-08-10 13:09:48 +00:00
|
|
|
[unsantize-safelinks](./unsantize-safelinks) does exactly this. This can, for example, be used for
|
2019-08-20 17:52:01 +00:00
|
|
|
displaying mails nicely in [mutt](https://www.mutt.org) or other text-based mail programs. In your
|
|
|
|
".muttrc" you need to add/edit the following configuration:
|
2019-08-09 07:31:26 +00:00
|
|
|
|
2019-08-10 13:09:48 +00:00
|
|
|
```muttrc
|
|
|
|
set display_filter="unsanitize-safelinks"
|
|
|
|
```
|
|
|
|
|
|
|
|
If you want to also rewrite the links when using tools such as urlscan, use:
|
|
|
|
|
|
|
|
```muttrc
|
|
|
|
macro index,pager \cb "<pipe-message> unsanitize-safelinks| urlscan<Enter>"
|
|
|
|
```
|
|
|
|
|
|
|
|
And the following trick rewrites the links prior to editing a message (e.g., when replying):
|
|
|
|
|
|
|
|
```muttrc
|
|
|
|
set editor ="unsanitize-safelinks -i %s && $EDITOR %s"
|
|
|
|
```
|
|
|
|
|
|
|
|
Finally, if links should be rewritten when viewing the HTML-part, you need to edit your your ".mailcap"
|
|
|
|
entry for type "text/html":
|
|
|
|
|
|
|
|
```mailcap
|
|
|
|
text/html; unsanitize-safelinks -i --html %s && /usr/bin/sensible-browser %s; description=HTML Text; nametemplate=%s.html
|
|
|
|
```
|
2019-08-09 07:31:26 +00:00
|
|
|
|
|
|
|
## Author
|
|
|
|
|
|
|
|
* [Achim D. Brucker](http://www.brucker.ch/)
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
This project is licensed under a 2-clause BSD license.
|
|
|
|
|
|
|
|
SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
2022-03-12 17:21:51 +00:00
|
|
|
## Upstream Repository
|
2019-08-09 07:31:26 +00:00
|
|
|
|
2022-03-12 17:21:51 +00:00
|
|
|
The upstream git repository, i.e., the single source of truth, for this
|
|
|
|
project is hosted by the [Software Assurance & Security Research
|
|
|
|
Team](https://logicalhacking.com) at
|
2019-08-10 19:02:30 +00:00
|
|
|
<https://git.logicalhacking.com/adbrucker/unsanitize-safelinks>.
|