Spaces:
Sleeping
Sleeping
Moibe
commited on
Commit
路
b783901
1
Parent(s):
9d70e15
Speed it
Browse files- app.py +1 -4
- avaimet.py +5 -14
- compiler.py +0 -10
- generador馃挕.py +1 -7
app.py
CHANGED
|
@@ -17,10 +17,7 @@ def getAccess(userfile):
|
|
| 17 |
|
| 18 |
def debitTokens(userfile, work):
|
| 19 |
|
| 20 |
-
print("
|
| 21 |
-
time.sleep(8)
|
| 22 |
-
|
| 23 |
-
print(f"Y work recibido es : {work} y es del tipo: {type(work)} ...")
|
| 24 |
|
| 25 |
#Genera conexi贸n inicial.
|
| 26 |
sshListo, sftpListo = avaimet.conecta()
|
|
|
|
| 17 |
|
| 18 |
def debitTokens(userfile, work):
|
| 19 |
|
| 20 |
+
print(f"Task received : {work}, type: {type(work)} ...")
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
#Genera conexi贸n inicial.
|
| 23 |
sshListo, sftpListo = avaimet.conecta()
|
avaimet.py
CHANGED
|
@@ -21,21 +21,16 @@ def conecta():
|
|
| 21 |
|
| 22 |
def obtenCaja(userfile):
|
| 23 |
|
| 24 |
-
print("Esto es userfile de obtenCaja: ", userfile)
|
| 25 |
-
time.sleep(9)
|
| 26 |
# Ruta del archivo remoto
|
| 27 |
ruta_remota = nodes.avaimentekij盲
|
| 28 |
print("Encoding...")
|
| 29 |
userfile_codificado = userfile.encode("utf-8")
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
print("Estoy afuera, enviando al compiler.")
|
| 34 |
username = compiler.do(userfile_codificado)
|
| 35 |
-
print("Username
|
| 36 |
caja = ruta_remota + username + ".txt"
|
| 37 |
-
|
| 38 |
-
|
| 39 |
return caja
|
| 40 |
|
| 41 |
def obtenTokens(sftp, caja):
|
|
@@ -48,10 +43,6 @@ def obtenTokens(sftp, caja):
|
|
| 48 |
|
| 49 |
tokens = int(tokens)
|
| 50 |
|
| 51 |
-
print("Tokens son....: ", tokens)
|
| 52 |
-
print("Y su type182 es: ", type(tokens))
|
| 53 |
-
time.sleep(8)
|
| 54 |
-
|
| 55 |
return tokens
|
| 56 |
|
| 57 |
def restaToken(sftp, caja, tokens, work):
|
|
@@ -63,7 +54,7 @@ def restaToken(sftp, caja, tokens, work):
|
|
| 63 |
if work == 'picswap':
|
| 64 |
cuantos = 1
|
| 65 |
print(f"Work: {work}, cuantos: {cuantos}")
|
| 66 |
-
time.sleep(
|
| 67 |
else:
|
| 68 |
print("El trabajo no existe...")
|
| 69 |
|
|
|
|
| 21 |
|
| 22 |
def obtenCaja(userfile):
|
| 23 |
|
|
|
|
|
|
|
| 24 |
# Ruta del archivo remoto
|
| 25 |
ruta_remota = nodes.avaimentekij盲
|
| 26 |
print("Encoding...")
|
| 27 |
userfile_codificado = userfile.encode("utf-8")
|
| 28 |
+
|
| 29 |
+
print("Sending to compiler.")
|
|
|
|
|
|
|
| 30 |
username = compiler.do(userfile_codificado)
|
| 31 |
+
print("Username is: ", username)
|
| 32 |
caja = ruta_remota + username + ".txt"
|
| 33 |
+
|
|
|
|
| 34 |
return caja
|
| 35 |
|
| 36 |
def obtenTokens(sftp, caja):
|
|
|
|
| 43 |
|
| 44 |
tokens = int(tokens)
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
return tokens
|
| 47 |
|
| 48 |
def restaToken(sftp, caja, tokens, work):
|
|
|
|
| 54 |
if work == 'picswap':
|
| 55 |
cuantos = 1
|
| 56 |
print(f"Work: {work}, cuantos: {cuantos}")
|
| 57 |
+
time.sleep(1)
|
| 58 |
else:
|
| 59 |
print("El trabajo no existe...")
|
| 60 |
|
compiler.py
CHANGED
|
@@ -4,19 +4,9 @@ from cryptography.fernet import Fernet
|
|
| 4 |
|
| 5 |
def do(desencriptable):
|
| 6 |
|
| 7 |
-
print("El tipo de desencriptable desde adentro es es del tipo: ", type(desencriptable))
|
| 8 |
-
time.sleep(8)
|
| 9 |
-
|
| 10 |
#key = Fernet.generate_key()
|
| 11 |
key = nodes.key
|
| 12 |
-
print("Esto es la KEY: ", key)
|
| 13 |
-
time.sleep(1)
|
| 14 |
fernet = Fernet(key)
|
| 15 |
-
print("Esto es Fernet: ", fernet)
|
| 16 |
-
|
| 17 |
string_desencriptado = fernet.decrypt(desencriptable).decode("utf-8")
|
| 18 |
|
| 19 |
-
print(f"String desencriptado: {string_desencriptado}")
|
| 20 |
-
time.sleep(5)
|
| 21 |
-
|
| 22 |
return string_desencriptado
|
|
|
|
| 4 |
|
| 5 |
def do(desencriptable):
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
#key = Fernet.generate_key()
|
| 8 |
key = nodes.key
|
|
|
|
|
|
|
| 9 |
fernet = Fernet(key)
|
|
|
|
|
|
|
| 10 |
string_desencriptado = fernet.decrypt(desencriptable).decode("utf-8")
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
return string_desencriptado
|
generador馃挕.py
CHANGED
|
@@ -3,14 +3,8 @@ import nycklar.nodes as nodes
|
|
| 3 |
from cryptography.fernet import Fernet
|
| 4 |
|
| 5 |
key = nodes.key
|
| 6 |
-
print("Esto es la KEY: ", key)
|
| 7 |
-
time.sleep(1)
|
| 8 |
fernet = Fernet(key)
|
| 9 |
-
print("Esto es Fernet: ", fernet)
|
| 10 |
|
| 11 |
string_original = "revgenlabs"
|
| 12 |
string_encriptado = fernet.encrypt(string_original.encode("utf-8"))
|
| 13 |
-
string_desencriptado = fernet.decrypt(string_encriptado).decode("utf-8")
|
| 14 |
-
|
| 15 |
-
print("Guarda esto: ", string_encriptado)
|
| 16 |
-
print("Viene de aqu铆: ", string_desencriptado)
|
|
|
|
| 3 |
from cryptography.fernet import Fernet
|
| 4 |
|
| 5 |
key = nodes.key
|
|
|
|
|
|
|
| 6 |
fernet = Fernet(key)
|
|
|
|
| 7 |
|
| 8 |
string_original = "revgenlabs"
|
| 9 |
string_encriptado = fernet.encrypt(string_original.encode("utf-8"))
|
| 10 |
+
string_desencriptado = fernet.decrypt(string_encriptado).decode("utf-8")
|
|
|
|
|
|
|
|
|