From 0b182474c843ea6e600a03aa83177972500bbd6f Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Fri, 29 Nov 2024 21:52:03 +0300 Subject: [PATCH] docker: tor-bridges: Fix parsing. --- dotfiles/docker/tor-bridges/tor_bridges/__main__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dotfiles/docker/tor-bridges/tor_bridges/__main__.py b/dotfiles/docker/tor-bridges/tor_bridges/__main__.py index c8ff04b27..c3389c12a 100644 --- a/dotfiles/docker/tor-bridges/tor_bridges/__main__.py +++ b/dotfiles/docker/tor-bridges/tor_bridges/__main__.py @@ -22,6 +22,7 @@ import json import logging import os +import quopri import smtplib @@ -65,12 +66,12 @@ def mail_read(): for ct in email_message.walk(): payload = ct.get_payload(decode=False) if "Here is your bridge:\r\n" in payload: - lines = payload.splitlines() + lines = quopri.decodestring(payload).decode("utf-8").splitlines() out = [] for idx, x in enumerate(lines): - if "obfs4" in x: + if x.startswith("obfs4"): try: - out[:0] = ["".join([x, lines[idx + 1], lines[idx + 2]])] + out[:0] = [x] except: pass return out