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

still working?

@aihealthtracker
Copy link

working

@Youssef-Amhend
Copy link

just so that it doesn't close .

@Youssef-Amhend
Copy link

Youssef-Amhend commented Sep 15, 2025

The above code does not work for me. ^

However, I found a way that is more simple but does require a little bit of effort. This is for WINDOWS ONLY. (Tested on Windows 11 24H2). You will also be using Python (Just running a simple script, I promise!)

  1. Download version 4.5 of Cold Turkey Blocker from this link: https://cold-turkey.en.uptodown.com/windows/download/1030193999
  2. Run the .exe and install it. Open the program at least once.
  3. Go to this link and download the python script. (On the right hand side there should be a download icon saying "Download Raw File". It's the second icon over from where it says RAW. https://github.com/arv-anshul/ColdTurkeyBlocker-Pro/blob/main/main.py
  4. Install Python for Windows and all its necessary dependencies. https://www.python.org/downloads/windows/
  5. Locate the main.py file you downloaded from step 3. Right click anywhere in the empty space in wherever you have it and select "Open in Terminal". MAKE SURE YOU ARE RUNNING TERMINAL IN ADMINISTRATOR.
  6. Now type in the terminal "py main.py" but without the quotation marks.
  7. Your Cold Turkey Blocker will now become Pro.
  8. Now you can install the higher version (4.7 from the time of this writing). The pro license will carry over to the newer version.
  9. Profit.

for those that already had v 4.7 and wanted to uninstall it but when they do it normally it doesn't want to work (when you go to the previous version it throws these problems :

Error Reading Database
The database where your settings are stored is locked and can't be read. Try opening Cold Turkey Blocker in a few seconds.
) .

go to this link and then download this [ removal tool ] https://getcoldturkey.com/support/reinstall-instructions/ from cold turkey . and then follow these steps listed up and it will work .

@deepdeyiitgn
Copy link

but this is illegal, so is any legal risk if i do this ?

@MayukXT
Copy link

MayukXT commented Oct 30, 2025

but this is illegal, so is any legal risk if i do this ?

bro! are you really an IITan?
If you so really care for legality then just buy the software.

@babukre1
Copy link

The above code does not work for me. ^

