Skip to content

Instantly share code, notes, and snippets.

View omarmciver's full-sized avatar
🏠
Working from home

Omar McIver omarmciver

🏠
Working from home
View GitHub Profile
@omarmciver
omarmciver / resize linux part
Created July 18, 2022 16:01
Resize Linux Partition #shell
#Find the name of your disk:
df -Th
#Unmount the disk (in this example it's "sdc1")
sudo umount /dev/sdc1
#Call the interactive 'parted' command
sudo parted /dev/sdc
#1. Type "print" and note the size of the disk
#2. Type "resizepart"
@omarmciver
omarmciver / Find Azure Linux Agent OMI Open Ports.ps1
Last active September 16, 2021 22:25
Find Azure Linux Agent OMI Open Ports (CVE-2021-38647)
# Omar McIver
# September 16th 2021
# Subject: Open Management Infrastructure Remote Code Execution Vulnerability (CVE-2021-38647)
# Ref: https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2021-38647
#######################
# This script will visit each of your Linux VMs and use a run-command to cat the omiserver.conf file and then grep for "port="
# This will return you the httpport=XXX and httpsport=XXX settings. If these are non-Zero then you need to get your OMI agent patched to secure against the vulnerability.
#######################
@omarmciver
omarmciver / CosmosDB Resources with Public endpoints
Last active August 27, 2021 15:37
CosmosDB Resources with Public endpoints #KQL
resources
| extend serviceEndpointCount= array_length(properties.virtualNetworkRules)
| extend vnetFilterOn=tobool(properties.isVirtualNetworkFilterEnabled)
| extend ipRangeFilter=tostring(properties.ipRangeFilter)
| project id, name, serviceEndpointCount,vnetFilterOn, ipRangeFilter, resourceGroup, subscriptionId, type
| where type == "microsoft.documentdb/databaseaccounts" and (vnetFilterOn == false or serviceEndpointCount == 0 or ipRangeFilter <> "")