Skip to content

Instantly share code, notes, and snippets.

@0x6d61
Created July 23, 2017 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0x6d61/2c75c007bab7731541b3f9494224e742 to your computer and use it in GitHub Desktop.
Save 0x6d61/2c75c007bab7731541b3f9494224e742 to your computer and use it in GitHub Desktop.
This program creates an onion domain.
from Crypto.PublicKey import RSA
import hashlib
import base64
import sys
def OnionDomainGen():
RSAkey = RSA.generate(1024)
privateKey = RSAkey.exportKey('PEM')
publicKey = RSAkey.publickey().exportKey('DER')
hash = hashlib.sha1()
hash.update(publicKey)
sha1 = hash.digest()
return (base64.b32encode(sha1[0:10]),privateKey)
while True:
domain,key = OnionDomainGen()
print "{0}.onion".format(domain.lower())
if domain.lower().startswith(sys.argv[1]):
print "Onion Domain: {0}.onion\n".format(domain.lower())
print key
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment