8000 remove error prone total_changes function introduced in #158 by mwoolweaver · Pull Request #163 · anudeepND/whitelist · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

remove error prone total_changes function introduced in #158 #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions scripts/uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,18 @@ def fetch_whitelist_url(url):
cursor = sqliteConnection.cursor()
print('[i] Successfully Connected to Gravity database')
total_domains = cursor.execute(" SELECT * FROM domainlist WHERE type = 0 AND comment LIKE '%qjz9zk%' ")
print("[i] There are a total of {} domains in your whitelist which are added by my script" .format(len(total_domains.fetchall())))

totalDomains = len(total_domains.fetchall())
print("[i] There are a total of {} domains in your whitelist which are added by my script" .format(totalDomains))
print('[i] Removing domains in the Gravity database')
cursor.execute (" DELETE FROM domainlist WHERE type = 0 AND comment LIKE '%qjz9zk%' ")

sqliteConnection.commit()

# total_changes is returning 2x the actual value. ¯\_(ツ)_/¯
# if I made a mistake, please create a PR
numberOfDomains = sqliteConnection.total_changes
if numberOfDomains > 1:
numberOfDomains = numberOfDomains // 2
print("[i] {} domains are removed" .format(numberOfDomains))
remaining_domains = cursor.execute(" SELECT * FROM domainlist WHERE type = 0 OR type = 2 ")
print("[i] There are a total of {} domains remaining in your whitelist" .format(len(remaining_domains.fetchall())))
# we only removed domains we added so use total_domains
print("[i] {} domains are removed" .format(totalDomains))
remaining_domains = cursor.execute(" SELECT * FROM domainlist WHERE type = 0 ") # only show exact whitelisted domains as we don't add/remove regex
print("[i] There are a total of {} domains remaining in your exact whitelist" .format(len(remaining_domains.fetchall())))

cursor.close()

Expand Down
14 changes: 7 additions & 7 deletions scripts/whitelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ def fetch_whitelist_url(url):

sqliteConnection.commit()

# total_changes is returning 2x the actual value. ¯\_(ツ)_/¯
# if I made a mistake, please create a PR
numberOfDomains = sqliteConnection.total_changes
if numberOfDomains > 1:
numberOfDomains = numberOfDomains // 2
# find only the domains we added
number_domains = cursor.execute(" SELECT * FROM domainlist WHERE type = 0 AND comment LIKE '%qjz9zk%' ")

numberDomains = len(number_domains.fetchall())

#print(f'[i] {numberOfDomains} domains are added to whitelist out of {len(whitelist_remote)}')
print("[i] {} domains are added to whitelist out of {}" .format(numberOfDomains, len(whitelist_remote)))
total_domains = cursor.execute(" SELECT * FROM domainlist WHERE type = 0 OR type = 2 ")
print("[i] {} domains are added to whitelist out of {}" .format(numberDomains, len(whitelist_remote)))
total_domains = cursor.execute(" SELECT * FROM domainlist WHERE type = 0 ") # only show exact whitelisted domains as we don't add/remove regex
#print(f'[i] There are a total of {len(total_domains.fetchall())} domains in your whitelist')
print("[i] There are a total of {} domains in your whitelist" .format(len(total_domains.fetchall())))
cursor.close()
Expand Down
0