Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
SH4FS0c13ty authored Aug 2, 2019
1 parent 83511ab commit ca58b04
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 55 deletions.
25 changes: 20 additions & 5 deletions Anti-Cheat.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ echo ██╔══██║██║╚██╗██║ ██║ ██
echo ██║ ██║██║ ╚████║ ██║ ██║ ╚██████╗██║ ██║███████╗██║ ██║ ██║
echo ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝
echo.
echo Anti-Cheat v1.3 (The Masterkiller) par SH4FS0c13ty
echo Anti-Cheat v1.3.1 (The Masterkiller) par SH4FS0c13ty
echo Un bot Discord qui éjecte les tricheurs d'après leur liste de serveurs et leur ID Pokémon GO.
echo.
echo Tapez "help" pour voir le menu d'aide.
Expand Down Expand Up @@ -42,6 +42,8 @@ if /i "%start%" EQU "set TOKEN" goto set_token
if /i "%start%" EQU "set HOST" goto set_host
if /i "%start%" EQU "set PORT" goto set_port
if /i "%start%" EQU "set REDIRECT_URL" goto set_redirect_url
if /i "%start%" EQU "set OAUTH_WINDOW" goto set_oauth_win
if /i "%start%" EQU "set CHECKER_WINDOW" goto set_checker_win

echo Commande inconnue.

Expand Down Expand Up @@ -73,6 +75,8 @@ echo set TOKEN Définir la valeur BOT_TOKEN dans le fich
echo set HOST Définir la valeur de l'adresse IP de l'hôte du serveur web
echo set PORT Définir le numéro de port du serveur web dans le fichier de configuration
echo set REDIRECT_URL Définir la valeur de l'URL pour la redirection dans le fichier de configuration
echo set OAUTH_WINDOW Définir la valeur de l'état de la fenêtre du module Anti-Cheat OAuth2 dans le fichier de configuration
echo set CHECKER_WINDOW Définir la valeur de l'état de la fenêtre du module Anti-Cheat Checker dans le fichier de configuration
goto prompt

:about
Expand All @@ -85,7 +89,7 @@ echo ██╔══██║██║╚██╗██║ ██║ ██
echo ██║ ██║██║ ╚████║ ██║ ██║ ╚██████╗██║ ██║███████╗██║ ██║ ██║
echo ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝
echo.
echo Anti-Cheat v1.3 (The Masterkiller) by SH4FS0c13ty
echo Anti-Cheat v1.3.1 (The Masterkiller) by SH4FS0c13ty
echo Un bot Discord qui éjecte les tricheurs d'après leur liste de serveurs et leur ID Pokémon GO.
echo.
echo Ce projet est né sur une demande de 123321mario (http://123321mario.tk/) qui
Expand Down Expand Up @@ -212,23 +216,20 @@ goto reset_cheaters

:reset_cheaters_did
del /Q lists\\cheaters_ids
echo.
echo Liste des IDs Discord de tricheurs supprimée.
echo.
pause
goto reset_cheaters

:reset_cheaters_pid
del /Q lists\\cheaters.json
echo.
echo Liste des IDs Pokémon GO de tricheurs supprimée.
echo.
pause
goto reset_cheaters

:reset_cheaters_aid
del /Q lists\\Associated_IDs.txt
echo.
echo Liste des IDs associés de tricheurs supprimée.
echo.
pause
Expand Down Expand Up @@ -272,4 +273,18 @@ goto prompt

:set_redirect_url
scripts\\tools.py set REDIRECT_URL
goto prompt

:set_oauth_win
echo La valeur de OAUTH_WINDOW doit être SW_HIDE, SW_MINIMIZE, SW_MAXIMIZE ou SW_SHOW.
echo Sinon, la valeur utilisé sera la valeur par défaut SW_MINIMIZE.
echo.
scripts\\tools.py set OAUTH_WINDOW
goto prompt

:set_checker_win
echo La valeur de CHECKER_WINDOW doit être SW_HIDE, SW_MINIMIZE, SW_MAXIMIZE ou SW_SHOW.
echo Sinon, la valeur utilisé sera la valeur par défaut SW_MINIMIZE.
echo.
scripts\\tools.py set CHECKER_WINDOW
goto prompt
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Anti-Cheat Discord Bot
Anti-Cheat v1.3 (The Masterkiller) par SH4FS0c13ty<br />
Anti-Cheat v1.3.1 (The Masterkiller) par SH4FS0c13ty<br />
Un bot Discord qui éjecte les tricheurs d'après leur liste de serveurs et leur ID Pokémon GO.<br />
<br />
English version : https://github.com/SH4FS0c13ty/Anti-Cheat_Discord_Bot
Expand Down Expand Up @@ -32,7 +32,7 @@ Voir les listes et la configuration d'Anti-Cheat :<br />
Réinitialiser les listes et la configuration d'Anti-Cheat :<br />
`reset config|cheaters_lists|servers_lists`<br />
Définir la configuration d'Anti-Cheat :<br />
`set CLIENT_ID|CLIENT_SECRET|TOKEN|HOST|PORT`<br />
`set CLIENT_ID|CLIENT_SECRET|TOKEN|HOST|PORT|OAUTH_WINDOW|CHECKER_WINDOW`<br />
<br />
### Fiichiers utilisés<br />
Fichier de configuration :<br />
Expand All @@ -46,16 +46,17 @@ Les des IDs Discord des tricheurs :<br />
Listes des IDs associés des tricheurs (<ID_POKEMON_GO>:<ID_DISCORD>):<br />
`lists/Associated_IDs.txt`<br />
Listes des serveurs des utilisateurs :<br />
`server_lists/<DISCORD_ID>.txt`<br />
`servers_lists/<DISCORD_ID>_servers_list.txt`<br />
<br />
N'oubliez pas de configurer Anti-Cheat avant de l'utiliser !<br />
Pour le configurer, modifiez le fichier "config.json" ou utilisez la commande `set <PARAM>`.<br />
Vous devez aussi modifier les fichiers "blacklist.txt et "cheaters.xlsx" pour le faire fonctionner correctement.<br />
<br />
### Commandes du bot
- ./verify <URL_IMAGE_OU_IMAGE_INCLUSE>
- ./kick <NOM_UTILISATEUR>
- ./recheck <NOM_UTILISATEUR>
- ./kick <NOM_OU_ID_UTILISATEUR>
- ./recheck <NOM_OU_ID_UTILISATEUR>
- ./recheck_all

## Licence

Expand Down
65 changes: 44 additions & 21 deletions scripts/check.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import discord, sys, os, requests, json, ctypes
import ocr, tools, getcolor
from discord.ext import commands
from discord.ext.commands import has_permissions, CheckFailure
from discord.ext.commands import has_permissions
from discord.utils import get

ctypes.windll.kernel32.SetConsoleTitleW("Module Anti-Cheat Checker")
Expand Down Expand Up @@ -29,7 +29,7 @@ async def on_member_join(member):
else:
print("[INFO] " + username + " n'est pas dans la liste des tricheurs.")
except:
print("[ATTE] La liste des tricheurs est manquante. Impossible de vérifier " + username)
print("[ATTE] La liste des tricheurs est manquante. Impossible de vérifier " + username + ".")


@bot.command(pass_context=True)
Expand All @@ -44,7 +44,7 @@ async def verify(ctx, url=None):
print("[ATTE] " + username + " a essayé d'utiliser ./verify mais est déjà vérifié.")
await ctx.message.delete()
else:
if url == None:
if url is None:
try:
url = str(ctx.message.attachments[0].url)
except:
Expand All @@ -54,10 +54,14 @@ async def verify(ctx, url=None):
return 0
print("[INFO] " + username + " est en train d'être vérifié.")
get_img(url, userid)
if pokeid == "ERROR":
print("[ATTE] Page Pokémon GO soumise incorrecte. Imposible de vérifier " + username + ".")
await ctx.author.send("[Pokémon GO Marseille]\n:flag_us: The image you submitted for verification is wrong!\n:flag_fr: L'image que vous avez soumis pour la vérification est incorrecte !")
await ctx.channel.purge(limit=None, check=lambda msg: not msg.pinned)
bcheck(userid)
if blacklisted == 0:
print("[INFO] " + "Nouvel utilisateur vérifié : " + username + ".")
await ctx.author.send("[Pokémon GO Marseille]\n[EN] Welcome to the server Pokémon GO Marseille!\n[FR] Bienvenue dans le serveur Pokémon GO Marseille !")
await ctx.author.send("[Pokémon GO Marseille]\n:flag_us: Welcome to the server Pokémon GO Marseille!\n:flag_fr: Bienvenue dans le serveur Pokémon GO Marseille !")
role = get(ctx.guild.roles, name="Verified")
await ctx.author.add_roles(role)
print("[INFO] " + "Rôle Verified appliqué à " + username + ".")
Expand All @@ -70,14 +74,14 @@ async def verify(ctx, url=None):
blacklisted = 0
if blacklisted == 1:
print("[ATTE] " + "Tricheur détecté !\n[INFO] Éjection de " + username + ".")
await ctx.author.send("[Pokémon GO Marseille]\n https://cdn.discordapp.com/attachments/451360093607297054/599226877277634561/IMG_20190511_111313.jpg \n[EN] You have been detected as a cheater, please contact an administrator and prove that you are not a cheater to access the server.\n[FR] Vous êtes soupçonné d'être un tricheur, veuillez contacter un administrateur et lui prouver que vous n'êtes pas un tricheur afin d'accéder au serveur.")
await ctx.author.send("[Pokémon GO Marseille]\n https://cdn.discordapp.com/attachments/451360093607297054/599226877277634561/IMG_20190511_111313.jpg \n:flag_us: You have been detected as a cheater, please contact an administrator and prove that you are not a cheater to access the server.\n:flag_fr: Vous êtes soupçonné d'être un tricheur, veuillez contacter un administrateur et lui prouver que vous n'êtes pas un tricheur afin d'accéder au serveur.")
write_cheater_id(userid)
user = usr(userid)
await ctx.guild.kick(user)
blacklisted = 0
if blacklisted == 2:
print("[ATTE] " + username + " n'a pas autorisé le bot a accéder à ses informations.")
await ctx.author.send("[EN] You must authorize the bot to access your informations before verifying yourself!\n[FR] Vous devez autoriser le bot à accéder à vos informations avant de vous vérifier !")
await ctx.author.send(":flag_us: You must authorize the bot to access your informations before verifying yourself!\n:flag_fr: Vous devez autoriser le bot à accéder à vos informations avant de vous vérifier !")
blacklisted = 0
await ctx.channel.purge(limit=None, check=lambda msg: not msg.pinned)
print("[INFO] Salon nettoyé.")
Expand Down Expand Up @@ -109,7 +113,6 @@ def write_cheater_id(id):

@bot.event
async def on_ready():
bot_name = bot.user.name
bot_id = str(bot.user.id)
print("Connecté avec succès.")
print("Nom : " + bot.user.name)
Expand All @@ -121,13 +124,9 @@ async def on_ready():
async def kick(ctx, user: discord.Member):
username = str(user.name)
print("[INFO] " + "Utilisateur éjecté : " + username + ".")
await ctx.author.send("[EN] You have been kicked from the server. Please verify yourself again to access the server.\n[FR] Vous avez été kické du serveur. Veuillez vous soumettre à une nouvelle vérification afin d'accéder au serveur.")
await user.send(":flag_us: You have been kicked from the server. Please verify yourself again to access the server.\n:flag_fr: Vous avez été kické du serveur. Veuillez vous soumettre à une nouvelle vérification afin d'accéder au serveur.")
await ctx.guild.kick(user)

@kick.error
async def kick_error(error, ctx):
print("[ATTE] Quelqu'un a essayé d'utiliser la commande ./kick sans les permissions administrateur.\n[ATTE] Veuillez vérifier le salon Discord pour en savoir plus.")

def bcheck(userid):
global blacklisted
global pokeid
Expand Down Expand Up @@ -158,7 +157,7 @@ def json_check(pokid, usrid):
print("[INFO] " + "Vérification de la liste de tricheurs Pokémon GO ...")
if os.path.isfile("lists\\cheaters.json") == False:
tools.excel2json()
with open("lists\cheaters.json") as json_file:
with open("lists\\cheaters.json") as json_file:
data = json.load(json_file)
for p in data:
if pokeid == p["Pseudo*"]:
Expand Down Expand Up @@ -192,21 +191,45 @@ async def recheck(ctx, user: discord.Member):
role = get(ctx.guild.roles, name="Verified")
if role in user.roles:
await user.remove_roles(role)
role = get(ctx.guild.roles, name="Instinct")
role = get(ctx.guild.roles, name="instinct")
if role in user.roles:
await user.remove_roles(role)
role = get(ctx.guild.roles, name="Valor")
role = get(ctx.guild.roles, name="valor")
if role in user.roles:
await user.remove_roles(role)
role = get(ctx.guild.roles, name="Mystic")
role = get(ctx.guild.roles, name="mystic")
if role in user.roles:
await user.remove_roles(role)
os.remove("servers_lists\\" + userid + "_servers_list.txt")
await user.send("[Pokémon GO Marseille]\n[EN] You have been asked for a new verification, please follow the autorisation link and use ./verify to verify yourself.\n[FR] Une nouvelle vérification de votre part est requise, veuillez suivre le lien d'autorisation et utilisez ./verify pour vous vérifier.")

@recheck.error
async def kick_error(error, ctx):
print("[ATTE] Quelqu'un a essayé d'utiliser la commande ./recheck sans les permissions administrateur.\n[ATTE] Veuillez vérifier le salon Discord pour en savoir plus.")
await user.send("[Pokémon GO Marseille]\n:flag_us: You have been asked for a new verification, please follow the autorisation link and use ./verify to verify yourself.\n:flag_fr: Une nouvelle vérification de votre part est requise, veuillez suivre le lien d'autorisation et utilisez ./verify pour vous vérifier.")

@bot.command(pass_context=True)
@has_permissions(administrator=True)
async def recheck_all(ctx):
print("[INFO] Une nouvelle vérification pour tout le monde a été demandée.")
await ctx.send("@everyone\n[Pokémon GO Marseille]\n:flag_us: Everyone must be verified again, please follow the autorisation link and use ./verify to verify yourself.\n:flag_fr: Tout le monde doit être vérifié une nouvelle fois, veuillez suivre le lien d'autorisation et utilisez ./verify pour vous vérifier.")
for member in ctx.message.guild.members:
userid = member.id
flag = False
role = get(ctx.guild.roles, name="Admin")
if role in member.roles:
flag = True
if userid == bot.user.id:
flag=True
if flag != True:
role = get(ctx.guild.roles, name="Verified")
if role in member.roles:
await member.remove_roles(role)
role = get(ctx.guild.roles, name="instinct")
if role in member.roles:
await member.remove_roles(role)
role = get(ctx.guild.roles, name="valor")
if role in member.roles:
await member.remove_roles(role)
role = get(ctx.guild.roles, name="mystic")
if role in member.roles:
await member.remove_roles(role)
if os.path.isfile("servers_lists\\" + str(userid) + "_servers_list.txt") == True:
os.remove("servers_lists\\" + str(userid) + "_servers_list.txt")

bot.run(arg)
6 changes: 4 additions & 2 deletions scripts/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"CLIENT_ID": "<ID_CLIENT>",
"CLIENT_SECRET": "<SECRET_CLIENT>",
"TOKEN": "<JETON>",
"HOST": "<HÔTE>",
"HOST": "<HOTE>",
"PORT": "<PORT>",
"REDIRECT_URL": "<URL_REDIRECTION>"
"REDIRECT_URL": "<URL_REDIRECTION>",
"OAUTH_WINDOW": "SW_MINIMIZE",
"CHECKER_WINDOW": "SW_MINIMIZE"
}
6 changes: 3 additions & 3 deletions scripts/getcolor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ def main_color(image):

