Skip to content

Instantly share code, notes, and snippets.

@jettero
Created October 31, 2016 12:58
Show Gist options
  • Save jettero/d5f4db653a055585012c3075e14132ff to your computer and use it in GitHub Desktop.
Save jettero/d5f4db653a055585012c3075e14132ff to your computer and use it in GitHub Desktop.
teamspeak password encoder
#!/usr/bin/env python3
# coding: UTF-8
# I found that I could select the server admin password in the sqlite3 database
# and I could update/change it, but just what is that annoying encoding? It's mime...
# decodes to 20 bytes...
#
# Ahh, it's base64(sha1()) unsalted
import hashlib
import base64
def encode_pass(x):
sha1 = hashlib.sha1()
sha1.update(x.encode())
return base64.encodebytes(sha1.digest()).decode().strip()
if __name__ == "__main__":
import getpass
p = getpass.getpass("pass: ")
e = encode_pass(p)
print( e )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment