-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f88ac6
commit d4e65e5
Showing
6 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
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
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' |
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
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.
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
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() | ||
|
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
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) |
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
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() |