Advanced Search
Search Results
272 total results found
Request storage account token
# Get OAuth Token TOKEN=$(curl -s "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com" -H Metadata:true | jq -r '.access_token') # Get subscription id SUB=$(curl -s -H Metadata:true --noproxy...
Get AKS node IP
curl -s -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2017-08-01" | jq -r .network.interface[].ipv4.ipAddress[].privateIpAddress Resource: https://itnext.io/how-a-naughty-docker-image-on-aks-could-give-an-attacker-access-to-your-azure...
Create new role assignment
This will try to assign the assignee the owner role: az role assignment create --assignee <user or service principal> --role "owner" Resource: https://www.xmcyber.com/privilege-escalation-and-lateral-movement-on-azure-part-1/
Show registered features in a table format
az feature list -o table
Find features associated w/ ContainerService
az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService')].{Name:name,State:properties.state}" Resource: https://heranonazure.wordpress.com/2019/09/02/secure-api-server-using-authorized-ip-address-ranges/
Azure Powershell Module Cheatsheet
# Azure Product Azure CLI Example CLI PowerShell Module Example PS 1 Syntax az PowerShell uses a verb-noun pair for the names of cmdlets 2 Log in to Azure az login az login -u johndoe@contoso.com -p VerySecret Az.Accounts ...
While loops
Run for period of time #!/bin/bash runtime="5 minute" endtime=$(date -ud "$runtime" +%s) while [[ $(date -u +%s) -le $endtime ]] do echo "Time Now: `date +%H:%M:%S`" echo "Sleeping for 10 seconds" sleep 10 done Resource: https://www.g...
For loops
Compute md5sum for every item in a directory for i in "$(ls)"; do md5sum "${i}"; done | sort Print 1 through 10 for COUNT in $(seq 1 10); do echo $COUNT sleep 1 done Read data into an array and loop over it mapfile -t buckets < <(aws s3 ls | grep t...
SSH
Encrypt Key openssl rsa -des3 -in key.pem -out encrypted-key.pem # Enter a passphrase mv encrypted-key.pem key.pem chmod 400 key.pem Decrypt Key openssl rsa -in key.pem -out key.open.pem # Enter the passphrase used to encrypt the ke mv key.open.pem key...
Create sudo user non-interactively
Skip the prompts that come with creating a user typically, and give them sudoers privileges. Replace ${USERNAME} with the user you want to create. # The man page explanation for --gecos isn't that intuitive IMO # Basically specifying --gecos "" states you do...
Run function as another user
export -f <function_name> su <user to run function as> -c "bash -c <function_name>"
Run command as another user
USER=centos runuser -l $USER -c 'whoami' Resource: https://devops.stackexchange.com/questions/10402/running-a-command-as-a-specific-user-on-an-ec2-using-ssm
New Page
Exit-on-error mode Put this at the top of your bash script: set -e. If a command returns a nonzero status, the shell will exit. Resources: https://unix.stackexchange.com/questions/97101/how-to-catch-an-error-in-a-linux-bash-script http://linuxcommand.org/lc3...
Create Test Detections
Original Article We have several test detections that can be run to verify the Falcon sensor is sending detections back to the cloud and that they are being received in a timely manner. If you have a SOC that receives and responds to alerts, it would be advi...
Docker Cheatsheet
Installation Ubuntu install_docker(){ sudo apt-get update sudo apt-get install -y \ ca-certificates \ curl \ gnupg \ lsb-release # Add docker's official GPG key sudo mkdir -p /etc/apt/keyrings curl...
Markdown Cheatsheet
You can use this site to generate the code for you. For example: ## Table of Contents - [Prerequisites](#prerequisites) - [Create](#create) --- ## Prerequisites - Stuff - Things --- ## Create - More stuff - More things Resource: https...
Delete Email From All Mailboxes In Office 365
For full details please go to the following page Delete Email From All Mailboxes In Office 365 This assumes the following are trueSubject: You must change your bank password nowSent: 05/12/2020 1. Connect to MSOnline in Powershell Import-Module ExchangeOnli...
Wireshark
Filter where the source ip is not 192.168.1.1 ip.src != 192.168.1.1 Filter where the destination ip is not 192.168.1.1 ip.dst != 192.168.1.1 Find packets with a string in them frame contains <thing to search> For example: frame contains google Resource...