if r >= g and r >= b:
if g >= b:
main_color = "Instinct"
main_color = "instinct"
else:
main_color = "Valor"
main_color = "valor"
else:
main_color = "Mystic"
main_color = "mystic"

return main_color
56 changes: 46 additions & 10 deletions scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,68 @@
HOST = res["HOST"]
PORT = res["PORT"]
REDIRECT_URL = res["REDIRECT_URL"]
OAUTH_WINDOW = res["OAUTH_WINDOW"]
CHECKER_WINDOW = res["CHECKER_WINDOW"]

print("Démarrage d'Anti-Cheat avec les paramètres suivants ...")
print("Démarrage d'Anti-Cheat avec les paramètres suivants ...\n")
print("=========================================================================================")
print("ID_CLIENT : " + CLIENT_ID)
print("SECRET_CLIENT : " + CLIENT_SECRET)
print("JETON : " + TOKEN)
print("HÔTE : " + HOST)
print("PORT : " + PORT)
print("URL_REDIRECTION : " + REDIRECT_URL)
print(" Paramètres fonctionnels ")
print("=========================================================================================")
print(" CLIENT_ID: " + CLIENT_ID)
print(" CLIENT_SECRET: " + CLIENT_SECRET)
print(" TOKEN: " + TOKEN)
print(" HOST: " + HOST)
print(" PORT: " + PORT)
print(" REDIRECT_URL: " + REDIRECT_URL)
print("=========================================================================================")
print(" Paramètres des fenêtres ")
print("=========================================================================================")
print(" OAUTH_WINDOW: " + OAUTH_WINDOW)
print(" CHECKER_WINDOW: " + CHECKER_WINDOW)
print("=========================================================================================\n")

