graphspy 1.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. graphspy-1.6.1/PKG-INFO +272 -0
  2. graphspy-1.6.1/README.md +257 -0
  3. graphspy-1.6.1/pyproject.toml +27 -0
  4. graphspy-1.6.1/src/graphspy/__init__.py +17 -0
  5. graphspy-1.6.1/src/graphspy/__main__.py +9 -0
  6. graphspy-1.6.1/src/graphspy/cli.py +2835 -0
  7. graphspy-1.6.1/src/graphspy/static/css/style.css +95 -0
  8. graphspy-1.6.1/src/graphspy/static/js/functions.js +1222 -0
  9. graphspy-1.6.1/src/graphspy/static/js/purify.min.js +3 -0
  10. graphspy-1.6.1/src/graphspy/static/js/theme.js +74 -0
  11. graphspy-1.6.1/src/graphspy/templates/OneDrive.html +235 -0
  12. graphspy-1.6.1/src/graphspy/templates/SharePoint.html +253 -0
  13. graphspy-1.6.1/src/graphspy/templates/SharePointDrives.html +139 -0
  14. graphspy-1.6.1/src/graphspy/templates/SharePointSites.html +144 -0
  15. graphspy-1.6.1/src/graphspy/templates/access_token_modal.html +152 -0
  16. graphspy-1.6.1/src/graphspy/templates/access_tokens.html +384 -0
  17. graphspy-1.6.1/src/graphspy/templates/custom_requests.html +450 -0
  18. graphspy-1.6.1/src/graphspy/templates/device_certificates.html +351 -0
  19. graphspy-1.6.1/src/graphspy/templates/device_codes.html +339 -0
  20. graphspy-1.6.1/src/graphspy/templates/entra_users.html +286 -0
  21. graphspy-1.6.1/src/graphspy/templates/generic_search.html +183 -0
  22. graphspy-1.6.1/src/graphspy/templates/index.html +32 -0
  23. graphspy-1.6.1/src/graphspy/templates/layout.html +352 -0
  24. graphspy-1.6.1/src/graphspy/templates/mfa.html +842 -0
  25. graphspy-1.6.1/src/graphspy/templates/outlook.html +41 -0
  26. graphspy-1.6.1/src/graphspy/templates/outlook_graph.html +1430 -0
  27. graphspy-1.6.1/src/graphspy/templates/primary_refresh_tokens.html +366 -0
  28. graphspy-1.6.1/src/graphspy/templates/recent_files.html +145 -0
  29. graphspy-1.6.1/src/graphspy/templates/refresh_token_modal.html +122 -0
  30. graphspy-1.6.1/src/graphspy/templates/refresh_tokens.html +184 -0
  31. graphspy-1.6.1/src/graphspy/templates/settings.html +182 -0
  32. graphspy-1.6.1/src/graphspy/templates/shared_with_me.html +145 -0
  33. graphspy-1.6.1/src/graphspy/templates/teams.html +707 -0
  34. graphspy-1.6.1/src/graphspy/templates/winhello_keys.html +319 -0
