-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathbrowser_azure_data.py
More file actions
94 lines (85 loc) · 5.36 KB
/
browser_azure_data.py
File metadata and controls
94 lines (85 loc) · 5.36 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
code: str = "helloworld"
state: str = "abcdefghij"
valid_response: bytes = (
b"POST /redshift/ HTTP/1.1\r\nHost: localhost:51187\r\nConnection: keep-alive\r\nContent-Length: 695\r\n"
b"Cache-Control: max-age=0\r\nUpgrade-Insecure-Requests: 1\r\nOrigin: null\r\n"
b"Content-Type: application/x-www-form-urlencoded\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
b"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36\r\nAccept: text/html,"
b"application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,"
b"application/signed-exchange;v=b3;q=0.9\r\nSec-Fetch-Site: cross-site\r\nSec-Fetch-Mode: navigate\r\n"
b"Sec-Fetch-Dest: document\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: en-US,en;q=0.9\r\n"
b"\r\ncode=" + code.encode("utf-8") + b"&state=" + state.encode("utf-8") + b"&session_state=hooplah"
)
missing_state_response: bytes = (
b"POST /redshift/ HTTP/1.1\r\nHost: localhost:51187\r\nConnection: keep-alive\r\nContent-Length: 695\r\n"
b"Cache-Control: max-age=0\r\nUpgrade-Insecure-Requests: 1\r\nOrigin: null\r\n"
b"Content-Type: application/x-www-form-urlencoded\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
b"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36\r\nAccept: text/html,"
b"application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,"
b"application/signed-exchange;v=b3;q=0.9\r\nSec-Fetch-Site: cross-site\r\nSec-Fetch-Mode: navigate\r\n"
b"Sec-Fetch-Dest: document\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: en-US,en;q=0.9\r\n"
b"\r\ncode=" + code.encode("utf-8")
)
mismatched_state_response: bytes = (
b"POST /redshift/ HTTP/1.1\r\nHost: localhost:51187\r\nConnection: keep-alive\r\nContent-Length: 695\r\n"
b"Cache-Control: max-age=0\r\nUpgrade-Insecure-Requests: 1\r\nOrigin: null\r\n"
b"Content-Type: application/x-www-form-urlencoded\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
b"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36\r\nAccept: text/html,"
b"application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,"
b"application/signed-exchange;v=b3;q=0.9\r\nSec-Fetch-Site: cross-site\r\nSec-Fetch-Mode: navigate\r\n"
b"Sec-Fetch-Dest: document\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: en-US,en;q=0.9\r\n"
b"\r\ncode=" + code.encode("utf-8") + b"&state=" + state[::-1].encode("utf-8") + b"&session_state=hooplah"
)
missing_code_response: bytes = (
b"POST /redshift/ HTTP/1.1\r\nHost: localhost:51187\r\nConnection: keep-alive\r\nContent-Length: 695\r\n"
b"Cache-Control: max-age=0\r\nUpgrade-Insecure-Requests: 1\r\nOrigin: null\r\n"
b"Content-Type: application/x-www-form-urlencoded\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
b"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36\r\nAccept: text/html,"
b"application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,"
b"application/signed-exchange;v=b3;q=0.9\r\nSec-Fetch-Site: cross-site\r\nSec-Fetch-Mode: navigate\r\n"
b"Sec-Fetch-Dest: document\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: en-US,en;q=0.9\r\n"
b"&state=" + state.encode("utf-8") + b"&session_state=hooplah"
)
empty_code_response: bytes = (
b"POST /redshift/ HTTP/1.1\r\nHost: localhost:51187\r\nConnection: keep-alive\r\nContent-Length: 695\r\n"
b"Cache-Control: max-age=0\r\nUpgrade-Insecure-Requests: 1\r\nOrigin: null\r\n"
b"Content-Type: application/x-www-form-urlencoded\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
b"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36\r\nAccept: text/html,"
b"application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,"
b"application/signed-exchange;v=b3;q=0.9\r\nSec-Fetch-Site: cross-site\r\nSec-Fetch-Mode: navigate\r\n"
b"Sec-Fetch-Dest: document\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: en-US,en;q=0.9\r\n"
b"\r\ncode=" + b"&state=" + state.encode("utf-8") + b"&session_state=hooplah"
)
saml_response = b"\"my_access_token\"".decode("utf-8")
valid_json_response: dict = {
"token_type": "Bearer",
"expires_in": "3599",
"ext_expires_in": "3599",
"expires_on": "1602782647",
"resource": "spn:1234567891011121314151617181920",
"access_token": "Im15X2FjY2Vzc190b2tlbiI=", # base64.urlsafe_64encode(saml_response)
"issued_token_type": "urn:ietf:params:oauth:token-type:saml2",
"refresh_token": "my_refresh_token",
"id_token": "my_id_token",
}
json_response_no_access_token: dict = {
"token_type": "Bearer",
"expires_in": "3599",
"ext_expires_in": "3599",
"expires_on": "1602782647",
"resource": "spn:1234567891011121314151617181920",
"issued_token_type": "urn:ietf:params:oauth:token-type:saml2",
"refresh_token": "my_refresh_token",
"id_token": "my_id_token",
}
json_response_empty_access_token: dict = {
"token_type": "Bearer",
"expires_in": "3599",
"ext_expires_in": "3599",
"expires_on": "1602782647",
"resource": "spn:1234567891011121314151617181920",
"access_token": "",
"issued_token_type": "urn:ietf:params:oauth:token-type:saml2",
"refresh_token": "my_refresh_token",
"id_token": "my_id_token",
}