os/pkgs/prison-break-url.patch

85 lines
3.6 KiB
Diff

diff --git a/prisonbreak/cli.py b/prisonbreak/cli.py
index 0add782..10eda94 100755
--- a/prisonbreak/cli.py
+++ b/prisonbreak/cli.py
@@ -31,7 +31,7 @@ from straight.plugin import load
def configure_debug(debug: bool) -> None:
- if debug:
+ if True:
logging.basicConfig(level=logging.DEBUG)
from http.client import HTTPConnection
@@ -57,7 +57,7 @@ def send_notify(message,title="Prison-Break",icon="dialog-warning-symbolic",do_n
def main():
args = docopt(__doc__)
- secret_url = "http://krebsco.de/secret" # return 1337
+ check_online_url = "http://detectportal.firefox.com/canonical.html"
profile = environ.get("CONNECTION_FILENAME", None)
timeout = float(args['--timeout'])
tries = int(args['--retry'])
@@ -123,8 +123,8 @@ def main():
s = requests.Session()
s.headers.update(
{
- "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:65.0)"
- "Gecko/20100101 Firefox/65.0"
+ "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:122.0)"
+ "Gecko/20100101 Firefox/122.0"
}
)
if wait:
@@ -133,7 +133,7 @@ def main():
for n in range(tries):
try:
- initial_response = s.get(secret_url,timeout=timeout)
+ initial_response = s.get(check_online_url,timeout=timeout)
except Timeout as t:
log.info(f"Timeout number {n+1}, waiting {timeout_wait} seconds")
continue
@@ -144,12 +144,12 @@ def main():
break
sleep(timeout_wait)
else:
- log.error(f'Unable to Retrieve the initial response after {tries} tires')
+ log.error(f'Unable to Retrieve the initial response after {tries} tries')
exit(1)
- if initial_response.text.startswith("1337"):
- log.info("Received the correct challenge token"
+ if 'nginx' == initial_response.headers.get('Server'):
+ log.info("Received the correct server header"
", assuming no captive portal")
if args['--force-token']:
log.info("Continuing even though we got the correct token!")
@@ -171,8 +171,9 @@ def main():
note("Trying to accept AGBs for you now!",title=f"Prison-Break Plugin {name}")
#notify2.Notification("Summary", "Some body text", "notification-message-im").show()
if plug.accept(initial_response, s):
+ log.debug(s.get(check_online_url,timeout=timeout).headers)
log.info(f"{name} successful?")
- if s.get(secret_url,timeout=timeout).text.startswith("1337"):
+ if 'nginx' == s.get(check_online_url,timeout=timeout).headers.get('Server'):
#notify2.Notification("Prison-Break", "Plugin {name} successful", "notification-message-im").show()
log.info(f"{name} successful!")
diff --git a/prisonbreak/plugins/wifionice.py b/prisonbreak/plugins/wifionice.py
index 1cee64d..38e5c74 100644
--- a/prisonbreak/plugins/wifionice.py
+++ b/prisonbreak/plugins/wifionice.py
@@ -58,8 +58,8 @@ def accept(resp: requests.Response, s: requests.Session) -> bool:
log.debug(f"data: {postdata}")
# TODO: detect the correct URL to query based on form path and url
- # The URL changed from http to http, and wifionice.de is now wifi.bahn.de
- resp = s.post("https://wifi.bahn.de/de/?url=http%3A%2F%2Fkrebsco.de%2Fsecret", data=postdata)
+ # The URL changed from wifi.bahn.de to login.wifionice.de
+ resp = s.post("https://login.wifionice.de/en/?url=http%3A%2F%2Fdetectportal.firefox.com%2Fcanonical.html", data=postdata)
log.debug(f"Return code: {resp.status_code}")
log.debug(resp.headers)
return resp.ok