Skip to content

Commit

Permalink
docker: tor-bridges: Fix parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
wigust committed Nov 29, 2024
1 parent 01ab58c commit 0b18247
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dotfiles/docker/tor-bridges/tor_bridges/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import json
import logging
import os
import quopri
import smtplib


Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0b18247

Please sign in to comment.