Skip to content
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

.vscode/
.venv/
.vscode/
39 changes: 32 additions & 7 deletions humble.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
from argparse import ArgumentParser, HelpFormatter
import re
import sys
import ssl
import json
import requests
import platform
Expand Down Expand Up @@ -87,6 +88,37 @@
now = datetime.now().strftime("%Y/%m/%d - %H:%M:%S")
version = datetime.strptime('2023-11-24', '%Y-%m-%d').date()

FORCED_CIPHERS = ":".join(
[
"ECDHE+AESGCM",
"ECDHE+CHACHA20",
"DHE+AESGCM",
"DHE+CHACHA20",
"ECDH+AESGCM",
"DH+AESGCM",
"ECDH+AES",
"DH+AES",
"RSA+AESGCM",
"RSA+AES",
"!aNULL",
"!eNULL",
"!MD5",
"!DSS",
"HIGH",
"!DH"
]
)


class SSLContextAdapter(requests.adapters.HTTPAdapter):
def init_poolmanager(self, *args, **kwargs):
context = ssl.create_default_context()
context.set_ciphers(FORCED_CIPHERS)
kwargs['ssl_context'] = context
return super(SSLContextAdapter, self).init_poolmanager(*args, **kwargs)

requests.Session().mount('http://', SSLContextAdapter())
requests.Session().mount('https://', SSLContextAdapter())

class PDF(FPDF):

Expand Down Expand Up @@ -1053,13 +1085,6 @@ def custom_help_formatter(prog):
print("")
print_detail(detail)

# Regarding 'dh key too small' errors: https://stackoverflow.com/a/41041028
requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += ':HIGH:!DH:!aNULL'
try:
requests.packages.urllib3.contrib.pyopenssl.util.ssl_.DEFAULT_CIPHERS \
+= ':HIGH:!DH:!aNULL'
except AttributeError:
pass

exception_d = {
requests.exceptions.ConnectionError: '[e_404]',
Expand Down