mirror of https://gitlab.com/bashrc2/epicyon
More mitm detection
parent
683cc9bc7e
commit
22a858b813
|
@ -24,6 +24,7 @@ from httpcodes import http_404
|
|||
from announce import create_announce
|
||||
from posts import save_post_to_box
|
||||
from daemon_utils import post_to_outbox
|
||||
from daemon_utils import detect_mitm
|
||||
from fitnessFunctions import fitness_performance
|
||||
from follow import follower_approval_active
|
||||
from webapp_post import individual_post_as_html
|
||||
|
@ -212,9 +213,11 @@ def announce_button(self, calling_domain: str, path: str,
|
|||
timezone = None
|
||||
if account_timezone.get(self.post_to_nickname):
|
||||
timezone = account_timezone.get(self.post_to_nickname)
|
||||
mitm = False
|
||||
if os.path.isfile(announce_filename.replace('.json', '') +
|
||||
'.mitm'):
|
||||
mitm = detect_mitm(self)
|
||||
if not mitm:
|
||||
mitm_filename = \
|
||||
announce_filename.replace('.json', '') + '.mitm'
|
||||
if os.path.isfile(mitm_filename):
|
||||
mitm = True
|
||||
bold_reading = False
|
||||
if bold_reading_nicknames.get(self.post_to_nickname):
|
||||
|
|
|
@ -25,6 +25,7 @@ from bookmarks import undo_bookmark_post
|
|||
from follow import follower_approval_active
|
||||
from webapp_post import individual_post_as_html
|
||||
from fitnessFunctions import fitness_performance
|
||||
from daemon_utils import detect_mitm
|
||||
|
||||
|
||||
def bookmark_button(self, calling_domain: str, path: str,
|
||||
|
@ -167,9 +168,11 @@ def bookmark_button(self, calling_domain: str, path: str,
|
|||
timezone = None
|
||||
if account_timezone.get(self.post_to_nickname):
|
||||
timezone = account_timezone.get(self.post_to_nickname)
|
||||
mitm = False
|
||||
if os.path.isfile(bookmark_filename.replace('.json', '') +
|
||||
'.mitm'):
|
||||
mitm = detect_mitm(self)
|
||||
if not mitm:
|
||||
mitm_filename = \
|
||||
bookmark_filename.replace('.json', '') + '.mitm'
|
||||
if os.path.isfile(mitm_filename):
|
||||
mitm = True
|
||||
bold_reading = False
|
||||
if bold_reading_nicknames.get(self.post_to_nickname):
|
||||
|
@ -372,9 +375,11 @@ def bookmark_button_undo(self, calling_domain: str, path: str,
|
|||
timezone = None
|
||||
if account_timezone.get(self.post_to_nickname):
|
||||
timezone = account_timezone.get(self.post_to_nickname)
|
||||
mitm = False
|
||||
if os.path.isfile(bookmark_filename.replace('.json', '') +
|
||||
'.mitm'):
|
||||
mitm = detect_mitm(self)
|
||||
if not mitm:
|
||||
mitm_filename = \
|
||||
bookmark_filename.replace('.json', '') + '.mitm'
|
||||
if os.path.isfile(mitm_filename):
|
||||
mitm = True
|
||||
bold_reading = False
|
||||
if bold_reading_nicknames.get(self.post_to_nickname):
|
||||
|
|
|
@ -27,6 +27,7 @@ from posts import get_original_post_from_announce_url
|
|||
from fitnessFunctions import fitness_performance
|
||||
from like import update_likes_collection
|
||||
from webapp_post import individual_post_as_html
|
||||
from daemon_utils import detect_mitm
|
||||
|
||||
|
||||
def like_button(self, calling_domain: str, path: str,
|
||||
|
@ -214,9 +215,11 @@ def like_button(self, calling_domain: str, path: str,
|
|||
timezone = None
|
||||
if account_timezone.get(self.post_to_nickname):
|
||||
timezone = account_timezone.get(self.post_to_nickname)
|
||||
mitm = False
|
||||
if os.path.isfile(liked_post_filename.replace('.json', '') +
|
||||
'.mitm'):
|
||||
mitm = detect_mitm(self)
|
||||
if not mitm:
|
||||
mitm_filename = \
|
||||
liked_post_filename.replace('.json', '') + '.mitm'
|
||||
if os.path.isfile(mitm_filename):
|
||||
mitm = True
|
||||
bold_reading = False
|
||||
if bold_reading_nicknames.get(self.post_to_nickname):
|
||||
|
@ -463,9 +466,11 @@ def like_button_undo(self, calling_domain: str, path: str,
|
|||
timezone = None
|
||||
if account_timezone.get(self.post_to_nickname):
|
||||
timezone = account_timezone.get(self.post_to_nickname)
|
||||
mitm = False
|
||||
if os.path.isfile(liked_post_filename.replace('.json', '') +
|
||||
'.mitm'):
|
||||
mitm = detect_mitm(self)
|
||||
if not mitm:
|
||||
mitm_filename = \
|
||||
liked_post_filename.replace('.json', '') + '.mitm'
|
||||
if os.path.isfile(mitm_filename):
|
||||
mitm = True
|
||||
bold_reading = False
|
||||
if bold_reading_nicknames.get(self.post_to_nickname):
|
||||
|
|
|
@ -22,6 +22,7 @@ from blocking import mute_post
|
|||
from follow import follower_approval_active
|
||||
from webapp_post import individual_post_as_html
|
||||
from fitnessFunctions import fitness_performance
|
||||
from daemon_utils import detect_mitm
|
||||
|
||||
|
||||
def mute_button(self, calling_domain: str, path: str,
|
||||
|
@ -129,9 +130,11 @@ def mute_button(self, calling_domain: str, path: str,
|
|||
timezone = None
|
||||
if account_timezone.get(nickname):
|
||||
timezone = account_timezone.get(nickname)
|
||||
mitm = False
|
||||
if os.path.isfile(mute_filename.replace('.json', '') +
|
||||
'.mitm'):
|
||||
mitm = detect_mitm(self)
|
||||
if not mitm:
|
||||
mitm_filename = \
|
||||
mute_filename.replace('.json', '') + '.mitm'
|
||||
if os.path.isfile(mitm_filename):
|
||||
mitm = True
|
||||
bold_reading = False
|
||||
if bold_reading_nicknames.get(nickname):
|
||||
|
@ -301,9 +304,11 @@ def mute_button_undo(self, calling_domain: str, path: str,
|
|||
timezone = None
|
||||
if account_timezone.get(nickname):
|
||||
timezone = account_timezone.get(nickname)
|
||||
mitm = False
|
||||
if os.path.isfile(mute_filename.replace('.json', '') +
|
||||
'.mitm'):
|
||||
mitm = detect_mitm(self)
|
||||
if not mitm:
|
||||
mitm_filename = \
|
||||
mute_filename.replace('.json', '') + '.mitm'
|
||||
if os.path.isfile(mitm_filename):
|
||||
mitm = True
|
||||
bold_reading = False
|
||||
if bold_reading_nicknames.get(nickname):
|
||||
|
|
|
@ -24,6 +24,7 @@ from session import establish_session
|
|||
from httpcodes import http_404
|
||||
from posts import get_original_post_from_announce_url
|
||||
from daemon_utils import post_to_outbox
|
||||
from daemon_utils import detect_mitm
|
||||
from fitnessFunctions import fitness_performance
|
||||
from reaction import update_reaction_collection
|
||||
from follow import follower_approval_active
|
||||
|
@ -243,9 +244,11 @@ def reaction_button(self, calling_domain: str, path: str,
|
|||
timezone = None
|
||||
if account_timezone.get(self.post_to_nickname):
|
||||
timezone = account_timezone.get(self.post_to_nickname)
|
||||
mitm = False
|
||||
if os.path.isfile(reaction_post_filename.replace('.json', '') +
|
||||
'.mitm'):
|
||||
mitm = detect_mitm(self)
|
||||
if not mitm:
|
||||
mitm_filename = \
|
||||
reaction_post_filename.replace('.json', '') + '.mitm'
|
||||
if os.path.isfile(mitm_filename):
|
||||
mitm = True
|
||||
bold_reading = False
|
||||
if bold_reading_nicknames.get(self.post_to_nickname):
|
||||
|
@ -514,9 +517,11 @@ def reaction_button_undo(self, calling_domain: str, path: str,
|
|||
timezone = None
|
||||
if account_timezone.get(self.post_to_nickname):
|
||||
timezone = account_timezone.get(self.post_to_nickname)
|
||||
mitm = False
|
||||
if os.path.isfile(reaction_post_filename.replace('.json', '') +
|
||||
'.mitm'):
|
||||
mitm = detect_mitm(self)
|
||||
if not mitm:
|
||||
mitm_filename = \
|
||||
reaction_post_filename.replace('.json', '') + '.mitm'
|
||||
if os.path.isfile(mitm_filename):
|
||||
mitm = True
|
||||
bold_reading = False
|
||||
if bold_reading_nicknames.get(self.post_to_nickname):
|
||||
|
|
|
@ -47,6 +47,7 @@ from fitnessFunctions import fitness_performance
|
|||
from securemode import secure_mode
|
||||
from context import get_individual_post_context
|
||||
from conversation import convthread_id_to_conversation_tag
|
||||
from daemon_utils import detect_mitm
|
||||
|
||||
|
||||
def _show_post_from_file(self, post_filename: str, liked_by: str,
|
||||
|
@ -121,9 +122,11 @@ def _show_post_from_file(self, post_filename: str, liked_by: str,
|
|||
if account_timezone.get(nickname):
|
||||
timezone = account_timezone.get(nickname)
|
||||
|
||||
mitm = False
|
||||
if os.path.isfile(post_filename.replace('.json', '') +
|
||||
'.mitm'):
|
||||
mitm = detect_mitm(self)
|
||||
if not mitm:
|
||||
mitm_filename = \
|
||||
post_filename.replace('.json', '') + '.mitm'
|
||||
if os.path.isfile(mitm_filename):
|
||||
mitm = True
|
||||
|
||||
bold_reading = False
|
||||
|
|
|
@ -207,7 +207,7 @@ def post_to_outbox_thread(self, message_json: {},
|
|||
return True
|
||||
|
||||
|
||||
def _detect_mitm(self) -> bool:
|
||||
def detect_mitm(self) -> bool:
|
||||
"""Detect if a request contains a MiTM
|
||||
"""
|
||||
mitm_domains = ['cloudflare']
|
||||
|
@ -524,7 +524,7 @@ def update_inbox_queue(self, nickname: str, message_json: {},
|
|||
self.server.blocked_cache_last_updated,
|
||||
self.server.blocked_cache_update_secs)
|
||||
|
||||
mitm = _detect_mitm(self)
|
||||
mitm = detect_mitm(self)
|
||||
|
||||
if debug:
|
||||
print('INBOX: saving post to queue')
|
||||
|
|
Loading…
Reference in New Issue