Skip to content

Instantly share code, notes, and snippets.

@rossja
Created February 6, 2024 23:39
Show Gist options
  • Save rossja/8ff03e8641dd1200feb46f1a8ea23bb4 to your computer and use it in GitHub Desktop.
Save rossja/8ff03e8641dd1200feb46f1a8ea23bb4 to your computer and use it in GitHub Desktop.
Slack Token Checker
"""
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')
@rossja
Copy link
Author

rossja commented Feb 6, 2024

handy check for secrets scanners

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment