Created
February 6, 2024 23:39
-
-
Save rossja/8ff03e8641dd1200feb46f1a8ea23bb4 to your computer and use it in GitHub Desktop.
Slack Token Checker
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
""" | |
presumes a list of slack tokens (1 per line) | |
in a file at ./tokens.txt | |
runs through them one by one using the slack auth.test endpoint | |
returns info if they are valid, otherwise no | |
""" | |
import requests | |
url = 'https://slack.com/api/auth.test' | |
with open('tokens.txt', 'r') as file: | |
tokens = file.read().splitlines() | |
file.close() | |
for token in tokens: | |
response = requests.post(url, data={'token': token}) | |
data = response.json() | |
if data['ok'] == True: | |
print(f'Token {token} is valid') | |
print(f'json: {data}') | |
else: | |
print(f'Token {token} is invalid') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
handy check for secrets scanners