diff options
author | Christian Cleberg <hello@cleberg.net> | 2024-12-28 12:02:33 -0600 |
---|---|---|
committer | Christian Cleberg <hello@cleberg.net> | 2024-12-28 12:02:33 -0600 |
commit | eeadd683cdb63489ad53d4fc331660f3e29e3c82 (patch) | |
tree | 4beab0af9b222fb72951fbbc592a1831a71e42e8 /applications | |
parent | 2ee3e7af7b9133da946dff2643505a3d7013b3c0 (diff) | |
download | audit-tools-eeadd683cdb63489ad53d4fc331660f3e29e3c82.tar.gz audit-tools-eeadd683cdb63489ad53d4fc331660f3e29e3c82.tar.bz2 audit-tools-eeadd683cdb63489ad53d4fc331660f3e29e3c82.zip |
add gitlab admins script
Diffstat (limited to 'applications')
-rw-r--r-- | applications/gitlab/README.org | 11 | ||||
-rw-r--r-- | applications/gitlab/gitlab_admins.py | 23 |
2 files changed, 34 insertions, 0 deletions
diff --git a/applications/gitlab/README.org b/applications/gitlab/README.org new file mode 100644 index 0000000..81d610d --- /dev/null +++ b/applications/gitlab/README.org @@ -0,0 +1,11 @@ +#+title: GitLab Scripts + +* =gitlab_admins.py= + +#+begin_src sh +python ./gitlab_admins.py +#+end_src + +#+begin_src text +Username: ccleberg, Access Level: 50 +#+end_src diff --git a/applications/gitlab/gitlab_admins.py b/applications/gitlab/gitlab_admins.py new file mode 100644 index 0000000..f15a725 --- /dev/null +++ b/applications/gitlab/gitlab_admins.py @@ -0,0 +1,23 @@ +""" +Gather all members of a GitLab group and their access levels. +""" + +import requests + +BASE_URL = "https://gitlab.com/api/v4" +PRIVATE_TOKEN = "your_access_token" +GROUP_ID = "your_group_id" +TIMEOUT = 30 + +url = f"{BASE_URL}/groups/{GROUP_ID}/members" +headers = {"PRIVATE-TOKEN": PRIVATE_TOKEN} + +if __name__ == '__main__': + # Get group members + response = requests.get(url, headers=headers) + if response.status_code == 200: + members = response.json() + for member in members: + print(f"Username: {member['username']}, Access Level: {member['access_level']}") + else: + print(f"Failed to fetch group members: {response.status_code}, {response.text}") |