os/pkgs/prison-break-url.patch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

74 lines
3.3 KiB
Diff
Raw Normal View History

2024-02-02 22:24:16 +00:00
diff --git a/prisonbreak/cli.py b/prisonbreak/cli.py
2024-02-05 11:52:18 +00:00
index 0add782..5bd51b2 100755
2024-02-02 22:24:16 +00:00
--- a/prisonbreak/cli.py
+++ b/prisonbreak/cli.py
@@ -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!")
2024-02-05 11:52:18 +00:00
@@ -172,7 +172,7 @@ def main():
2024-02-02 22:24:16 +00:00
#notify2.Notification("Summary", "Some body text", "notification-message-im").show()
if plug.accept(initial_response, s):
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