Created
June 1, 2016 14:42
-
-
Save AndersonFirmino/4dfddc9b77713d9853628d0acea37e21 to your computer and use it in GitHub Desktop.
Pequeno script Python para gerar secret keys.
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# @Date : 2016-06-01 11:21:46 | |
# @Author : Anderson Araujo ([email protected]) | |
import os, binascii, sys, clipboard | |
def main(): | |
desc = """ | |
Gerador de SECRET KEY | |
Digite um numero para o método desejado | |
1 - hexlify | |
2 - encode tipo hex | |
""" | |
print(desc) | |
choice = int(input("Escolha >> ")) | |
if choice == 1: | |
secret = binascii.hexlify(os.urandom(24)) | |
print("SECRET KEY IS: {0}".format(secret)) | |
clipboard.copy(secret) | |
elif choice == 2: | |
secret = os.urandom(24).encode('hex') | |
print("SECRET KEY IS: {0}".format(secret)) | |
clipboard.copy(secret) | |
else: | |
print("Escolha invalida, selecione 1 ou 2.") | |
sys.exit(0) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment