[Feature Request] Add Python module for Creating a New Google Workspace Account
@brokensound77 ci sta già lavorando.
Dal 9/5/2023.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
🐍 Python Module for MITRE ATT&CK Technique
Tactic Name: Persistence
Technique Name: Create Account
Technique ID: T1136
Technique Description: Adversaries may create an account to maintain access to victim systems. With a sufficient level of access, creating such accounts may be used to establish secondary credentialed access that do not require persistent remote access tools to be deployed on the system.
Describe the solution you'd like
New Google Workspace Account Creation Module for use with a compromised GWS environment for Persistence.
Requirements:
- Google Admin SDK API enabled
- Python packages (google-auth google-auth-oauthlib google-auth-httplib2 google-api-python-client, email, base64)
- Scopes (https://www.googleapis.com/auth/admin.directory.user, https://www.googleapis.com/auth/admin.directory.rolemanagement)
Module Workflow:
Step 1: Enter the account first name:
Step 2: Enter the account last name:
Step 3: Enter the email for the account:
Step 4: Enter the password (temporary):
Step 5: Create
Module Actions:
1. Authenticate
2. Create a new user
3. Create a custom role with the desired permissions
4. Assign the role to the newly created user
5. Enable or disable API access for the user
6. Return Success with user email and password
ChatGPT Example Script
from google.oauth2 import service_account
from googleapiclient import discovery, errors
# Replace with your credentials file path and your Google Workspace domain
SERVICE_ACCOUNT_FILE = 'path/to/credentials.json'
DOMAIN = 'your-domain.com'
# Set up credentials with the required scopes
credentials = service_account.Credentials.from_service_account_file(
SERVICE_ACCOUNT_FILE,
scopes=['https://www.googleapis.com/auth/admin.directory.user',
'https://www.googleapis.com/auth/admin.directory.rolemanagement'])
# Create an Admin SDK API client
service = discovery.build('admin', 'directory_v1', credentials=credentials)
# Create a user
user_body = {
'primaryEmail': 'new-user@{}'.format(DOMAIN),
'name': {
'givenName': 'John',
'familyName': 'Doe'
},
'password': 'UserPassword123'
}
user = service.users().insert(body=user_body).execute()
# Create a custom role with specific permissions
role_body = {
'roleName': 'Custom Role',
'rolePrivileges': [
{
'privilegeName': 'User Management',
'serviceId': 'your-service-id'
}
]
}
role = service.roles().insert(customer='my_customer', body=role_body).execute()
# Assign the custom role to the user
assignment_body = {
'roleId': role['roleId'],
'assignedTo': user['id']
}
assignment = service.roleAssignments().insert(customer='my_customer', body=assignment_body).execute()
print('User created and custom role assigned')
- Lingua principale
- Python
- Stelle
- 169
- Fork
- 8
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di elastic/SWAT
-
Dependency DashboardAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
-
[Maintenance] Documentation Screenshots not RenderingForse di nuovo libera @terrancedejesus l’ha presa 1131 giorni fa e non c’è nessuna pull request aperta. Apertacommunity maintenance
-
[Feature Request] Create `add-emulation` commandForse di nuovo libera @brokensound77 l’ha presa 1167 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement
-
[Feature Request] Add Python module for detecting T1098.003 - Additional Cloud RolesForse di nuovo libera @terrancedejesus l’ha presa 1236 giorni fa e non c’è nessuna pull request aperta. ApertaAPI: Admin enhancement Subtechnique: 003 Tactic: Persistence Technique: T1098
Tutte le issue di elastic/SWAT
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
PedestrianDynamics/pyFDS-Evac#343 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
theskumar/python-dotenv#708 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 2 giorni
-
Docs Timedelta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
pandas-dev/pandas#69919 ·
I maintainer di solito rispondono entro 1 giorno
-
API documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
zephyrproject-rtos/west#1009 · 2 commenti ·
I maintainer di solito rispondono entro 3 giorni