@@ -0,0 +1,272 @@
1
+ Metadata-Version: 2.3
2
+ Name: graphspy
3
+ Version: 1.6.1
4
+ Summary: Initial Access and Post-Exploitation Tool for AAD and O365 with a browser-based GUI.
5
+ Author: RedByte1337
6
+ License: BSD-3-Clause
7
+ Requires-Dist: flask>=3.0.0,<4.0.0
8
+ Requires-Dist: pyjwt>=2.8.0,<3.0.0
9
+ Requires-Dist: requests>=2.30.0,<3.0.0
10
+ Requires-Dist: pyotp>=2.9.0,<3.0.0
11
+ Requires-Dist: fido2>=1.1.0,<3.0.0
12
+ Requires-Python: >=3.10, <4.0
13
+ Project-URL: repository, https://github.com/RedByte1337/GraphSpy
14
+ Description-Content-Type: text/markdown
15
+
16
+ [![PyPi Version](https://img.shields.io/pypi/v/GraphSpy.svg)](https://pypi.org/project/GraphSpy/)
17
+ ![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)
18
+ [![GitHub Sponsors](https://img.shields.io/github/sponsors/RedByte1337?style=flat&logo=githubsponsors)](https://github.com/sponsors/RedByte1337)
19
+ [![Twitter](https://img.shields.io/twitter/follow/RedByte1337?label=RedByte1337&style=social)](https://twitter.com/intent/follow?screen_name=RedByte1337)
20
+ [![LinkedIn](https://img.shields.io/badge/in-Keanu_Nys-white?style=flat&logoColor=blue&labelColor=blue)](https://www.linkedin.com/in/keanunys/)
21
+
22
+ # GraphSpy
23
+
24
+ ```
25
+ ________ _________
26
+ / / by RedByte1337 __ / /
27
+ / _____/___________ ______ | |__ / _____/_____ ______
28
+ / \ __\_ __ \__ \ \____ \| | \ \_____ \\____ \ | |
29
+ \ \_\ \ | \/ __ \| |_> | \ \/ \ |_> \___ |
30
+ \______ /__| |____ | __/|___| /_______ / ___/ ____|
31
+ \/ \/|__| \/ \/|__| \/
32
+ ```
33
+
34
+ # Table of Contents
35
+
36
+ - [GraphSpy](#graphspy)
37
+ - [Table of Contents](#table-of-contents)
38
+ - [Quick Start](#quick-start)
39
+ - [Installation](#installation)
40
+ - [Execution](#execution)
41
+ - [Usage](#usage)
42
+ - [Features](#features)
43
+ - [Release Notes](#release-notes)
44
+ - [Upcoming Features](#upcoming-features)
45
+ - [Sponsors](#sponsors)
46
+ - [Credits](#credits)
47
+
48
+ # Quick Start
49
+
50
+ ## Installation
51
+
52
+ The following goes over the recommended installation process using pipx to avoid any dependency conflicts.
53
+
54
+ GraphSpy is built to work on every operating system, although it was mainly tested on Linux and Windows.
55
+
56
+ For other installation options and detailed instructions, check the [Installation page](https://github.com/RedByte1337/GraphSpy/wiki/Installation) on the wiki.
57
+
58
+ ```bash
59
+ # Install pipx (skip this if you already have it)
60
+ apt install pipx
61
+ pipx ensurepath
62
+
63
+ # Install the latest version of GraphSpy from pypi
64
+ pipx install graphspy
65
+ ```
66
+
67
+ ## Execution
68
+
69
+ After installation, the application can be launched using the `graphspy` command from any location on the system.
70
+
71
+ Running GraphSpy without any command line arguments will launch GraphSpy and make it available at `http://127.0.0.1:5000` by default.
72
+
73
+ ```bash
74
+ graphspy
75
+ ```
76
+
77
+ Now simply open `http://127.0.0.1:5000` in your favorite browser to get started!
78
+
79
+ Use the `-i` and `-p` arguments to modify the interface and port to listen on.
80
+
81
+ ```bash
82
+ # Run GraphSpy on http://192.168.0.10
83
+ graphspy -i 192.168.0.10 -p 80
84
+ # Run GraphSpy on port 8080 on all interfaces
85
+ graphspy -i 0.0.0.0 -p 8080
86
+ ```
87
+
88
+ For detailed instructions and other command line arguments, please refer to the [Execution page](https://github.com/RedByte1337/GraphSpy/wiki/Execution) on the wiki.
89
+
90
+ ## Usage
91
+
92
+ Please refer to the [GitHub Wiki](https://github.com/RedByte1337/GraphSpy/wiki) for full usage details.
93
+
94
+ For a quick feature overview, check out the [official release blog post](https://insights.spotit.be/2024/04/05/graphspy-the-swiss-army-knife-for-attacking-m365-entra/).
95
+
96
+ # Features
97
+
98
+ ## Access and Refresh Tokens
99
+
100
+ Store your access and refresh tokens for multiple users and scopes in one location.
101
+
102
+ ![Access Tokens](images/access_tokens_1.png)
103
+
104
+ ![Refresh Tokens](images/refresh_tokens.png)
105
+
106
+ Easily switch between them or request new access tokens from any page.
107
+
108
+ ![Token Side Bar](images/token_side_bar_1.png)
109
+
110
+ ## Device Codes
111
+
112
+ Easily create and poll multiple device codes at once. If a user used the device code to authenticate, GraphSpy will automatically store the access and refresh token in its database.
113
+
114
+ ![Device Codes](images/device_codes.png)
115
+
116
+ Configure automatic actions to take place instantly after a successful device code authentication.
117
+ 1. **Device PRT:** Register/join a new device to Entra ID, obtain the device certificate, and use it to generate a [Primary Refresh Token (PRT)](#primary-refresh-tokens-prts)
118
+ 2. **Winhello:** Everything in Device PRT + try to enroll the fake device with Windows Hello For Business (whfb) to obtain [WinHello keys](#windows-hello-for-business).
119
+ 3. More to come later...
120
+
121
+ ![Device Code Winhello Action](images/device_code_winhello_action.png)
122
+
123
+ ## MFA Methods
124
+
125
+ View, modify and create MFA methods linked to the account of the user.
126
+
127
+ ![MFA Methods Overview](images/mfa_methods_overview.png)
128
+
129
+ The following MFA methods can be added from GraphSpy to set up persistance:
130
+ - Microsoft Authenticator App
131
+ - Custom OTP App, or use GraphSpy as OTP app to generate TOTP codes on the fly!
132
+ - FIDO Security Keys!
133
+ - Alternative email address
134
+ - Mobile/Office/Alternative Phones (SMS or call)
135
+
136
+ ![MFA Methods FIDO](images/mfa_methods_fido.png)
137
+
138
+ ## Primary Refresh Tokens (PRTs)
139
+
140
+ Request, import or use primary refresh tokens from within GraphSpy.
141
+
142
+ These PRTs are a lot more powerful than regular refresh tokens, since these are not bound to one specific application, but can instead be used to obtain access tokens for ANY application/scope as the user (both FOCI and non-FOCI ones).
143
+
144
+ ![PRT Overview](images/primary_refresh_tokens_overview.png)
145
+
146
+ Additionally, these PRT tokens can be used to generate PRT Cookies, which can be imported directly in a browser to provide a full interactive access to any web application integrated with Entra ID SSO.
147
+
148
+ ![PRT Cookies](images/primary_refresh_tokens_cookie.png)
149
+
150
+ ## Windows Hello For Business
151
+
152
+ Register Windows Hello For Business (whfb) keys in GraphSpy for a user & device combination, or import them from a different tool or a compromised device.
153
+
154
+ These WinHello keys can be used to generate new Primary Refresh Tokens for the user, even after password password resets, making them very powerful account persistence!
155
+
156
+ ![Winhello Keys](images/winhello_keys.png)
157
+
158
+ ## Files and SharePoint
159
+
160
+ Browse through files and folders in the user's OneDrive or any accessible SharePoint site through an intuitive file explorer interface.
161
+
162
+ Of course, files can also be directly downloaded, or new files can be uploaded.
163
+
164
+ ![OneDrive](images/onedrive_2.png)
165
+
166
+ Additionally, list the user's recently accessed files or files shared with the user.
167
+
168
+ ![Recent Files](images/recent_files.png)
169
+
170
+ ## Outlook
171
+
172
+ Open the user's Outlook web mail with a single click using just an Outlook access token (FOCI)!
173
+
174
+ ![Outlook GraphSpy](images/outlook_1.png)
175
+
176
+ ![Outlook](images/outlook_2.png)
177
+
178
+ Or use the Outlook Graph module to list, read, search, delete, reply or send emails with just an access token for the MS Graph API!
179
+
180
+ ![Outlook Graph Overview](images/outlook_graph_overview.png)
181
+
182
+ Craft completely HTML formated emails directly in GraphSpy and include images and attachments.
183
+
184
+ ![Outlook Graph Overview](images/outlook_graph_send_email.png)
185
+
186
+ ## MS Teams
187
+
188
+ Read and send messages using the Microsoft Teams module with a FOCI access token of the skype API (https://api.spaces.skype.com/).
189
+
190
+ ![MS Teams GraphSpy](images/ms_teams.png)
191
+
192
+ ## Graph Searching
193
+
194
+ Search for keywords through all Microsoft 365 applications using the Microsoft Search API.
195
+
196
+ For instance, use this to search for any files or emails containing keywords such as "password", "secret", ...
197
+
198
+ ![Graph Search](images/graph_search_2.png)
199
+
200
+ ## Custom Requests
201
+
202
+ Perform custom API requests towards any endpoint using access tokens stored in GraphSpy.
203
+
204
+ ![Custom Request](images/custom_requests.png)
205
+
206
+ Custom request templates with variables can be stored in the database to allow easy reuse of common custom API requests.
207
+
208
+ ![Custom Request](images/custom_request_templates.png)
209
+
210
+ ## Entra ID
211
+
212
+ List all Entra ID users and their properties using the Microsoft Graph API.
213
+
214
+ ![Entra Users Overview](images/entra_users_overview.png)
215
+
216
+ View additional details for a user, such as its group memberships, role assignments, devices, app roles and API permissions.
217
+
218
+ ![Entra Users Details](images/entra_users_details_1.png)
219
+
220
+ ## Multiple Databases
221
+
222
+ GraphSpy supports multiple databases. This is useful when working on multiple assessments at once to keep your tokens and device codes organized.
223
+
224
+ ![Graph Request](images/settings.png)
225
+
226
+ ## Dark Mode
227
+
228
+ Use the dark mode by default, or switch to light mode.
229
+
230
+ # Release Notes
231
+
232
+ Refer to the [Release Notes](https://github.com/RedByte1337/GraphSpy/wiki/Release-Notes) page on the GitHub Wiki
233
+
234
+ # Upcoming Features
235
+
236
+ * Rename files and create folders
237
+ * More authentication options
238
+ * Password, ESTSAuth Cookie, PRT, ...
239
+ * Automatic Access Token Refreshing
240
+ * Improve Microsoft Teams Module
241
+ * Download authenticated files
242
+ * Upload files and images
243
+ * Entra ID
244
+ * List Users, Groups, Applications, Devices, Conditional Access Policies, ...
245
+ * Cleaner exception handling
246
+ * While this should not have any direct impact on the user, edge cases might currently throw exceptions to the GraphSpy output instead of handling them in a cleaner way.
247
+
248
+ # Sponsors
249
+
250
+ Do you or your organization want to be featured as a key sponsor of this project here, or even mentioned within GraphSpy itself? Or do you just like GraphSpy and want to support my work?
251
+
252
+ Please check out my [Sponsor page](https://github.com/sponsors/RedByte1337).
253
+
254
+ _If you do not have the means to sponsor, but you still want to show your gratitude, feel free to add a star instead._ ⭐
255
+
256
+ # Credits
257
+
258
+ The main motivation for creating GraphSpy was the lack of an easy to use way to perform post-compromise activities targetting Office365 applications (such as Outlook, Microsoft Teams, OneDrive, SharePoint, ...) with just an access token.
259
+
260
+ While several command-line tools existed which provided some basic functionality, none of them came close to the intuitive interactive experience which the original applications provide (such as the file explorer-like interface of OneDrive and SharePoint).
261
+
262
+ However, a lot of previous research was done by countless other persons (specifically regarding Device Code Phishing, which lead to the initial requirement for such a tool in the first place).
263
+
264
+ * Acknowledgements
265
+ * [TokenTactics](https://github.com/rvrsh3ll/TokenTactics) and [TokenTacticsV2](https://github.com/f-bader/TokenTacticsV2)
266
+ * [AADInternals](https://github.com/Gerenios/AADInternals)
267
+ * [Introducing a new phishing technique for compromising Office 365 accounts](https://aadinternals.com/post/phishing/)
268
+ * [The Art of the Device Code Phish](https://0xboku.com/2021/07/12/ArtOfDeviceCodePhish.html)
269
+ * [GraphRunner](https://github.com/dafthack/GraphRunner) is a PowerShell tool with a lot of similar features, which was released while GraphSpy was already in development. Regardless, both tools still have their distinguishing factors.
270
+ * [Roadtools](https://github.com/dirkjanm/ROADtools) by the awesome Dirk-Jan Mollema
271
+ * Assets
272
+ * UIcons by [Flaticon](https://www.flaticon.com/uicons)
@@ -0,0 +1,257 @@
1
+ [![PyPi Version](https://img.shields.io/pypi/v/GraphSpy.svg)](https://pypi.org/project/GraphSpy/)
2
+ ![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)
3
+ [![GitHub Sponsors](https://img.shields.io/github/sponsors/RedByte1337?style=flat&logo=githubsponsors)](https://github.com/sponsors/RedByte1337)
4
+ [![Twitter](https://img.shields.io/twitter/follow/RedByte1337?label=RedByte1337&style=social)](https://twitter.com/intent/follow?screen_name=RedByte1337)
5
+ [![LinkedIn](https://img.shields.io/badge/in-Keanu_Nys-white?style=flat&logoColor=blue&labelColor=blue)](https://www.linkedin.com/in/keanunys/)
6
+
7
+ # GraphSpy
8
+
9
+ ```
10
+ ________ _________
11
+ / / by RedByte1337 __ / /
12
+ / _____/___________ ______ | |__ / _____/_____ ______
13
+ / \ __\_ __ \__ \ \____ \| | \ \_____ \\____ \ | |
14
+ \ \_\ \ | \/ __ \| |_> | \ \/ \ |_> \___ |
15
+ \______ /__| |____ | __/|___| /_______ / ___/ ____|
16
+ \/ \/|__| \/ \/|__| \/
17
+ ```
18
+
19
+ # Table of Contents
20
+
21
+ - [GraphSpy](#graphspy)
22
+ - [Table of Contents](#table-of-contents)
23
+ - [Quick Start](#quick-start)
24
+ - [Installation](#installation)
25
+ - [Execution](#execution)
26
+ - [Usage](#usage)
27
+ - [Features](#features)
28
+ - [Release Notes](#release-notes)
29
+ - [Upcoming Features](#upcoming-features)
30
+ - [Sponsors](#sponsors)
31
+ - [Credits](#credits)
32
+
33
+ # Quick Start
34
+
35
+ ## Installation
36
+
37
+ The following goes over the recommended installation process using pipx to avoid any dependency conflicts.
38
+
39
+ GraphSpy is built to work on every operating system, although it was mainly tested on Linux and Windows.
40
+
41
+ For other installation options and detailed instructions, check the [Installation page](https://github.com/RedByte1337/GraphSpy/wiki/Installation) on the wiki.
42
+
43
+ ```bash
44
+ # Install pipx (skip this if you already have it)
45
+ apt install pipx
46
+ pipx ensurepath
47
+
48
+ # Install the latest version of GraphSpy from pypi
49
+ pipx install graphspy
50
+ ```
51
+
52
+ ## Execution
53
+
54
+ After installation, the application can be launched using the `graphspy` command from any location on the system.
55
+
56
+ Running GraphSpy without any command line arguments will launch GraphSpy and make it available at `http://127.0.0.1:5000` by default.
57
+
58
+ ```bash
59
+ graphspy
60
+ ```
61
+
62
+ Now simply open `http://127.0.0.1:5000` in your favorite browser to get started!
63
+
64
+ Use the `-i` and `-p` arguments to modify the interface and port to listen on.
65
+
66
+ ```bash
67
+ # Run GraphSpy on http://192.168.0.10
68
+ graphspy -i 192.168.0.10 -p 80
69
+ # Run GraphSpy on port 8080 on all interfaces
70
+ graphspy -i 0.0.0.0 -p 8080
71
+ ```
72
+
73
+ For detailed instructions and other command line arguments, please refer to the [Execution page](https://github.com/RedByte1337/GraphSpy/wiki/Execution) on the wiki.
74
+
75
+ ## Usage
76
+
77
+ Please refer to the [GitHub Wiki](https://github.com/RedByte1337/GraphSpy/wiki) for full usage details.
78
+
79
+ For a quick feature overview, check out the [official release blog post](https://insights.spotit.be/2024/04/05/graphspy-the-swiss-army-knife-for-attacking-m365-entra/).
80
+
81
+ # Features
82
+
83
+ ## Access and Refresh Tokens
84
+
85
+ Store your access and refresh tokens for multiple users and scopes in one location.
86
+
87
+ ![Access Tokens](images/access_tokens_1.png)
88
+
89
+ ![Refresh Tokens](images/refresh_tokens.png)
90
+
91
+ Easily switch between them or request new access tokens from any page.
92
+
93
+ ![Token Side Bar](images/token_side_bar_1.png)
94
+
95
+ ## Device Codes
96
+
97
+ Easily create and poll multiple device codes at once. If a user used the device code to authenticate, GraphSpy will automatically store the access and refresh token in its database.
98
+
99
+ ![Device Codes](images/device_codes.png)
100
+
101
+ Configure automatic actions to take place instantly after a successful device code authentication.
102
+ 1. **Device PRT:** Register/join a new device to Entra ID, obtain the device certificate, and use it to generate a [Primary Refresh Token (PRT)](#primary-refresh-tokens-prts)
103
+ 2. **Winhello:** Everything in Device PRT + try to enroll the fake device with Windows Hello For Business (whfb) to obtain [WinHello keys](#windows-hello-for-business).
104
+ 3. More to come later...
105
+
106
+ ![Device Code Winhello Action](images/device_code_winhello_action.png)
107
+
108
+ ## MFA Methods
109
+
110
+ View, modify and create MFA methods linked to the account of the user.
111
+
112
+ ![MFA Methods Overview](images/mfa_methods_overview.png)
113
+
114
+ The following MFA methods can be added from GraphSpy to set up persistance:
115
+ - Microsoft Authenticator App
116
+ - Custom OTP App, or use GraphSpy as OTP app to generate TOTP codes on the fly!
117
+ - FIDO Security Keys!
118
+ - Alternative email address
119
+ - Mobile/Office/Alternative Phones (SMS or call)
120
+
121
+ ![MFA Methods FIDO](images/mfa_methods_fido.png)
122
+
123
+ ## Primary Refresh Tokens (PRTs)
124
+
125
+ Request, import or use primary refresh tokens from within GraphSpy.
126
+
127
+ These PRTs are a lot more powerful than regular refresh tokens, since these are not bound to one specific application, but can instead be used to obtain access tokens for ANY application/scope as the user (both FOCI and non-FOCI ones).
128
+
129
+ ![PRT Overview](images/primary_refresh_tokens_overview.png)
130
+
131
+ Additionally, these PRT tokens can be used to generate PRT Cookies, which can be imported directly in a browser to provide a full interactive access to any web application integrated with Entra ID SSO.
132
+
133
+ ![PRT Cookies](images/primary_refresh_tokens_cookie.png)
134
+
135
+ ## Windows Hello For Business
136
+
137
+ Register Windows Hello For Business (whfb) keys in GraphSpy for a user & device combination, or import them from a different tool or a compromised device.
138
+
139
+ These WinHello keys can be used to generate new Primary Refresh Tokens for the user, even after password password resets, making them very powerful account persistence!
140
+
141
+ ![Winhello Keys](images/winhello_keys.png)
142
+
143
+ ## Files and SharePoint
144
+
145
+ Browse through files and folders in the user's OneDrive or any accessible SharePoint site through an intuitive file explorer interface.
146
+
147
+ Of course, files can also be directly downloaded, or new files can be uploaded.
148
+
149
+ ![OneDrive](images/onedrive_2.png)
150
+
151
+ Additionally, list the user's recently accessed files or files shared with the user.
152
+
153
+ ![Recent Files](images/recent_files.png)
154
+
155
+ ## Outlook
156
+
157
+ Open the user's Outlook web mail with a single click using just an Outlook access token (FOCI)!
158
+
159
+ ![Outlook GraphSpy](images/outlook_1.png)
160
+
161
+ ![Outlook](images/outlook_2.png)
162
+
163
+ Or use the Outlook Graph module to list, read, search, delete, reply or send emails with just an access token for the MS Graph API!
164
+
165
+ ![Outlook Graph Overview](images/outlook_graph_overview.png)
166
+
167
+ Craft completely HTML formated emails directly in GraphSpy and include images and attachments.
168
+
169
+ ![Outlook Graph Overview](images/outlook_graph_send_email.png)
170
+
171
+ ## MS Teams
172
+
173
+ Read and send messages using the Microsoft Teams module with a FOCI access token of the skype API (https://api.spaces.skype.com/).
174
+
175
+ ![MS Teams GraphSpy](images/ms_teams.png)
176
+
177
+ ## Graph Searching
178
+
179
+ Search for keywords through all Microsoft 365 applications using the Microsoft Search API.
180
+
181
+ For instance, use this to search for any files or emails containing keywords such as "password", "secret", ...
182
+
183
+ ![Graph Search](images/graph_search_2.png)
184
+
185
+ ## Custom Requests
186
+
187
+ Perform custom API requests towards any endpoint using access tokens stored in GraphSpy.
188
+
189
+ ![Custom Request](images/custom_requests.png)
190
+
191
+ Custom request templates with variables can be stored in the database to allow easy reuse of common custom API requests.
192
+
193
+ ![Custom Request](images/custom_request_templates.png)
194
+
195
+ ## Entra ID
196
+
197
+ List all Entra ID users and their properties using the Microsoft Graph API.
198
+
199
+ ![Entra Users Overview](images/entra_users_overview.png)
200
+
201
+ View additional details for a user, such as its group memberships, role assignments, devices, app roles and API permissions.
202
+
203
+ ![Entra Users Details](images/entra_users_details_1.png)
204
+
205
+ ## Multiple Databases
206
+
207
+ GraphSpy supports multiple databases. This is useful when working on multiple assessments at once to keep your tokens and device codes organized.
208
+
209
+ ![Graph Request](images/settings.png)
210
+
211
+ ## Dark Mode
212
+
213
+ Use the dark mode by default, or switch to light mode.
214
+
215
+ # Release Notes
216
+
217
+ Refer to the [Release Notes](https://github.com/RedByte1337/GraphSpy/wiki/Release-Notes) page on the GitHub Wiki
218
+
219
+ # Upcoming Features
220
+
221
+ * Rename files and create folders
222
+ * More authentication options
223
+ * Password, ESTSAuth Cookie, PRT, ...
224
+ * Automatic Access Token Refreshing
225
+ * Improve Microsoft Teams Module
226
+ * Download authenticated files
227
+ * Upload files and images
228
+ * Entra ID
229
+ * List Users, Groups, Applications, Devices, Conditional Access Policies, ...
230
+ * Cleaner exception handling
231
+ * While this should not have any direct impact on the user, edge cases might currently throw exceptions to the GraphSpy output instead of handling them in a cleaner way.
232
+
233
+ # Sponsors
234
+
235
+ Do you or your organization want to be featured as a key sponsor of this project here, or even mentioned within GraphSpy itself? Or do you just like GraphSpy and want to support my work?
236
+
237
+ Please check out my [Sponsor page](https://github.com/sponsors/RedByte1337).
238
+
239
+ _If you do not have the means to sponsor, but you still want to show your gratitude, feel free to add a star instead._ ⭐
240
+
241
+ # Credits
242
+
243
+ The main motivation for creating GraphSpy was the lack of an easy to use way to perform post-compromise activities targetting Office365 applications (such as Outlook, Microsoft Teams, OneDrive, SharePoint, ...) with just an access token.
244
+
245
+ While several command-line tools existed which provided some basic functionality, none of them came close to the intuitive interactive experience which the original applications provide (such as the file explorer-like interface of OneDrive and SharePoint).
246
+
247
+ However, a lot of previous research was done by countless other persons (specifically regarding Device Code Phishing, which lead to the initial requirement for such a tool in the first place).
248
+
249
+ * Acknowledgements
250
+ * [TokenTactics](https://github.com/rvrsh3ll/TokenTactics) and [TokenTacticsV2](https://github.com/f-bader/TokenTacticsV2)
251
+ * [AADInternals](https://github.com/Gerenios/AADInternals)
252
+ * [Introducing a new phishing technique for compromising Office 365 accounts](https://aadinternals.com/post/phishing/)
253
+ * [The Art of the Device Code Phish](https://0xboku.com/2021/07/12/ArtOfDeviceCodePhish.html)
254
+ * [GraphRunner](https://github.com/dafthack/GraphRunner) is a PowerShell tool with a lot of similar features, which was released while GraphSpy was already in development. Regardless, both tools still have their distinguishing factors.
255
+ * [Roadtools](https://github.com/dirkjanm/ROADtools) by the awesome Dirk-Jan Mollema
256
+ * Assets
257
+ * UIcons by [Flaticon](https://www.flaticon.com/uicons)
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["uv_build"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "graphspy"
7
+ version = "1.6.1"
8
+ description = "Initial Access and Post-Exploitation Tool for AAD and O365 with a browser-based GUI."
9
+ authors = [
10
+ {name = "RedByte1337"}
11
+ ]
12
+ license = {text = "BSD-3-Clause"}
13
+ readme = "README.md"
14
+ requires-python = ">=3.10,<4.0"
15
+ dependencies = [
16
+ "flask>=3.0.0,<4.0.0",
17
+ "pyjwt>=2.8.0,<3.0.0",
18
+ "requests>=2.30.0,<3.0.0",
19
+ "pyotp>=2.9.0,<3.0.0",
20
+ "fido2>=1.1.0,<3.0.0"
21
+ ]
22
+
23
+ [project.urls]
24
+ repository = "https://github.com/RedByte1337/GraphSpy"
25
+
26
+ [project.scripts]
27
+ graphspy = 'graphspy.cli:main'
@@ -0,0 +1,17 @@
1
+ from importlib.metadata import version, PackageNotFoundError
2
+ from pathlib import Path
3
+ import tomllib
4
+
5
+ try:
6
+ __version__ = version("graphspy")
7
+ except PackageNotFoundError:
8
+ # Fallback: read directly from pyproject.toml for development
9
+ try:
10
+ pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml"
11
+ with open(pyproject_path, "rb") as f:
12
+ pyproject_data = tomllib.load(f)
13
+ __version__ = pyproject_data["project"]["version"] + "-dev"
14
+ except (FileNotFoundError, KeyError):
15
+ __version__ = "unknown"
16
+
17
+ __all__ = ["__version__"]
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import sys
4
+
5
+ # Local library imports
6
+ from . import cli
7
+
8
+ if __name__ == "__main__":
9
+ sys.exit(cli.main())