Last active
October 14, 2021 17:22
-
-
Save moonexpr/5dee376bea9fe4e61df3a978ed2322d5 to your computer and use it in GitHub Desktop.
TF2 Bot Account Reporter
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
#!/usr/bin/env python3 | |
import os | |
import requests | |
import json | |
REASON = 'The account associated with the report is ran by cathook (https://github.com/nullworks/cathook), this account uses third-party software to cheat on Valve matchmaking servers and prevents legitimate players from enjoying the game.' | |
# Get these from web cookies | |
AUTH_SESSION_ID = "" | |
AUTH_STEAM_LOGIN_SECURE = "" | |
STEAM_API_KEY = os.environ.get('STEAM_API_KEY') | |
URL_PREFIX = 'https://steamcommunity.com/' | |
def findCommunityId(url): | |
if not url.startswith(URL_PREFIX): | |
raise "Bad url!" | |
vanityType, identity, *_ = url.split(URL_PREFIX)[1].split('/') | |
# https://steamcommunity.com/profiles/76561199150855850/ | |
if vanityType == "profiles": | |
return identity | |
# https://steamcommunity.com/id/potatofactory/ | |
else: | |
r = requests.get(f"http://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/?key={STEAM_API_KEY}&vanityurl={identity}") | |
response = r.json().get('response') | |
if response.get('success', 0) != 1: | |
raise f"BAD req: {r.text()}" | |
return response.get('steamid') | |
def reportUser(steam_id, reason): | |
# Form HTTP stuff | |
reason = reason.replace(' ', '+') | |
r = requests.post( | |
"https://steamcommunity.com/actions/ReportAbuse/", | |
data = { | |
'sessionid': AUTH_SESSION_ID, | |
'json': "1", | |
'abuseID': steam_id, | |
'eAbuseType': "10", | |
'abuseDescription': reason, | |
'ingameAppID': "440" | |
}, | |
headers = { | |
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', | |
'X-Requested-With': 'XMLHttpRequest' | |
}, | |
cookies = { | |
'sessionid': AUTH_SESSION_ID, | |
'steamLoginSecure': AUTH_STEAM_LOGIN_SECURE, | |
} | |
) | |
return r.text == "1" | |
def dumpUser(steam_id): | |
BOLD = "\033[1m" | |
NORMAL = "\033[0m" | |
r = requests.get(f"http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={STEAM_API_KEY}&steamids={steam_id}") | |
user = r.json().get('response').get('players', [])[0] | |
online = BOLD if user.get('personastate', 0) > 0 else NORMAL | |
visibility = 'π' if user.get('communityvisibilitystate', 0) > 3 else 'π' | |
identity = f"{online}{user.get('personaname', 'username')}{NORMAL}\n profile: {user.get('profileurl', 'https://')}\n community id: {user.get('steamid', '0')}" | |
print(f"{visibility} {identity}") | |
print("TF2 bot account auto-report") | |
print(" usage: $ https://steamcommunity.com/profiles/xxxx/") | |
while True: | |
stdin = input("$ ") | |
if stdin == 'q': | |
break | |
url = stdin | |
steam_id = findCommunityId(url) | |
print("\nPlease confirm you want to REPORT the following user.") | |
print("-----------------------------------------------------\n ", end='') | |
dumpUser(steam_id) | |
print("-----------------------------------------------------\n") | |
if input('REPORT this user? [Y/n] ').lower() == 'n': | |
continue | |
if reportUser(steam_id, REASON): | |
print(f"β Successfully reported player! (reason: {REASON})") | |
else: | |
print(f"β Failed to report player. (did you already report them??)") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment