[Feature Request] Add Python module for Google Workspace Phishing Payload Creation
@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: Initial Access, Lateral Movement, Privilege Escalation
Technique Name: Phishing, Internal Spearphishing
Technique ID: T1566, T1534
Technique Description: Adversaries may send phishing messages to gain access to victim systems. All forms of phishing are electronically delivered social engineering.
Describe the solution you'd like
Payload Creation Module for use with a threat actors GWS infra for Initial Access or a compromised GWS environment for Lateral Movement and Privilege Escalation.
Requirements:
- Google Drive, Google App Scripts API, Google Docs, and Google Sheets APIs enabled
- Python packages (google-auth google-auth-oauthlib google-auth-httplib2 google-api-python-client)
- Scopes (https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/documents,
https://www.googleapis.com/auth/spreadsheets, https://www.googleapis.com/auth/drive)
Module Workflow:
Step 1: Select your payload type (doc, sheet, form):
Step 2: Select App Script payload
Step 3: Choose lure
Step 4: Submit
Module Actions:
1. Authenticate
2. Create file
3. Populate file with lure content
4. Create App Script project and bind to file
5. Set the file permissions and return the link
ChatGPT Example Script
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from googleapiclient.errors import HttpError
from googleapiclient.discovery import build
SCOPES = [
'https://www.googleapis.com/auth/drive.file',
'https://www.googleapis.com/auth/spreadsheets',
'https://www.googleapis.com/auth/script.projects',
'https://www.googleapis.com/auth/drive'
]
def create_google_file(file_type, data=None):
try:
service = build('drive', 'v3', credentials=creds)
if file_type == 'document':
mimeType = 'application/vnd.google-apps.document'
elif file_type == 'spreadsheet':
mimeType = 'application/vnd.google-apps.spreadsheet'
elif file_type == 'form':
mimeType = 'application/vnd.google-apps.form'
else:
raise ValueError('Invalid file_type. Must be "document", "spreadsheet", or "form".')
file_metadata = {'name': f'My {file_type.capitalize()}', 'mimeType': mimeType}
file = service.files().create(body=file_metadata, fields='id').execute()
print(F'Created {file_type.capitalize()} with ID: {file.get("id")}')
if file_type == 'spreadsheet':
script_id = create_and_bind_app_script(file.get('id'))
print(F'Created and bound Apps Script project with ID: {script_id}')
if data:
populate_sheet(file.get('id'), data)
share_link = create_share_link(file.get('id'))
print(F'Shareable link: {share_link}')
except HttpError as error:
print(F'An error occurred: {error}')
def create_and_bind_app_script(sheet_id):
try:
service = build('script', 'v1', credentials=creds)
# Create a new Apps Script project
request = {
'title': 'My Custom Functions'
}
script = service.projects().create(body=request).execute()
# Bind the Apps Script project to the Google Sheet
request = {
'addResource': {
'scriptId': script['scriptId'],
'resource': {
'sheetId': sheet_id
}
}
}
service.projects().updateContent(body=request).execute()
return script['scriptId']
except HttpError as error:
print(F'An error occurred: {error}')
def populate_sheet(sheet_id, data):
try:
service = build('sheets', 'v4', credentials=creds)
# Assuming data is a list of lists, where each inner list is a row
# of data to be written to the sheet
body = {
'values': data
}
range_name = 'A1'
result = service.spreadsheets().values().update(
spreadsheetId=sheet_id, range=range_name,
valueInputOption='RAW', body=body).execute()
print(F'Populated sheet with {result.get("updatedCells")} cells.')
except HttpError as error:
print(F'An error occurred: {error}')
def create_share_link(file_id):
try:
service = build('drive', 'v3', credentials=creds)
# Set permissions for the file
permissions = {
'role': 'writer', # or 'reader', depending on the access level you want to grant
'type': 'anyone'
}
service.permissions().create(fileId=file_id, body=permissions).execute()
# Get the shareable link
file = service.files().get(fileId=file_id, fields='webViewLink').execute()
share_link = file.get('webViewLink')
return share_link
except HttpError as error:
print(F'An error occurred: {error}')
# Replace 'spreadsheet' with 'document' or 'form' for other file types
data = [["Header1", "Header2"], [1, 2], [3, 4]]
create_google_file('spreadsheet', data)
- Lingua principale
- Python
- Stelle
- 169
- Fork
- 8
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
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 Dashboard Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
-
community maintenance
-
enhancement
-
API: Admin enhancement Subtechnique: 003 Tactic: Persistence Technique: T1098
Tutte le issue di elastic/SWAT
Issue simili
-
area: harness bug status: needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Human-Agent-Society/reef#625 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
learningequality/kolibri#15351 · 2 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Name consistency Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
eellak/triplestore#65 · 1 commento ·