Skip to content

Instantly share code, notes, and snippets.

@AndersonFirmino
Created June 1, 2016 14:42
Show Gist options
  • Save AndersonFirmino/4dfddc9b77713d9853628d0acea37e21 to your computer and use it in GitHub Desktop.
Save AndersonFirmino/4dfddc9b77713d9853628d0acea37e21 to your computer and use it in GitHub Desktop.
Pequeno script Python para gerar secret keys.
#!/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