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