diff --git a/generators/phishing_app/phishing_app.py b/generators/phishing_app/phishing_app.py index 13b0983..57aae6e 100644 --- a/generators/phishing_app/phishing_app.py +++ b/generators/phishing_app/phishing_app.py @@ -5,6 +5,9 @@ import os.path import argparse +# Jinaj2 Templates for the Templates themselves. +from jinja2 import Environment, FileSystemLoader + # argparser stuff parser = argparse.ArgumentParser(description='A script to create terraform for a consent phishing app') @@ -58,157 +61,21 @@ default_logout_url = args.logout_url print("[+] User supplied logout_url: ", default_logout_url) -##### -# Functions -##### - -# Get the terraform template -def get_code_template(): - template = ''' - -variable "display_name" { - description = "The application display name" - default = "DISPLAY_NAME" -} - -variable "redirect_uris" { - default = "REDIRECT_URIS" -} - -variable "homepage_url" { - default = "HOMEPAGE_URL" -} - -variable "logout_url" { - default = "LOGOUT_URL" -} - -resource "azuread_application_password" "app_consent" { - application_object_id = azuread_application.app_consent.object_id -} - -data "azuread_client_config" "current" {} - -# Create service principal -resource "azuread_service_principal" "app_consent" { - application_id = azuread_application.app_consent.application_id - - depends_on = [azuread_application.app_consent] -} - -resource "azuread_application" "app_consent" { - display_name = var.display_name - owners = [data.azuread_client_config.current.object_id] - sign_in_audience = "AzureADMultipleOrgs" - - feature_tags { - enterprise = true - gallery = false - } - - required_resource_access { - resource_app_id = "00000003-0000-0000-c000-000000000000" # Microsoft Graph - - resource_access { - id = "ff74d97f-43af-4b68-9f2a-b77ee6968c5d" # Contacts.Read - type = "Scope" - } - - resource_access { - id = "570282fd-fa5c-430d-a7fd-fc8dc98a9dca" # Mail.Read - type = "Scope" - } - - resource_access { - id = "e383f46e-2787-4529-855e-0e479a3ffac0" # Mail.Send - type = "Scope" - } - - resource_access { - id = "10465720-29dd-4523-a11a-6a75c743c9d9" # Files.Read - type = "Scope" - } - - resource_access { - id = "df85f4d6-205c-4ac5-a5ea-6bf408dba283" # Files.Read.All - type = "Scope" - } - - resource_access { - id = "863451e7-0667-486c-a5d6-d135439485f0" # Files.ReadWrite.All - type = "Scope" - } - - resource_access { - id = "e1fe6dd8-ba31-4d61-89e7-88639da4683d" # User.Read - type = "Scope" - } - - } - - web { - homepage_url = var.homepage_url - logout_url = var.logout_url - redirect_uris = [var.redirect_uris] - } -} - -output "client_secret" { - value = azuread_application_password.app_consent.value - description = "The client secret" - sensitive = true -} - -output "app_details" { - value = <