aboutsummaryrefslogtreecommitdiff
path: root/Outlook Safelinks.wiki
blob: 2930f27455bb2775ea1175063ed513aac632717c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
%title Outlook Safelinks

A quick decoder for Outlooks safelinks "protection"

{{{scheme
(use-modules (web uri)
             (ice-9 regex))

(define uri (string->uri "https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgoogle.com%2F%3Fp1%3Dhello%26p2%3Dworld&data=04%7C01%7Chugo.hornquist%40liu.se%7C07769d4323fa49da8ae908d9b6569ce9%7C913f18ec7f264c5fa816784fe9a58edd%7C0%7C0%7C637741305400535204%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=nJBoGaNj2Ub58jLFpsMwhEdt6DH1m%2BMbyrFa7Qj5iBI%3D&reserved=0"))

(define decoded (uri-decode (uri-query uri)))

(write decoded) (newline)

(define components
  (map (lambda (kv)
         (define idx (string-index kv #\=))
         (cons (string->symbol (string-take kv idx))
               (string-drop kv (1+ idx))))
       (string-split

         (regexp-substitute/global
           #f (make-regexp "&") decoded
           'pre (string #\us) 'post)
         #\us))
  )
}}}



{{{scheme
(write (string-split (assoc-ref components 'data) #\|))
}}}

0  :: "04"
1  :: "01"
2  :: from email
3  :: uid?
4  :: uid?
5  :: "0"
6  :: "0"
7  :: uid?
8  :: "Unknown"
9  ::
10 :: "2000"