Last active
November 26, 2019 06:27
-
-
Save k9982874/1e4cfa5cc112947ab68e682b2ba216e8 to your computer and use it in GitHub Desktop.
disconnect-qq-auth.py
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
#!/usr/bin/env python3 | |
# License: Public Domain | |
# 登陆 connect.qq.com 获取 uin 和 skey 的 cookie 拷贝填充到代码 | |
import requests | |
session = requests.session() | |
session.cookies.set("uin", "your uin id from connect.qq.com cookie") | |
session.cookies.set("skey", "your skey from connect.qq.com cookie") | |
def fetch_auth_list(start, limit): | |
response = session.get( | |
"https://cgi.connect.qq.com/authmng/get_auth_app_list", | |
headers={ | |
"Referer": "https://connect.qq.com/manage.html", | |
}, | |
params={ | |
"sort": "time", | |
"apptype": "all", | |
"token": 5381, | |
"order": "desc", | |
"start": start, | |
"limit": limit, | |
}, | |
) | |
return response.json() | |
def delete_connect(app_id): | |
response = session.post( | |
"https://cgi.connect.qq.com/authmng/del_app_auth", | |
headers={ | |
"Referer": "https://cgi.connect.qq.com/proxy.html?callback=1&id=1" | |
}, | |
data={ | |
"appid": app_id, | |
}, | |
) | |
payload = response.json() | |
print("AppID: %s, Message: %s" % (app_id, payload["msg"])) | |
def main(): | |
total = fetch_auth_list(0, 0)["result"]["total"] | |
app_ids = set() | |
for index in range(0, total, 20): | |
apps = fetch_auth_list(index, 20)["result"]["data"] | |
app_ids |= set(app["appid"] for app in apps) | |
for app_id in sorted(app_ids): | |
delete_connect(app_id) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment