1
0
mirror of https://github.com/minoplhy/filters-maker.git synced 2024-12-22 18:18:13 +00:00

Fixing Attempt v2-2

This commit is contained in:
minoplhy 2021-08-02 21:00:05 +07:00
commit c4b3ee71c3
4 changed files with 17 additions and 26 deletions

Binary file not shown.

View File

@ -5,14 +5,9 @@ import re
print('starting . . . ')
try:
os.remove(input)
except OSError:
pass
def download_filters(url,input):
def download_filters(url,incoming):
try:
os.remove(input)
os.remove(incoming)
except OSError:
pass
@ -20,7 +15,7 @@ def download_filters(url,input):
get = requests.get(url)
if get.status_code == requests.codes.ok:
with open(input, 'ab') as f:
with open(incoming, 'ab') as f:
for data in get:
f.write(data)
return url
@ -72,7 +67,8 @@ def killingdup(duplicated_file):
print("++ successful!")
f.close()
print('process completed.')
print('Location of your file is ' + input)
exit()
if __name__ == "__main__":
download_filters('https://filters.kylz.nl/RPZ/someonewhocares/rpz.txt','test.txt')
filtering('test.txt')
filteringcon('test.txt')
killingdup('test.txt')

View File

@ -3,9 +3,6 @@ import sys
import datetime
import pytz
excluded = sys.argv[1]
input = sys.argv[2]
UTC = pytz.utc
date = datetime.datetime.now(UTC)
@ -17,12 +14,12 @@ def linecounter():
ankstanop = linecounter()
def domainsbuilding():
def domainsbuilding(excluded ,incoming):
with open(excluded ,'r') as f:
exclude = f.read().split()
with open(input ,'r') as f:
with open(incoming ,'r') as f:
lines = f.read().splitlines() # read lines
with open(input ,'w') as f:
with open(incoming ,'w') as f:
f.write('# Title : Minoplhy Personal Blocklist\n')
f.write('# Description : My Very Personal DNS Blocklist plus crawling from the source\n')
f.write('# Source : Resources/Source.txt\n')
@ -39,5 +36,5 @@ def domainsbuilding():
f.write('\n'.join([line + '\n']))
f.close()
domainsbuilding()
exit()
if __name__ == "__main__":
domainsbuilding(None,'test.txt')

View File

@ -3,10 +3,6 @@ import sys
import datetime
import pytz
excluded = sys.argv[1]
input = sys.argv[2]
output = sys.argv[3]
UTC = pytz.utc
date = datetime.datetime.now(UTC)
@ -16,7 +12,7 @@ def linecounter():
pass
return i + 1
def RPZbuilding():
def RPZbuilding(excluded,input,output):
with open(excluded ,'r') as f:
exclude = f.read().split()
with open(input ,'r') as f:
@ -40,4 +36,6 @@ def RPZbuilding():
if not line.strip():
f.write('\n'.join([line + '\n']))
f.close()
exit()
if __name__ == "__main__":
RPZbuilding(None,'test.txt','test.rpz')