Created
April 15, 2021 22:24
-
-
Save n3b0r/ef0241c39c66c9ae765bbe886ad9bbed to your computer and use it in GitHub Desktop.
Pure Python script to delete all files on the Slack workspace.
This file contains hidden or 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
# Use this script to recursively delete all the files present on the authorized workspace. | |
# The aim of this script it continues using the free Slack tier. | |
# WARNING: This will delete ALL your files | |
import requests | |
import json | |
file_list = "https://slack.com/api/files.list" | |
file_delete = "https://slack.com/api/files.delete" | |
headers = {"Authorization": "Bearer SLACK API KEY"} | |
files = requests.get(file_list,headers=headers).json() | |
for file in files['files']: | |
del_file = {"file": file['id']} | |
result = requests.post(file_delete,data=del_file,headers=headers).json() | |
if result['ok']: | |
print("[+] File "+file['id']+" ==> OK") | |
else: | |
print("[-] File "+file['id']+" ==> ERROR") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment