Skip to content

Instantly share code, notes, and snippets.

@n3b0r
Created April 15, 2021 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n3b0r/ef0241c39c66c9ae765bbe886ad9bbed to your computer and use it in GitHub Desktop.
Save n3b0r/ef0241c39c66c9ae765bbe886ad9bbed to your computer and use it in GitHub Desktop.
Pure Python script to delete all files on the Slack workspace.
# 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