Skip to content

Instantly share code, notes, and snippets.

@thurask
thurask / pin_serial_convert.py
Created May 29, 2017 22:17
Convert BB PIN to (partial) serial and vice versa
def pin2serial(pin):
serial = str(int(pin, 16)).rjust(10, "0").ljust(12, "X")
return "{0}-{1}-{2}".format(serial[:4], serial[4:8], serial[8:])
def serial2pin(serial):
serial = serial.replace("-", "", 2)
return format(int(serial[:-2]), "02x").upper()
@thurask
thurask / bb_date_convert.py
Last active August 13, 2017 18:49
Convert BB DMY stamp to human readable date
def dconv(datecode):
table = "123456789ABCDEFGHIJKLMNOPQRSTUV"
dd, mm, yy = datecode.upper()
dx = table.index(dd) + 1
mx = table.index(mm) + 1
yx = table.index(yy) + 2001
return "{0}/{1:0>2}/{2:0>2}".format(yx, mx, dx)
@thurask
thurask / check_telus_updates.py
Last active May 22, 2017 16:07
Check for Telus software updates
import requests as rq
from bs4 import BeautifulSoup as bs
def grab_telus():
req = rq.get("https://forum.telus.com/t5/Mobility/Software-Update-Schedule/ta-p/53566")
soup = bs(req.text, "html.parser")
tab = soup.find("table")
trs = tab.find_all("tr")
ths = trs[0].find_all("th")
print("\t\t".join([ths[0].text, "DATE", ths[-1].text]))
@thurask
thurask / unfuck_merge_plugins.py
Created December 13, 2016 22:12
Fix plugins.txt for Merge Plugins Standalone
import os
import shutil
def set_merge_txt():
with open("plugins.txt", "r") as x:
data = x.readlines()
data[2:2] = ['*Fallout4.esm\n', '*DLCRobot.esm\n', '*DLCworkshop01.esm\n', '*DLCCoast.esm\n', '*DLCworkshop02.esm\n', '*DLCworkshop03.esm\n', '*DLCNukaWorld.esm\n']
shutil.move("plugins.txt", "plugins.txt.bak")
with open("plugins.txt", "w") as x:
x.writelines(data)
from bbarchivist import textgenerator
from bbarchivist import utilities
def darcexport(infile, osv, rdv, swv):
with open(infile, "r") as afile:
data = afile.readlines()
apps = [x.strip() for x in data if x.startswith(("com.", "sys."))]
formapps = ["{0}-{1}".format(x.split("-")[0].split(".")[-1], x.split("-")[1]) for x in apps]
baseurl = utilities.create_base_url(swv)
appurls = ["{0}/{1}-nto+armle-v7+signed.bar".format(baseurl, x) for x in formapps]
@thurask
thurask / random_bbm_pin.py
Created December 3, 2016 03:07
For scum.
import random
def random_pin():
hexa = "0123456789ABCDEF"
valid_starts = "2357"
pin = random.choice(valid_starts) + "".join(random.sample(hexa, 7))
return pin
import json
from sshsec.scanner import scan
def cleaner(some_str):
return(some_str.replace("_", " ").upper())
def scanner(host, port=22):
r = scan((host, port))
hostkeys = r["host_keys"]
ident = r["ident"]

Keybase proof

I hereby claim:

  • I am thurask on github.
  • I am thurask (https://keybase.io/thurask) on keybase.
  • I have a public key whose fingerprint is 22CC 1825 5919 9A17 7970 E352 A6CC CDEA 2979 5048

To claim this, I am signing this object:

import os
from bbarchivist import hashutils
from bbarchivist import utilities
DEBUG = False
base = "E:\Google Drive\Autoloaders\BB10"
if DEBUG:
oses = ["10.3.3.746", "10.0.9.2372"]
rads = ["10.3.3.745", "10.0.9.2373"]
@thurask
thurask / wininfo.py
Created July 16, 2016 22:01
Windows 10 build ID and date info
import datetime
import time
import winreg
import pytz
def gets():
hive = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion")
keys = ("ProductName", "ReleaseId")
info = {key: winreg.QueryValueEx(hive, key)[0] for key in keys}
blex = winreg.QueryValueEx(hive, "BuildLabEx")[0]