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()
@swarnimchoudhary

Copy link
Copy Markdown

is there any crack available for cold turkey micromanager too?

@Hthancder

Copy link
Copy Markdown

this work in windows 👍

import json
import sqlite3
import os

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

def activate():
conn = None
try:
conn = sqlite3.connect(DB_PATH)
c = conn.cursor()
row = c.execute("SELECT value FROM settings WHERE key = 'settings'").fetchone()

    if row is None:
        print("Key 'settings' not found. Creating default settings.")
        dat = {"additional": {"proStatus": "free"}}
    else:
        s = row[0]
        if not s:
            print("Settings value is empty. Creating default settings.")
            dat = {"additional": {"proStatus": "free"}}
        else:
            try:
                dat = json.loads(s)
            except json.JSONDecodeError:
                print("Settings JSON is corrupted or in wrong format.")
                print("Overwriting with default settings (proStatus=free).")
                dat = {"additional": {"proStatus": "free"}}

    # Toggle trạng thái pro
    current_status = dat.get("additional", {}).get("proStatus", "free")
    if current_status != "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 it again.")
    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.\nIf it is installed then run it at least once.")

if name == 'main':
main()

@JosephChomboM

Copy link
Copy Markdown

What worked for me on a Mac with an M5 chip (July 17, 2026)

These are the steps that worked for me:

  1. Create a file named main.py on your Desktop.

  2. Copy the following code into the file:

import json
import sqlite3
import os

DB_PATH = "/Library/Application Support/Cold Turkey/data-app.db"

def decode(s):
    """Decodes the custom hex layout if present in newer versions."""
    if s.startswith("CTB17"):
        data = s[5:]
        return ''.join(chr(int(data[i:i+2], 16) - 0x11) for i in range(0, len(data), 2))
    return s

def encode(s, was_encoded):
    """Re-encodes the string if the source database used custom encoding."""
    if was_encoded:
        return "CTB17" + ''.join(f'{ord(c) + 0x11:02X}' for c in s)
    return s

def activate():
    conn = None  # Explicitly initialize to avoid UnboundLocalError in finally block
    try:
        conn = sqlite3.connect(DB_PATH)
        c = conn.cursor()
        
        # Fetch current settings row
        row = c.execute("SELECT value FROM settings WHERE key = 'settings'").fetchone()
        if not row:
            print("Error: Settings payload not found inside the database.")
            return
            
        raw_string = row[0]
        was_encoded = raw_string.startswith("CTB17")
        
        # Safely extract and parse JSON payload
        decoded_string = decode(raw_string)
        dat = json.loads(decoded_string)
        
        # Safeguard structure checks
        if "additional" not in dat:
            dat["additional"] = {}

        if dat["additional"].get("proStatus") != "pro":
            print("Your version of Cold Turkey Blocker is not activated.")
            dat["additional"]["proStatus"] = "pro"
            print("Changing status to: PRO.")
            
            new_payload = encode(json.dumps(dat), was_encoded)
            c.execute("UPDATE settings SET value = ? WHERE key = 'settings'", (new_payload,))
            conn.commit()
            print("Successfully updated to Pro. Please restart Cold Turkey Blocker completely.")
        else:
            print("Looks like your copy of Cold Turkey Blocker is already activated.")
            print("Deactivating it back to Free status now.")
            dat["additional"]["proStatus"] = "free"
            
            new_payload = encode(json.dumps(dat), was_encoded)
            c.execute("UPDATE settings SET value = ? WHERE key = 'settings'", (new_payload,))
            conn.commit()
            print("Toggled back to Free successfully.")
            
    except sqlite3.Error as e:
        print("Database operation failed:", e)
        print("Tip: Make sure Cold Turkey is COMPLETELY closed down via Task Manager before running.")
    except Exception as e:
        print("An unexpected runtime error occurred:", e)
    finally:
        if conn:
            conn.close()

def main():
    if os.path.exists(DB_PATH):
        print("Data file found.\nRunning database execution sequence...")
        activate()
    else:
        print(f"File not found at: {DB_PATH}")
        print("Looks like Cold Turkey Blocker is not installed, or path differs on your environment.")

if __name__ == '__main__':
    main()
  1. Force quit Cold Turkey Blocker by pressing:
Option + Command + Esc

I did this about three times in a row, until Cold Turkey Blocker no longer appeared in the Force Quit window.

  1. Open Terminal and navigate to the folder where main.py is located. For example:
cd ~/Desktop
  1. Run the script with administrator privileges:
sudo python3 main.py

Terminal will ask for your Mac password. Nothing will appear on the screen while you type it, which is normal. Press Enter when you are done.

  1. Force quit Cold Turkey Blocker again, but this time use Activity Monitor:

    • Open Activity Monitor.
    • Find the Cold Turkey Blocker process.
    • Select it.
    • Click the X button at the top of the window.
    • Confirm that you want to quit or force quit the process.
  2. Finally, reopen Cold Turkey Blocker.

If you are lucky and everything worked correctly, Cold Turkey Blocker should now be activated.

This is simply what worked for me, so your results may vary.

@heerajsaini

heerajsaini commented Jul 19, 2026

Copy link
Copy Markdown

Microsoft Windows [Version 10.0.26200.8875]
(c) Microsoft Corporation. All rights reserved.

C:\Windows\System32>cd C:\Users\heera\Desktop

C:\Users\heera\Desktop>py main.py
Choose [mac|win]: win
WARNING -> Code is not tested for Windows.
Traceback (most recent call last):
File "C:\Users\heera\Desktop\main.py", line 91, in
main()
File "C:\Users\heera\Desktop\main.py", line 81, in main
upgrade_blocker(c)
File "C:\Users\heera\Desktop\main.py", line 47, in upgrade_blocker
data = json.loads(s)
^^^^^^^^^^^^^
File "C:\Users\heera\AppData\Local\Programs\Python\Python312\Lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\heera\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\heera\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

C:\Users\heera\Desktop>

ERROR ... ERROR ... ERROR bhenchod
please koi help karo i badly need this

@PratyayDhond

Copy link
Copy Markdown

@heerajsaini what file are you running?

  1. Create main.py and paste the code from following thread in it: https://gist.github.com/miketartar/0fc8d7bca2369ce73ea9ee7b6e0c3775?permalink_comment_id=6261418#gistcomment-6261418

  2. The only change I had to make was find the db file in my windows version:

  • Use the Run Command -> Windows Key + R to open the RUN dialogue box
  • Paste the following Path as is - C:\ProgramData\Cold Turkey if this location has data-app.db then good, else you have to locate this file on your system first.
  • Update the path in python file to this - DB_PATH = "C:\ProgramData\Cold Turkey\data-app.db"
  1. Save and run the script, it should work.

Make sure to use task manager or terminal to kill all your COLD Turkey instances first before running the script.

@crampthudreach

Copy link
Copy Markdown

@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