Created
May 21, 2021 21:38
-
-
Save Supermathie/0f5d4bece43050c596041c45d04e44ec to your computer and use it in GitHub Desktop.
BlackBerry e-screen unlock
This file contains hidden or 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 | |
import hmac | |
import hashlib | |
import optparse | |
import sys | |
parser = optparse.OptionParser( | |
"usage: %prog -p PIN -a 'APP VERSION' -u UPTIME [-d DURATION]") | |
parser.add_option('-p', '--pin', help='Device PIN', dest='pin') | |
parser.add_option('-a', '--app', help='OS Application Version', dest='app') | |
parser.add_option('-u', '--uptime', help='Uptime in seconds', dest='uptime') | |
parser.add_option('-d', '--duration', help='Unlock duration', dest='duration', | |
choices=('1', '3', '7', '15', '30'), default=30) | |
options, args = parser.parse_args() | |
parser.destroy() | |
if not options.pin: | |
print('You must specify a PIN') | |
sys.exit(1) | |
if not options.app: | |
print('You must specify an OS Application Version') | |
sys.exit(1) | |
if not options.uptime: | |
print('You must specify the uptime') | |
sys.exit(1) | |
lifetime = { | |
1: "", | |
3: "Hello my baby, hello my honey, hello my rag time gal", | |
7: "He was a boy, and she was a girl, can I make it any more obvious?", | |
15: "So am I, still waiting, for this world to stop hating?", | |
30: "I love myself today, not like yesterday. I'm cool, I'm calm, I'm gonna be okay" | |
} | |
secret = 'Up the time stream without a TARDIS' | |
data = options.pin + options.app + options.uptime + \ | |
lifetime[int(options.duration)] | |
magichash = hmac.new(secret, data, digestmod=hashlib.sha1) | |
key = magichash.hexdigest()[:8] | |
print(key) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment