Spaces:
Runtime error
Runtime error
Moibe
commited on
Commit
•
0dffa22
1
Parent(s):
f4e4dbc
Flag detected Ok!
Browse files- app.py +3 -2
- sulkuPypi.py +9 -4
app.py
CHANGED
@@ -55,9 +55,10 @@ def perform(input1, input2, request: gr.Request):
|
|
55 |
def display_tokens(request: gr.Request):
|
56 |
|
57 |
#Para desplegar o no desplegar, necesitamos saber si el usuario es new user.
|
58 |
-
flag = sulkuPypi.getFlag(request.username)
|
59 |
print("La flag obtenida es: ", flag)
|
60 |
-
|
|
|
61 |
tokens = sulkuPypi.getTokens(sulkuPypi.encripta(request.username).decode("utf-8"))
|
62 |
display = tools.actualizar_creditos(tokens, request.username)
|
63 |
|
|
|
55 |
def display_tokens(request: gr.Request):
|
56 |
|
57 |
#Para desplegar o no desplegar, necesitamos saber si el usuario es new user.
|
58 |
+
flag = sulkuPypi.getFlag(sulkuPypi.encripta(request.username).decode("utf-8"))
|
59 |
print("La flag obtenida es: ", flag)
|
60 |
+
#FUTURE quizá das doble vuelta decodificando porque haya lo vuelves a encodear, prueba enviando sin decode...
|
61 |
+
#...llegaría codificado a encripta y prueba allá no encode.
|
62 |
tokens = sulkuPypi.getTokens(sulkuPypi.encripta(request.username).decode("utf-8"))
|
63 |
display = tools.actualizar_creditos(tokens, request.username)
|
64 |
|
sulkuPypi.py
CHANGED
@@ -16,6 +16,8 @@ work = "picswap"
|
|
16 |
#lo que le vas a enviar a la API.
|
17 |
def encripta(username):
|
18 |
|
|
|
|
|
19 |
key = nodes.key
|
20 |
fernet = Fernet(key)
|
21 |
|
@@ -52,15 +54,17 @@ def getFlag(userfile):
|
|
52 |
params = userfile
|
53 |
|
54 |
api_url = base_url + method + params
|
|
|
55 |
response = requests.get(api_url)
|
56 |
|
57 |
if response.status_code == 200:
|
58 |
print("Conexión a Sulku successful...")
|
59 |
flag = response.json()
|
60 |
-
|
61 |
-
|
|
|
62 |
else:
|
63 |
-
print("Error al obtener el elemento todo:", response.status_code)
|
64 |
|
65 |
return flag
|
66 |
|
@@ -70,6 +74,7 @@ def getTokens(userfile):
|
|
70 |
params = userfile
|
71 |
|
72 |
api_url = base_url + method + params
|
|
|
73 |
response = requests.get(api_url)
|
74 |
|
75 |
if response.status_code == 200:
|
@@ -121,7 +126,7 @@ def debitTokensQ(userfile, work):
|
|
121 |
#... clima por ejemplo.)
|
122 |
method = "debitTokens?"
|
123 |
params = "userfile=" + userfile + "&" + "work=" + work
|
124 |
-
|
125 |
api_url = base_url + method + params
|
126 |
response = requests.get(api_url)
|
127 |
|
|
|
16 |
#lo que le vas a enviar a la API.
|
17 |
def encripta(username):
|
18 |
|
19 |
+
print("Estoy en encripta y ésto recibí para trabajarlo: ", username)
|
20 |
+
|
21 |
key = nodes.key
|
22 |
fernet = Fernet(key)
|
23 |
|
|
|
54 |
params = userfile
|
55 |
|
56 |
api_url = base_url + method + params
|
57 |
+
print("Usando la api_url: ", api_url)
|
58 |
response = requests.get(api_url)
|
59 |
|
60 |
if response.status_code == 200:
|
61 |
print("Conexión a Sulku successful...")
|
62 |
flag = response.json()
|
63 |
+
|
64 |
+
print("Esto es la flag obtenida: ", flag)
|
65 |
+
|
66 |
else:
|
67 |
+
print("182: Error al obtener el elemento todo:", response.status_code)
|
68 |
|
69 |
return flag
|
70 |
|
|
|
74 |
params = userfile
|
75 |
|
76 |
api_url = base_url + method + params
|
77 |
+
print("En getTokens la api_url que estoy usando es: ", api_url)
|
78 |
response = requests.get(api_url)
|
79 |
|
80 |
if response.status_code == 200:
|
|
|
126 |
#... clima por ejemplo.)
|
127 |
method = "debitTokens?"
|
128 |
params = "userfile=" + userfile + "&" + "work=" + work
|
129 |
+
|
130 |
api_url = base_url + method + params
|
131 |
response = requests.get(api_url)
|
132 |
|