Skip to content

Commit

Permalink
caution commit
Browse files Browse the repository at this point in the history
  • Loading branch information
senju-hashirama committed Dec 17, 2023
1 parent 5ba29c5 commit 9536819
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions focus.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#! /bin/python
import os
import argparse
from pathlib import Path

def main(gargs):
print(gargs)

if gargs.Deactivate:

sites = ["www.instagram.com"]
Expand All @@ -28,9 +29,10 @@ def main(gargs):
data[hosts] = data[hosts][1:]
if [i.strip() for i in data[hosts].split()[1:]]!=sites:
print("resetting")
host.seek(0,0)
data[hosts]="127.0.0.1 {}\n".format(" ".join(sites))
host.seek(0)
data[hosts]="127.0.0.1 {}\n\n".format(" ".join(sites))
host.writelines(data)
host.truncate()
else:
print(data)
host.seek(0,0)
Expand Down Expand Up @@ -58,5 +60,6 @@ def main(gargs):
parser = argparse.ArgumentParser()
parser.add_argument("-f","--File", help="Text file with all domains to block")
parser.add_argument("-d", "--Deactivate", help="Deactivate focus", action="store_false")
parser.add_argument("-s","--Site",help="Block a particular website")
args = parser.parse_args()
main(args)
3 changes: 2 additions & 1 deletion sites.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
www.youtube.com
www.instagram.com
www.tetris.com
www.anix.to
anix.to

0 comments on commit 9536819

Please sign in to comment.