SW_HIDE = 0
SW_MINIMIZE = 6
SW_MAXIMIZE = 3
SW_SHOW = 5

info = subprocess.STARTUPINFO()
info.dwFlags = subprocess.STARTF_USESHOWWINDOW
info.wShowWindow = SW_MINIMIZE

if OAUTH_WINDOW == "SW_HIDE":
info.wShowWindow = SW_HIDE
if OAUTH_WINDOW == "SW_MINIMIZE":
info.wShowWindow = SW_MINIMIZE
if OAUTH_WINDOW == "SW_MAXIMIZE":
info.wShowWindow = SW_MAXIMIZE
if OAUTH_WINDOW == "SW_SHOW":
info.wShowWindow = SW_SHOW

info2 = subprocess.STARTUPINFO()
info2.dwFlags = subprocess.STARTF_USESHOWWINDOW
info2.wShowWindow = SW_MINIMIZE

if CHECKER_WINDOW == "SW_HIDE":
info2.wShowWindow = SW_HIDE
if CHECKER_WINDOW == "SW_MINIMIZE":
info2.wShowWindow = SW_MINIMIZE
if CHECKER_WINDOW == "SW_MAXIMIZE":
info2.wShowWindow = SW_MAXIMIZE
if CHECKER_WINDOW == "SW_SHOW":
info2.wShowWindow = SW_SHOW

