32 lines
627 B
Python
Executable file
32 lines
627 B
Python
Executable file
#!/bin/python3
|
|
|
|
import requests
|
|
import hashlib
|
|
|
|
PASSWORD = '0'
|
|
USERNAME = '0'*1024*1024
|
|
|
|
API_URL = "https://teamacedia.baselinux.net:22222/"
|
|
ENDPOINT_REGISTER = "/api/register"
|
|
|
|
def hash_pw(pw: str) -> str:
|
|
h = hashlib.sha256()
|
|
h.update(pw.encode())
|
|
return h.hexdigest()
|
|
|
|
def main() -> int:
|
|
pw = hash_pw(PASSWORD)
|
|
|
|
response = requests.post(
|
|
url = API_URL + ENDPOINT_REGISTER,
|
|
json = {
|
|
"username": USERNAME,
|
|
"password": pw
|
|
}
|
|
)
|
|
|
|
print(response.status_code)
|
|
return 0 if response.status_code == 200 else 1
|
|
|
|
if __name__ == '__main__':
|
|
exit(main())
|