Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Snipeur060 authored Aug 17, 2022
1 parent 7f88ac6 commit d4e65e5
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 0 deletions.
12 changes: 12 additions & 0 deletions classes/color.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

class colorsconsole:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
CBLUE2 = '\33[94m'
15 changes: 15 additions & 0 deletions func/checkurl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import classes.color as colormodule
import requests

def url_checker(url):
try:
get = requests.get(url)
if get.status_code == 200:
print(colormodule.colorsconsole.OKGREEN+"Api Online"+colormodule.colorsconsole.ENDC)
return True
else:
print(colormodule.colorsconsole.FAIL+"Api Offline"+colormodule.colorsconsole.ENDC)
return False
except:
print(colormodule.colorsconsole.FAIL+"Api Offline"+colormodule.colorsconsole.ENDC)
smoothstop()
Empty file added func/dothings.py
Empty file.
59 changes: 59 additions & 0 deletions func/ecole.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import classes.color as colormodule
import http.client
import json
from func.smooth_stop import smoothstop
def request_id():
msg1 = colormodule.colorsconsole.CBLUE2+"Veuillez entrer votre nom d'utilisateur École Directe: "+colormodule.colorsconsole.ENDC
username = str(input(msg1))
msg2 = colormodule.colorsconsole.OKCYAN+"Veuillez entrer votre mot de passe École Directe: "+colormodule.colorsconsole.ENDC
password = str(input(msg2))
res = traitement(username,password)
jsondata(res)

def traitement(username,password):
#def de la co
conn = http.client.HTTPSConnection("api.ecoledirecte.com")
#le payload pour renseigner les datas
payload = 'data={"identifiant":'+f'"{username}"'+',"motdepasse":'+f'"{password}"'+'}'
# je def le headers (obligatoire) et je me fait passer pour chrome xd
headers = {
'authority': 'api.ecoledirecte.com',
'accept': 'application/json, text/plain, */*',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36',
'content-type': 'application/x-www-form-urlencoded',
'sec-gpc': '1',
'origin': 'https://www.ecoledirecte.com',
'sec-fetch-site': 'same-site',
'sec-fetch-mode': 'cors',
'sec-fetch-dest': 'empty',
'referer': 'https://www.ecoledirecte.com/',
'accept-language': 'fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7'
}
# on lance notre requête avec les valeurs ainsi que les headers
conn.request("POST", "/v3/login.awp", payload, headers)
#on get le result
res = conn.getresponse()
#on le transforme en format json (qui est possible à lire)
data = res.read()
# for debug print(data)
return data

def jsondata(data):
# on va traiter le json qui nous intéresse
try:
# bon ici j'explique pas. C'est juste allez-la ou le donné se trouve en empruntant le bon tunnel xd :-)
code_classe = json.loads(data.decode("utf-8"))['data']['accounts'][0]['profile']['classe']['code']
print(colormodule.colorsconsole.OKGREEN,colormodule.colorsconsole.BOLD,"Super nous avons réussi à trouver un code pour votre classe ",colormodule.colorsconsole.OKCYAN, code_classe ,colormodule.colorsconsole.ENDC," Note: ",colormodule.colorsconsole.BOLD,colormodule.colorsconsole.WARNING,"Toutes les personnes possédant le même code seront dans votre classe By PHOBOS Group")
smoothstop()
except:
error = json.loads(data.decode("utf-8"))['code']
if error == 505:
# identifiants pas ok
print(colormodule.colorsconsole.FAIL,colormodule.colorsconsole.BOLD,"Vos identifiants sont invalides",colormodule.colorsconsole.ENDC)
smoothstop()
else:
# encore rien mis et je sais c'est chiant
print(colormodule.colorsconsole.FAIL,colormodule.colorsconsole.BOLD,"La session école directe n'est pas encore activée veuillez patienter un petit peut jusqu'à son activation",colormodule.colorsconsole.ENDC)
# for debug print(error)
smoothstop()

6 changes: 6 additions & 0 deletions func/smooth_stop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import classes.color as colormodule
import os
def smoothstop():
print(colormodule.colorsconsole.FAIL+"Press Enter to exit ..."+colormodule.colorsconsole.ENDC)
input()
os._exit(0)
13 changes: 13 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import http.client
import json
from func.checkurl import url_checker
from func.smooth_stop import smoothstop
import classes.color as colormodule
import os
from func.ecole import *
# System call
os.system("")

if __name__ == '__main__':
result = url_checker("https://api.ecoledirecte.com")
request_id()

0 comments on commit d4e65e5

Please sign in to comment.