From c48fe4f7152bdeccab3ed522ce671fe9935244b1 Mon Sep 17 00:00:00 2001 From: PC-Admin Date: Wed, 19 Jul 2023 06:01:40 +0800 Subject: [PATCH] update roadmap and make the menu prettier --- README.md | 32 ++++++++++++++++++-------------- moderation_tool.py | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index c736a94..f847c7b 100755 --- a/README.md +++ b/README.md @@ -74,26 +74,30 @@ With the popular [matrix-docker-ansible-deploy](https://github.com/spantaleev/ma ## Roadmap To do: -1) Add https://github.com/matrix-org/synapse/blob/master/docs/admin_api/delete_group.md -2) Make the menu prettier! +1) Add the following functions: + A) https://github.com/matrix-org/synapse/blob/master/docs/admin_api/delete_group.md + B) https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#account-data + C) https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#list-all-pushers + D) https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#override-ratelimiting-for-users + E) https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#check-username-availability + F) https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#find-a-user-based-on-their-id-in-an-auth-provider + G) https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#find-a-user-based-on-their-third-party-id-threepid-or-3pid +2) Make the menu prettier! - DONE 3) Modularise the functions into multiple files - DONE 4) Use URI module for all API calls instead of curl - DONE 5) Add more automated rdlist function with sane defaults - DONE 6) Add fully automated (should just return a web link and decryption password) reporting functions for users: - User's ID -- List of the rooms the user is participating in +- Whois Data +- Account Data +- Query Data +- Pushers List +- List of the rooms the user is participating in, divided into 1:1 conversations and larger rooms - The content of the messages they've sent (if they were sent to rooms your server is participating in) -- The state events they have generated (such as changing their display name or avatar URL) -- Device IDs the user has logged in from and some metadata about those devices (like last seen times) -7) Add fully automated (should just return a web link and decryption password) reporting functions for rooms: -- Room's ID -- Room alias -- List of room members -- Room metadata (name, topic, avatar, etc.) -- The power levels of the room (which determine what actions users are permitted to do) -- History of messages and state events, including their timestamps and senders -8) Add a function to extract a users email -9) Do room shutdowns in parallel? +- Copies of any media they've sent +7) Add a room report function to create a properly formatted report for rdlist +8) Add a function to extract a users email or 3PID +9) Do room shutdowns in parallel *** diff --git a/moderation_tool.py b/moderation_tool.py index 1969e24..0b533e7 100755 --- a/moderation_tool.py +++ b/moderation_tool.py @@ -26,7 +26,39 @@ if length_access_token == 0: pass_token = False while pass_token == False: - menu_input = input('\nPlease select one of the following options:\n#### User Account Commands ####\n1) Deactivate a user account.\n2) Deactivate multiple user accounts.\n3) Create a user account.\n4) Create multiple user accounts.\n5) Reset a users password.\n6) Whois user account.\n7) Whois multiple user accounts.\n8) Query user account.\n9) Query multiple user accounts.\n10) List room memberships of user.\n11) Promote a user to server admin.\n12) List all user accounts.\n13) Quarantine all media a users uploaded.\n#### Room Commands ####\n14) List details of a room.\n15) Export the state events of a target room.\n16) List rooms in public directory.\n17) Remove a room from the public directory.\n18) Remove multiple rooms from the public directory.\n19) Redact a room event. (Like abusive avatars or display names.) \n20) List/Download all media in a room.\n21) Download media from multiple rooms.\n22) Quarantine all media in a room.\n23) Shutdown a room.\n24) Shutdown multiple rooms.\n25) Delete a room.\n26) Delete multiple rooms.\n27) Purge the event history of a room to a specific timestamp.\n28) Purge the event history of multiple rooms to a specific timestamp.\n#### Server Commands ####\n29) Delete and block a specific media. (Like an abusive avatar.) \n30) Purge remote media repository up to a certain date.\n31) Prepare database for copying events of multiple rooms.\n#### rdlist ####\n32) Block all rooms with specific rdlist tags.\n34) Block all rooms with recommended rdlist tags.\n#### ipinfo.io ####\n40) Analyse a users country of origin.\n41) Analyse multiple users country of origin.\n(\'q\' or \'e\') Exit.\n\n') + print("\n##########################") + print("# MATRIX MODERATION TOOL #") + print("##########################") + print("\nA tool for making common Synapse moderation tasks easier. Created by @PC-Admin.") + print("\n----------------------------------------------") + print("\n#### User Account Commands ####\t\t\t#### Room Commands ####") + print("1) Deactivate a user account.\t\t\t14) List details of a room.") + print("2) Deactivate multiple user accounts.\t\t15) Export the state events of a target room.") + print("3) Create a user account.\t\t\t16) List rooms in public directory.") + print("4) Create multiple user accounts.\t\t17) Remove a room from the public directory.") + print("5) Reset a users password.\t\t\t18) Remove multiple rooms from the public directory.") + print("6) Whois user account.\t\t\t\t19) Redact a room event.") + print("7) Whois multiple user accounts.\t\t20) List/Download all media in a room.") + print("8) Query user account.\t\t\t\t21) Download media from multiple rooms.") + print("9) Query multiple user accounts.\t\t22) Quarantine all media in a room.") + print("10) List room memberships of user.\t\t23) Shutdown a room.") + print("11) Promote a user to server admin.\t\t24) Shutdown multiple rooms.") + print("12) List all user accounts.\t\t\t25) Delete a room.") + print("13) Quarantine all media a users uploaded.\t26) Delete multiple rooms.") + print("\t\t\t\t\t\t27) Purge the event history of a room to a specific timestamp.") + print("\t\t\t\t\t\t28) Purge the event history of multiple rooms to a specific timestamp.") + print("\n#### Server Commands ####") + print("29) Delete and block a specific media.") + print("30) Purge remote media repository up to a certain date.") + print("31) Prepare database for copying events of multiple rooms.") + print("\n#### rdlist ####") + print("32) Block all rooms with specific rdlist tags.") + print("34) Block all rooms with recommended rdlist tags.") + print("\n#### ipinfo.io ####") + print("40) Analyse a users country of origin.") + print("41) Analyse multiple users country of origin.") + print("\nPlease enter a number from the above menu, or enter 'q' or 'e' to exit.\n") + menu_input = input() if menu_input == "1": user_commands.deactivate_account('') elif menu_input == "2":