Skip to content

Instantly share code, notes, and snippets.

@illuzian
illuzian / check_website_online.sh
Created November 9, 2020 00:35
One liner to check online status of websites
# Check status of a list of websites in the file check_hosts.txt. Increase --max-time if sites are slow to respond
cat check_hosts.txt | while read host; do echo $host $(curl --ssl -Is "$host" -K HEAD --max-time 3 | head -1); done
# Output to console
Get-AzSubscription | ForEach-Object {Set-AzContext -Subscription $_.Name *>$null; Get-AzPublicIpAddress} | Where-Object {$_.IpAddress -ne 'Not Assigned'} | Select-Object -Property Name,PublicIpAllocationMethod,ipAddress,ProvisioningState,Location,ResourceGroupName,Id
# Write to CSV
Get-AzSubscription | ForEach-Object {Set-AzContext -Subscription $_.Name *>$null; Get-AzPublicIpAddress} | Where-Object {$_.IpAddress -ne 'Not Assigned'} | Select-Object -Property Name,PublicIpAllocationMethod,ipAddress,ProvisioningState,Location,ResourceGroupName,Id | Export-Csv -Path .\pips.txt
import pandas as pd
import requests
import re
import gzip
import json
from bs4 import BeautifulSoup
from io import BytesIO
from datetime import datetime
# NVD feed URL.
# Anti-malware resolver.
import re
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.compute import ComputeManagementClient
from azure.mgmt.subscription import SubscriptionClient
from azure.mgmt.advisor import AdvisorManagementClient
from azure.mgmt.security import SecurityCenter
import pprint
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.compute import ComputeManagementClient
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.resource.resources.models import GenericResource
from azure.mgmt.subscription import SubscriptionClient
from msrestazure.azure_exceptions import CloudError
vm_list = []
with open('vms.csv', 'r') as f:
for line in f.readlines():
import SocketServer
HOST, PORT = "0.0.0.0", 514
class SyslogUDPHandler(SocketServer.BaseRequestHandler):
def handle(self):
data = bytes.decode(self.request[0].strip())
socket = self.request[1]
print(str(data))
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.subscription import SubscriptionClient
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.network import NetworkManagementClient
import pprint, json
pp = pprint.PrettyPrinter(indent=4, depth=40)
# Configure the locations to look at
locations = ['eastus', 'australiaeast', ]
@illuzian
illuzian / multi_whois.sh
Last active September 14, 2020 00:04
One liner to perform multiple whois or whois and ptr/reverse lookups against multiple targets froma file.
# One liner. The input file should contain one entry per line.
# `grep -i -E '(OrgName|Country)'` can be removed to show all of the whois output or modified to select preferred items.
cat lookupips.txt | while read ip; do echo $ip; whois -H $ip | grep -i -E '(OrgName|Country)'; done
# Same but includes a ptr lookup - change 1.1.1.1 to whichever server you want to use or remove to use your local server.
cat lookupips.txt | while read ip; do echo $ip; nslookup $ip 1.1.1.1 | grep -o -E 'name = .*$'; whois -H $ip | grep -i -E '(OrgName|Country)'; done
# This script first clears the CRL cache in the event a proxy CA, internal CA, scanning tool CA or AV CA gets trusted for
# something it shouldn't and your mac won't accept the genuine certificate.
# After clearing the CRL cache this script shreds the App Store caches - probably restart after and try downloading from the
# App Store again.
# If it doesn't fix your problem.... well good luck, may Google be by your side.
# Clear crl and oscp cache
sudo rm /var/db/crls/*.db
@illuzian
illuzian / quick_reference.pq
Last active February 11, 2022 17:54
Power BI M/Power Query Reference
/*
Copyright 2020 Anthony Hawkes
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software