Skip to content

Instantly share code, notes, and snippets.

Avatar

NicholasLeader

  • USA
View GitHub Profile
@NicholasLeader
NicholasLeader / ADusersMemberOfFilteredGroup.ps1
Created Jun 9, 2020
PowerShell example of script to determine details of a set of AD users, given an AD group filter
View ADusersMemberOfFilteredGroup.ps1
<# Nicholas Leader
6.9.2020
Report on AD users that belong to certain AD groups
Including manager details
#>
#date stamp in string
$DateStamp = get-date -Format MM.dd.yyyy.mm
#What group you're looking for
@NicholasLeader
NicholasLeader / Lamda_Python_Push_HTTP_header_PoC.tf
Created Sep 3, 2019
Terraform PoC to deploy AWS Lamda Python function and API
View Lamda_Python_Push_HTTP_header_PoC.tf
### Nicholas Leader
### 8.19.2019
### Terraform main config for Lamda function with API
### see Python file for details on the actual function
### requires the API Terrform config as well.
### Terraform script expects Python file to be in S3 bucket
# Configure the AWS Provider
# credential reference https://www.terraform.io/docs/providers/aws/index.html#authentication
# API / Lamda reference https://learn.hashicorp.com/terraform/aws/lambda-api-gateway
@NicholasLeader
NicholasLeader / SSL_TLS_cert_CN_pull_via_NMAP.ps1
Last active Sep 3, 2019
PowerShell PoC to grab the 'CN' common name of the SSL/TLS cert of an IP - leveraging NMAP SSL-cert script
View SSL_TLS_cert_CN_pull_via_NMAP.ps1
<#
Nicholas Leader
9.3.2019
PowerShell PoC to grab the 'CN' common name of the SSL/TLS cert of an IP
Script takes an array of IPs as input in the script, but could be modified to pull from a CSV, etc
Script is leveraging 'Invoke-Command' to run an NMAP script
Using 'Select-string' to pull the relevent line of the NMAP script output
Requires:
@NicholasLeader
NicholasLeader / HTTP_Security_Header_check_Python_AWS_Lamda_PoC.py
Created Aug 15, 2019
This Python AWS Lamda function, returns True / False if a given AWS API query parameter (URL) has an HTTP security CSP header present
View HTTP_Security_Header_check_Python_AWS_Lamda_PoC.py
### Nicholas Leader
### Python PoC given AWS API query parameter of URL, return if HTTP security header CSP policy is present
### Written as AWS Lamda (serverless) function
### 8.14.2019
###
import json
def lambda_handler(event, context):
import urllib.request
input = event["queryStringParameters"]['URL']
View HTTP_Security_header_check.ps1
###
# Nicholas Leader
# 8.9.2019
# Check for the presence of HTTP Security headers - CSP or Content-Security-Policy in this example
#
# Dictionary calling idea from: https://stackoverflow.com/questions/39090323/how-to-check-if-response-header-contains-certain-headers-powershell
#
###
### set Connection to use TLS 1.2
View Compare_objects_return_all_properties.ps1
<#
Nicholas Leader
09.08.2018
Merging 2 sets of data with compare-object lookup.
List of servers and adding columns to the CSV from a AV CSV
This script returns *all* data elements from both CSVs, rather than just from 1 CSV with compare-object
#>
#date stamp in string
View DataFiltering.PS1
<# Nicholas Leader 2018
Custom filter on the AV agent report
make sure file in CSV format
12.03.2018 - made the date filtering more extensible (not hard coded), grabs last 3 calender months with current month
#>
$filePath = "Example_file_path.csv"
### formats the dates to similar formats as what's contained in the spreasheet
@NicholasLeader
NicholasLeader / PowerShell_AWS_IAM_user_audit_example.ps1
Created May 19, 2016
PowerShell AWS IAM user audit example using Amazon's PowerShell Module
View PowerShell_AWS_IAM_user_audit_example.ps1
<#
Nicholas Leader
05/18/2016
Example of using the 'AWS Tools For Windows PowerShell' : http://docs.aws.amazon.com/powershell/latest/userguide/pstools-welcome.html
In this example I'm doing a very simple audit to see which users (IAM users) were created in the last week.
This script requires AWS Tools to be installed locally. Amazon has an MSI on their website.
@NicholasLeader
NicholasLeader / PowerShell_Parsing_EventLog_Example.ps1
Created May 18, 2016
PowerShell example of parsing Windows Event log, doing admin detection, as well as writing to log file
View PowerShell_Parsing_EventLog_Example.ps1
<#
Nicholas Leader
05/18/2016
Example of parsing of a Windows Event log, then writing to the host and a log file if a certain eventID detected
#>
## requires section Reference: http://serverfault.com/a/676573/355259
@NicholasLeader
NicholasLeader / PowerShell_function_with_input_validation.ps1
Created May 16, 2016
PowerShell Function Example with input validation
View PowerShell_function_with_input_validation.ps1
<#
Nicholas Leader
05/16/2016
Simple function example
In this example I'm showing how input to the function can be validated
After running this script a 'Test-name' function will be available, which accepts an argument or parameter
Reference: http://mikefrobbins.com/2015/03/31/powershell-advanced-functions-can-we-build-them-better-with-parameter-validation-yes-we-can/
You can’t perform that action at this time.