Skip to content

Instantly share code, notes, and snippets.

View karimelmel's full-sized avatar

Karim El-Melhaoui karimelmel

View GitHub Profile
import requests
import json
import os
def add_secrets_to_environment(github_token, org_or_user, repo_name, environments_file):
with open(environments_file, "r") as json_file:
data = json.load(json_file)
repositories = data.get("repositories", [])
for repository in repositories:
import requests
import json
import os
def add_secrets_to_environments(github_token, org_or_user, repositories_file):
with open(repositories_file, "r") as json_file:
repos_data = json.load(json_file)
repositories = repos_data.get("repositories", [])
# add_secrets_to_environment.py
import requests
import os
import json
def add_secrets_to_environment(github_token, org_or_user):
# Load data from the repositories.json file
with open("repositories.json", "r") as json_file:
data = json.load(json_file)
@karimelmel
karimelmel / Get-AzureADPSPermissions.ps1
Created August 10, 2022 11:48 — forked from psignoret/Get-AzureADPSPermissions.ps1
Script to list all delegated permissions and application permissions in Azure AD
<#
.SYNOPSIS
Lists delegated permissions (OAuth2PermissionGrants) and application permissions (AppRoleAssignments).
.PARAMETER DelegatedPermissions
If set, will return delegated permissions. If neither this switch nor the ApplicationPermissions switch is set,
both application and delegated permissions will be returned.
.PARAMETER ApplicationPermissions
If set, will return application permissions. If neither this switch nor the DelegatedPermissions switch is set,
AWSTemplateFormatVersion: 2010-09-09
Description: >-
AWS CloudFormer Beta - template creation prototype application. This tool
allows you to create an AWS CloudFormation template from the AWS resources in
your AWS account. **Warning** This template creates a single EC2 instance in
your account to run the application - you will be billed for the instance at
normal AWS EC2 rates.
Parameters:
Username:
Description: Username to log in to CloudFormer
<#
Apply-MitigationADV20006.ps1
Implements mitigation for ADV200006
PowerShell. x64 only.
#>
function Apply-MitigationADV20006
{
#Set Location to System32
Set-Location -Path $env:windir"\system32\"
$Exists = Test-Path .\atmfd.dll
$blockPrincipal = New-Object -TypeName System.Security.Principal.NTAccount ("Everyone")
$BlockPrincipalSID = $blockPrincipal.Translate([System.Security.Principal.SecurityIdentifier]).Value
$exceptionPrincipal = New-Object -TypeName System.Security.Principal.NTAccount ("Administrators")
$ExceptionPrincipalSID = $exceptionPrincipal.Translate([System.Security.Principal.SecurityIdentifier]).Value
$PrincipalSDDL = "O:LSD:(D;;CC;;;$ExceptionPrincipalSID)(A;;CC;;;$BlockPrincipalSID)"
New-NetFirewallRule -DisplayName "Block metatdata service for $($blockPrincipal.Value), exception: $($exceptionPrincipal.Value)" `
-Action Block `
-Direction Outbound `
-Protocol TCP `
@karimelmel
karimelmel / ImportExport.ps1
Created September 11, 2017 12:23
GPO ImportExport
#Gathers credentials for connection to VMs.
$VM1Creds = Get-Credential -UserName entmobsec.com\administrator -Message EntMobSec
$VM2Creds = Get-Credential -UserName prod.com\administrator -Message Prod
#EXPORT
#Creates a PSSession to DC in Lab environment.
$VM1session = New-PSSession -VMName "Server 2016" -Credential $VM1Creds
#Backup all GPOs starting with name "Test" in