pid = subprocess.Popen(args=["python", "scripts\\oauth.py", CLIENT_ID, CLIENT_SECRET, HOST, PORT, REDIRECT_URL], creationflags=NEW_CONSOLE, startupinfo=info).pid
print("Module Anti-Cheat OAauth2 démarré avec le PID " + str(pid) + " avec une console réduite.")
print("Module Anti-Cheat OAauth2 démarré avec le PID " + str(pid) + ".")

f = open("scripts\\oauth_pid.txt", "w")
f.write(str(pid))
f.close()

pid2 = subprocess.Popen(args=["python", "scripts\\check.py", TOKEN], creationflags=NEW_CONSOLE, startupinfo=info).pid
print("Module Anti-Cheat Checker démarré avec le PID " + str(pid2) + " avec une console réduite.")
pid2 = subprocess.Popen(args=["python", "scripts\\check.py", TOKEN], creationflags=NEW_CONSOLE, startupinfo=info2).pid
print("Module Anti-Cheat Checker démarré avec le PID " + str(pid2) + ".")

f = open("scripts\\check_pid.txt", "w")
f.write(str(pid2))
f.close()

5 changes: 4 additions & 1 deletion scripts/ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

def getid(file, userid):
ocr_result = ocr_core(file)
pokeid = text_process(ocr_result, userid)
if ocr_result.find("&") != -1:
pokeid = text_process(ocr_result, userid)
else:
pokeid = "ERROR"
os.remove(file)
return pokeid

Expand Down
Loading

0 comments on commit ca58b04

Please sign in to comment.