Skip to content

Instantly share code, notes, and snippets.

@miketartar
Created September 26, 2020 04:21
Show Gist options
  • Select an option

  • Save miketartar/0fc8d7bca2369ce73ea9ee7b6e0c3775 to your computer and use it in GitHub Desktop.

Select an option

Save miketartar/0fc8d7bca2369ce73ea9ee7b6e0c3775 to your computer and use it in GitHub Desktop.
Cold Turkey Blocker Activator
import json
import sqlite3
import os
DB_PATH = "C:/ProgramData/Cold Turkey/data-app.db"
def activate():
try:
conn = sqlite3.connect(DB_PATH)
c = conn.cursor()
s = c.execute("SELECT value FROM settings WHERE key = 'settings'").fetchone()[0]
dat = json.loads(s)
if dat["additional"]["proStatus"] != "pro":
print("Your version of Cold Turkey Blocker is not activated.")
dat["additional"]["proStatus"] = "pro"
print("But now it is activated.\nPlease close Cold Turkey Blocker and run again it.")
c.execute("""UPDATE settings SET value = ? WHERE "key" = 'settings'""", (json.dumps(dat),))
conn.commit()
else:
print("Looks like your copy of Cold Turkey Blocker is already activated.")
print("Deactivating it now.")
dat["additional"]["proStatus"] = "free"
c.execute("""UPDATE settings set value = ? WHERE "key" = 'settings'""", (json.dumps(dat),))
conn.commit()
except sqlite3.Error as e:
print("Failed to activate", e)
finally:
if conn:
conn.close()
def main():
if os.path.exists(DB_PATH):
print("Data file found.\nLet's activate your copy of Cold Turkey Blocker.")
activate()
else:
print("Looks like Cold Turkey Blocker is not installed.\n If it is installed then run it at least once.")
if __name__ == '__main__':
main()
@sekai98-dev

Copy link
Copy Markdown

I found another script if anyone is having problems with the encryption system on windows :

import json
import sqlite3
import os

DB_PATH = "C:/ProgramData/Cold Turkey/data-app.db"

def decode(s):
data = s[5:]
return ''.join(chr(int(data[i:i+2], 16) - 0x11) for i in range(0, len(data), 2))

def encode(s):
return "CTB17" + ''.join(f'{ord(c) + 0x11:02X}' for c in s)

def activate():
conn = None
try:
conn = sqlite3.connect(DB_PATH)
c = conn.cursor()

    raw_data = c.execute("SELECT value FROM settings WHERE key = 'settings'").fetchone()[0]
    

    if raw_data.startswith("CTB17"):
        s = decode(raw_data)
    else:
        s = raw_data
        
    dat = json.loads(s)

    if dat["additional"]["proStatus"] != "pro":
        print("not activated.")
        dat["additional"]["proStatus"] = "pro"
        
   
        final_val = encode(json.dumps(dat))
        c.execute("""UPDATE settings SET value = ? WHERE "key" = 'settings'""", (final_val,))
        conn.commit()
        print("activated \n close Cold Turkey Blocker completely and run it again.")
    else:
        print(" already activated.")
        print("Deactivating it .")
        dat["additional"]["proStatus"] = "free"
        final_val = encode(json.dumps(dat))
        c.execute("""UPDATE settings set value = ? WHERE "key" = 'settings'""", (final_val,))
        conn.commit()
        
except sqlite3.Error as e:
    print("Failed to activate due to database issue:", e)
except Exception as e:
    print("An error occurred during activation:", e)
finally:
    if conn:
        conn.close()

def main():
if os.path.exists(DB_PATH):
print("Data file found.\n activating your copy of Cold Turkey Blocker.")
activate()
else:
print("Cold Turkey Blocker is not installed.\nIf it is installed, then run it at least once.")

if name == 'main':
main()

@hacker35677

hacker35677 commented Aug 21, 2026

Copy link
Copy Markdown

not working :(

@teddyhoss

teddyhoss commented Aug 28, 2026

Copy link
Copy Markdown

i made an updated version of the script tested on latest version.

https://github.com/teddyhoss/cold-turkey-blocker-activator-pro

My script can bypass encryption

@lather-rewire-omit

lather-rewire-omit commented Sep 1, 2026

Copy link
Copy Markdown

@SheikOLin01

Copy link
Copy Markdown

PS C:\Users\beare\AppData\Local\Programs\Microsoft VS Code> & C:\Users\beare\AppData\Local\Python\pythoncore-3.14-64\python.exe c:/Users/beare/Documents/ColdTurkeyBlockerActivator.py
Data file found.
Let's activate your copy of Cold Turkey Blocker.
Traceback (most recent call last):
File "c:\Users\beare\Documents\ColdTurkeyBlockerActivator.py", line 41, in
main()
~~~~^^
File "c:\Users\beare\Documents\ColdTurkeyBlockerActivator.py", line 36, in main
activate()
~~~~~~~~^^
File "c:\Users\beare\Documents\ColdTurkeyBlockerActivator.py", line 12, in activate
dat = json.loads(s)
File "C:\Users\beare\AppData\Local\Python\pythoncore-3.14-64\Lib\json_init_.py", line 352, in loads
return _default_decoder.decode(s)
~~~~~~~~~~~~~~~~~~~~~~~^^^
File "C:\Users\beare\AppData\Local\Python\pythoncore-3.14-64\Lib\json\decoder.py", line 345, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\beare\AppData\Local\Python\pythoncore-3.14-64\Lib\json\decoder.py", line 363, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
PS C:\Users\beare\AppData\Local\Programs\Microsoft VS Code>

@enslave-icky

Copy link
Copy Markdown

@uncork-pry

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment