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()
@svalordev
Copy link

Thank you so much guys for this 🙏😭

@Skibbyskib
Copy link

Thank you so much it works

@RajDas099
Copy link

This script works for the latest version (4.9):

import json
import sqlite3

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)

conn = sqlite3.connect(DB_PATH)
c = conn.cursor()
raw = c.execute("SELECT value FROM settings WHERE key = 'settings'").fetchone()[0]
dat = json.loads(decode(raw))
dat["additional"]["proStatus"] = "free" if dat["additional"]["proStatus"] == "pro" else "pro"
c.execute("UPDATE settings SET value = ? WHERE key = 'settings'", (encode(json.dumps(dat)),))
conn.commit()
conn.close()
print("Toggled to:", dat["additional"]["proStatus"])

HEROOO!!!

@RajDas099
Copy link

It worked for the latest 4.9

@Benjamin9864
Copy link

Why wouldnt this work on mac?? ˙◠˙

@M1NGJ0
Copy link

M1NGJ0 commented Mar 11, 2026

For people who are having trouble because the link for 4.5 is down. I have created a step by step guide:

Step 1:
Keep your Cold Turkey Version 4.9 and open notepad

Step 2:
Create a new note and paste this in:
import json
import sqlite3

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)

conn = sqlite3.connect(DB_PATH)
c = conn.cursor()
raw = c.execute("SELECT value FROM settings WHERE key = 'settings'").fetchone()[0]
dat = json.loads(decode(raw))
dat["additional"]["proStatus"] = "free" if dat["additional"]["proStatus"] == "pro" else "pro"
c.execute("UPDATE settings SET value = ? WHERE key = 'settings'", (encode(json.dumps(dat)),))
conn.commit()
conn.close()
print("Toggled to:", dat["additional"]["proStatus"])

After that, press ctrl,shift,s and save in downloads as main,py as the name.

VERY IMPORTANT STEP or it won't work: you have to go to task manager and end cold turkey as the task and after you have run the code and it said toggled to pro, only then you open cold turkey and it will work
go to command prompt and type this, py main.py it will say toggled to pro and there you go, you have a pro version of cold turkey for free. THANK YOU SO MUCH to @Someone45 because he was the one who had the updated code and gave it to us

@inamorously
Copy link

Doesn't seem to be an equivalent file for data-app.db on macos. Am I stupid? Help

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