Skip to content

Commit

Permalink
Now updating the fedex list
Browse files Browse the repository at this point in the history
  • Loading branch information
T145 committed Feb 17, 2024
1 parent cf97555 commit 7f10cd0
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 53 deletions.
28 changes: 28 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.bash,*.pl,*.awk,*.py]
indent_style = space
indent_size = 2

[*.bat,*.ps1]
end_of_line = crlf

[*.md]
max_line_length = off
trim_trailing_whitespace = false

# Ignore binary files
[/bin/**]
charset = unset
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_style = unset
indent_size = unset
1 change: 1 addition & 0 deletions build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -euo pipefail

pip install -r tools/requirements.txt
python tools/update-fedex-list.py
python tools/update-mono-list.py
mkdir -p built
python tools/build.py filters/main.yml --hosts built/hosts.txt --abp built/abp.txt --domains built/domains.txt
100 changes: 49 additions & 51 deletions tools/update-fedex-list.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,9 @@
import re
from urllib.parse import urlsplit

print('Begin')

class NotHostingException(Exception):
pass

with open(os.path.join(os.getcwd(), 'filters', 'fedex.yml')) as f:
saved_data = yaml.safe_load(f)
apkhost = saved_data['domains']
suffixes = saved_data['fedex-suffixes']

checkhosts = set(apkhost)

client = requests.Session()
client.timeout = 5
client.headers['User-Agent'] = 'Mozilla/5.0 (Android 10; Mobile; rv:85.0) Gecko/85.0 Firefox/85.0'

def get_link_for_domain(prev_domain):
random.shuffle(suffixes)

Expand All @@ -44,48 +31,59 @@ def get_link_for_domain(prev_domain):

return None

def run_iter(prev_domain):
download_link = get_link_for_domain(prev_domain)
if download_link is None:
print('No longer using ' + prev_domain)
checkhosts.remove(prev_domain)
return False

parsed_link = urlsplit(download_link)
if not re.match(r'^[a-z0-9]{80,}$', parsed_link.query):
print('WARNING - NEW LINK FORMAT!?: ' + download_link)
return False

new_domain = parsed_link.netloc
if new_domain.startswith('www.'):
new_domain = new_domain[4:]

if new_domain not in apkhost:
link_get = client.get(download_link)
if link_get.status_code == 200:
print('New link: ' + download_link)

suffix_match = re.match(r'^/([a-z]+)/$', parsed_link.path)

if not suffix_match:
print('WARNING - NEW SUFFIX FORMAT - NOT ADDING TO LIST: ' + download_link)
return False
if __name__ == '__main__':
with open(os.path.join(os.getcwd(), 'filters', 'fedex.yml')) as f:
saved_data = yaml.safe_load(f)
apkhost = saved_data['domains']
suffixes = saved_data['fedex-suffixes']

checkhosts = set(apkhost)

client = requests.Session()
client.timeout = 5
client.headers['User-Agent'] = 'Mozilla/5.0 (Android 10; Mobile; rv:85.0) Gecko/85.0 Firefox/85.0'

def run_iter(prev_domain):
download_link = get_link_for_domain(prev_domain)
if download_link is None:
print('No longer using ' + prev_domain)
checkhosts.remove(prev_domain)
return False

parsed_link = urlsplit(download_link)
if not re.match(r'^[a-z0-9]{80,}$', parsed_link.query):
print('WARNING - NEW LINK FORMAT!?: ' + download_link)
return False

new_domain = parsed_link.netloc
if new_domain.startswith('www.'):
new_domain = new_domain[4:]

if new_domain not in apkhost:
link_get = client.get(download_link)
if link_get.status_code == 200:
print('New link: ' + download_link)

suffix_match = re.match(r'^/([a-z]+)/$', parsed_link.path)

if suffix_match.group(1) not in suffixes:
print('NEW SUFFIX!: ' + suffix_match.group(1))
suffixes.append(suffix_match.group(1))

apkhost.append(new_domain)
checkhosts.add(new_domain)
return True
if not suffix_match:
print('WARNING - NEW SUFFIX FORMAT - NOT ADDING TO LIST: ' + download_link)
return False

if suffix_match.group(1) not in suffixes:
print('NEW SUFFIX!: ' + suffix_match.group(1))
suffixes.append(suffix_match.group(1))

apkhost.append(new_domain)
checkhosts.add(new_domain)
return True
else:
print('Resolved nonworking link: ' + download_link)
return False
else:
print('Resolved nonworking link: ' + download_link)
print('Nothing new')
return False
else:
print('Nothing new')
return False

if __name__ == '__main__':
try:
while len(checkhosts) > 0:
prev_domain = random.choice(list(checkhosts))
Expand Down
2 changes: 1 addition & 1 deletion tools/update-mono-list.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

if __name__ == '__main__':
psl = PublicSuffixList()

filter_file = os.path.join(os.getcwd(), 'filters', 'mono.yml')

with open(filter_file) as f:
saved_data = yaml.safe_load(f)
known_domains = set(saved_data['domains'])
Expand Down
2 changes: 1 addition & 1 deletion tools/update-prizes-list.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def is_prize_domain(domain):
hostnames = [x for x in sorted(pending_domains) if not x.endswith('.live')]
for hostname in hostnames:
hostname = hostname.strip()

try:
print('Test %s' % hostname)
if is_prize_domain(hostname):
Expand Down

0 comments on commit 7f10cd0

Please sign in to comment.