Compare commits

...

3 Commits

2 changed files with 17 additions and 8 deletions

View File

@ -12,7 +12,7 @@ rdlist_bot_username = "strong-password" # The password for this user
rdlist_recommended_tags = ['hub_room_links', 'hub_room_trade', 'preban', 'degen_misc', 'beastiality', 'degen_porn', 'gore', 'snuff', 'degen_larp', 'hub_room_sussy', 'bot_spam', 'cfm', 'jailbait', 'bot_porn', 'toddlercon', 'loli', 'csam', 'tfm', 'degen_meet', 'stylized_3d_loli', '3d_loli']
# User report generator
report_folder = "./reports" # Reports folder name
testing_mode = True # Prevents the incident report feature from messaging/emailing anyone besides you, also limits the number of room states are exported when generating user reports.
testing_mode = False # Prevents the incident report feature from messaging/emailing anyone besides you, also limits the number of room states are exported when generating user reports.
# Incident report email settings
smtp_user = "abuse@matrix.example.org"
smtp_password = "strong-stmp-password"

View File

@ -59,6 +59,9 @@ remove it from your electronic mailbox.
\n**********************************************************************
"""
def testing_mode_warning():
print("\nWARNING! Testing mode is enabled, this will:\n\n- Reduce the amount of data collected in user reports.\n- Slow down rdlist blocking/purging.\n- Prevent the deactivation of accounts.\n- Send incident reports to yourself instead of other homeserver admins.\n")
def get_report_folder():
# Get report_folder from hardcoded_variables
report_folder = hardcoded_variables.report_folder
@ -85,6 +88,10 @@ def zip_report_folder(user_report_folder, username):
return zip_file_name
def generate_user_report(preset_username, report_details):
# Print warning if testing mode is enabled
if hardcoded_variables.testing_mode == True:
testing_mode_warning()
if len(preset_username) == 0:
username = input("\nPlease enter the username to automatically generate a report: ")
username = user_commands.parse_username(username)
@ -237,8 +244,8 @@ def lookup_homeserver_admin(preset_baseurl):
# If baseurl is matrix.org, return 'abuse@matrix.org' as a hardcoded response
if baseurl == "matrix.org":
print("\nAdmin contact email(s) for " + baseurl + " are: abuse@matrix.org")
return {"admins": {"email_address": "abuse@matrix.org"}}, False
#print("\nAdmin contact email(s) for " + baseurl + " are: abuse@matrix.org")
return {"admins": [{"email_address": "abuse@matrix.org"}]}, False
# Check target homserver for MSC1929 support email
url = f"https://{baseurl}/.well-known/matrix/support"
@ -257,7 +264,7 @@ def lookup_homeserver_admin(preset_baseurl):
return data, False
else:
print(f"Error: Unable to collect admin contact details from server {baseurl}")
print(f"\nError: Unable to collect admin contact details from server {baseurl}")
print("Attempting to collect admin email from WHOIS data...")
# Get WHOIS data
@ -266,15 +273,17 @@ def lookup_homeserver_admin(preset_baseurl):
if w.emails:
# Check if the emails field is a list
if isinstance(w.emails, list):
return {baseurl: list(w.emails)}, True
# Create a list of dictionaries, each containing one email address
emails_dict_list = [{"email_address": email} for email in w.emails]
return {"admins": emails_dict_list}, True
# If it's not a list, it must be a single string. So, we wrap it in a list
else:
return {baseurl: [w.emails]}, True
return {"admins": [{"email_address": w.emails}]}, True
else:
print(f"\t\tError: Unable to collect admin email from WHOIS data for {baseurl}")
print(f"Error: Unable to collect admin email from WHOIS data for {baseurl}")
return None, False
except:
print(f"\t\tError: Unable to collect WHOIS data for {baseurl}")
print(f"Error: Unable to collect WHOIS data for {baseurl}")
return None, False
def send_email(email_address, email_subject, email_content, email_attachments):