39 lines
966 B
Bash
39 lines
966 B
Bash
#!/bin/bash
|
|
|
|
#
|
|
# Lists all users of the given instance.
|
|
#
|
|
|
|
# Requirements:
|
|
# - You'll need the domain of your server (variable "serverDomain").
|
|
# - Python 2.6+ has to be installed on the system.
|
|
# - For authentication, you will need the access token of your (admin) account.
|
|
# You can obtain it in your Element client: "All settings" > "Help & About" > scroll down > click on "<click to reveal>" to get your access token.
|
|
# Copy this token and paste it further down (variable "token").
|
|
#
|
|
|
|
serverDomain=""
|
|
token=""
|
|
|
|
if [ -z "$serverDomain" ]
|
|
then
|
|
read -p "Enter the Matrix server domain: (e.g. matrix.mydomain.com): " serverDomain
|
|
echo ""
|
|
fi
|
|
|
|
if [ -z "$token" ]
|
|
then
|
|
read -p "Enter your access token: " token
|
|
echo ""
|
|
fi
|
|
|
|
# List users
|
|
echo "Retrieving users..."
|
|
echo ""
|
|
curlUrl="http://localhost:8008/_synapse/admin/v2/users?access_token=$token"
|
|
output=$(curl $curlUrl)
|
|
echo ""
|
|
echo $output | python -m json.tool
|
|
echo ""
|
|
echo "Done"
|
|
echo "" |