However, I found a way that is more simple but does require a little bit of effort. This is for WINDOWS ONLY. (Tested on Windows 11 24H2). You will also be using Python (Just running a simple script, I promise!)

  1. Download version 4.5 of Cold Turkey Blocker from this link: https://cold-turkey.en.uptodown.com/windows/download/1030193999
  2. Run the .exe and install it. Open the program at least once.
  3. Go to this link and download the python script. (On the right hand side there should be a download icon saying "Download Raw File". It's the second icon over from where it says RAW. https://github.com/arv-anshul/ColdTurkeyBlocker-Pro/blob/main/main.py
  4. Install Python for Windows and all its necessary dependencies. https://www.python.org/downloads/windows/
  5. Locate the main.py file you downloaded from step 3. Right click anywhere in the empty space in wherever you have it and select "Open in Terminal". MAKE SURE YOU ARE RUNNING TERMINAL IN ADMINISTRATOR.
  6. Now type in the terminal "py main.py" but without the quotation marks.
  7. Your Cold Turkey Blocker will now become Pro.
  8. Now you can install the higher version (4.7 from the time of this writing). The pro license will carry over to the newer version.
  9. Profit.

this method worked for me. as i am using 4.5 version and after it worked i installed the latest version and still works ✅

@Emmxx24
Copy link

Emmxx24 commented Nov 4, 2025

this is the more updated version:

import json
import sqlite3
import os

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

def activate():
    conn = None  # Initialize conn to None to handle exceptions during connection
    try:
        conn = sqlite3.connect(DB_PATH)
        c = conn.cursor()
        
        # Fetch settings
        result = c.execute("SELECT value FROM settings WHERE key = 'settings'").fetchone()
        if not result:
            print("No settings found in the database.")
            return
        
        s = result[0]
        dat = json.loads(s)
        
        # Check and update proStatus
        additional = dat.setdefault("additional", {})  # Safely get 'additional' key
        if additional.get("proStatus") != "pro":
            print("Your version of Cold Turkey Blocker is not activated.")
            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.")
            additional["proStatus"] = "free"
        
        # Update the database
        c.execute("UPDATE settings SET value = ? WHERE key = 'settings'", (json.dumps(dat),))
        conn.commit()

    except sqlite3.Error as e:
        print("Failed to activate:", e)
    except json.JSONDecodeError as e:
        print("Failed to parse settings JSON:", e)
    except KeyError as e:
        print("Key error in settings data:", 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, please run it at least once.")

if __name__ == '__main__':
    main()

has worked for cold turkey 4.5

Could not find platform independent libraries
Data file found.
Let's activate your copy of Cold Turkey Blocker.
Failed to parse settings JSON: Expecting value: line 1 column 1 (char 0)

help plsss

@Vishwak-vss
Copy link

dumbo, its supposed to be in py file not the cmd.

@kroenenth
Copy link

kroenenth commented Nov 17, 2025

The above code does not work for me. ^

However, I found a way that is more simple but does require a little bit of effort. This is for WINDOWS ONLY. (Tested on Windows 11 24H2). You will also be using Python (Just running a simple script, I promise!)

  1. Download version 4.5 of Cold Turkey Blocker from this link: https://cold-turkey.en.uptodown.com/windows/download/1030193999
  2. Run the .exe and install it. Open the program at least once.
  3. Go to this link and download the python script. (On the right hand side there should be a download icon saying "Download Raw File". It's the second icon over from where it says RAW. https://github.com/arv-anshul/ColdTurkeyBlocker-Pro/blob/main/main.py
  4. Install Python for Windows and all its necessary dependencies. https://www.python.org/downloads/windows/
  5. Locate the main.py file you downloaded from step 3. Right click anywhere in the empty space in wherever you have it and select "Open in Terminal". MAKE SURE YOU ARE RUNNING TERMINAL IN ADMINISTRATOR.
  6. Now type in the terminal "py main.py" but without the quotation marks.
  7. Your Cold Turkey Blocker will now become Pro.
  8. Now you can install the higher version (4.7 from the time of this writing). The pro license will carry over to the newer version.
  9. Profit.

i'm getting this error in cmd
WARNING -> Code is not tested for Windows.
Traceback (most recent call last):
File "C:\Users\Rithvik\Downloads\main.py", line 91, in
main()
~~~~^^
File "C:\Users\Rithvik\Downloads\main.py", line 81, in main
upgrade_blocker(c)
~~~~~~~~~~~~~~~^^^
File "C:\Users\Rithvik\Downloads\main.py", line 47, in upgrade_blocker
data = json.loads(s)
File "C:\Users\Rithvik\AppData\Local\Programs\Python\Python313\Lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
~~~~~~~~~~~~~~~~~~~~~~~^^^
File "C:\Users\Rithvik\AppData\Local\Programs\Python\Python313\Lib\json\decoder.py", line 345, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Rithvik\AppData\Local\Programs\Python\Python313\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)

plssss help! (and pls tell which version to download 4.6 or 4.7)

@JohnnyMysterious
Copy link

The above code does not work for me. ^

However, I found a way that is more simple but does require a little bit of effort. This is for WINDOWS ONLY. (Tested on Windows 11 24H2). You will also be using Python (Just running a simple script, I promise!)

  1. Download version 4.5 of Cold Turkey Blocker from this link: https://cold-turkey.en.uptodown.com/windows/download/1030193999
  2. Run the .exe and install it. Open the program at least once.
  3. Go to this link and download the python script. (On the right hand side there should be a download icon saying "Download Raw File". It's the second icon over from where it says RAW. https://github.com/arv-anshul/ColdTurkeyBlocker-Pro/blob/main/main.py
  4. Install Python for Windows and all its necessary dependencies. https://www.python.org/downloads/windows/
  5. Locate the main.py file you downloaded from step 3. Right click anywhere in the empty space in wherever you have it and select "Open in Terminal". MAKE SURE YOU ARE RUNNING TERMINAL IN ADMINISTRATOR.
  6. Now type in the terminal "py main.py" but without the quotation marks.
  7. Your Cold Turkey Blocker will now become Pro.
  8. Now you can install the higher version (4.7 from the time of this writing). The pro license will carry over to the newer version.
  9. Profit.

Works perfectly as of 21/11/2025
Thanks!!

@JustaTurtle21
Copy link

JustaTurtle21 commented Nov 23, 2025 via email

@OfcMJ
Copy link

OfcMJ commented Nov 26, 2025

The above code does not work for me. ^
However, I found a way that is more simple but does require a little bit of effort. This is for WINDOWS ONLY. (Tested on Windows 11 24H2). You will also be using Python (Just running a simple script, I promise!)

  1. Download version 4.5 of Cold Turkey Blocker from this link: https://cold-turkey.en.uptodown.com/windows/download/1030193999
  2. Run the .exe and install it. Open the program at least once.
  3. Go to this link and download the python script. (On the right hand side there should be a download icon saying "Download Raw File". It's the second icon over from where it says RAW. https://github.com/arv-anshul/ColdTurkeyBlocker-Pro/blob/main/main.py
  4. Install Python for Windows and all its necessary dependencies. https://www.python.org/downloads/windows/
  5. Locate the main.py file you downloaded from step 3. Right click anywhere in the empty space in wherever you have it and select "Open in Terminal". MAKE SURE YOU ARE RUNNING TERMINAL IN ADMINISTRATOR.
  6. Now type in the terminal "py main.py" but without the quotation marks.
  7. Your Cold Turkey Blocker will now become Pro.
  8. Now you can install the higher version (4.7 from the time of this writing). The pro license will carry over to the newer version.
  9. Profit.

for those that already had v 4.7 and wanted to uninstall it but when they do it normally it doesn't want to work (when you go to the previous version it throws these problems :

Error Reading Database
The database where your settings are stored is locked and can't be read. Try opening Cold Turkey Blocker in a few seconds.
) .

go to this link and then download this [ removal tool ] https://getcoldturkey.com/support/reinstall-instructions/ from cold turkey . and then follow these steps listed up and it will work .

Thanks so much!!!!! It works!!! 26-11-2025

@KAIKOAUGUSTIN
Copy link

^ Worked, 02/12/2025

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