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
from formencode import Schema, validators, Invalid | |
from formencode.validators import FormValidator | |
class RequireAtLeastOne(FormValidator): | |
choices = [] | |
__unpackargs__ = ('choices',) | |
def _convert_to_python(self, value_dict, state): | |
for each in self.choices: | |
if value_dict.get(each) is not None: |
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
""" | |
Function that takes two values to generate a QR Code that can be scanned with LaunchKey or TOTP holder | |
@param identity: Name and place. E.g. username/Gmail | |
@param secret: The actual TOTP code | |
Saves the image locally as a png | |
Requires PIL (pillow) and qrcode | |
""" | |
def convert(self, identity, secret): | |
import re |
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
""" | |
from helpers import generate_RSA, encrypt_RSA, generate_password, decrypt_RSA, generate_AES, decrypt_AES, pad | |
priv, pub = generate_RSA() | |
encrypted = encrypt_RSA(pub, generate_password()) | |
key, iv, encryptor = generate_AES() | |
aes_encrypted = encryptor.encrypt(pad("this is a very long string " * 25)) | |
decrypt_AES(key, iv, aes_encrypted) | |
""" | |
BS = 16 |
OlderNewer