Skip to content

Instantly share code, notes, and snippets.

👍
Networking + PowerShell + AWS

Tyler Applebaum tylerapplebaum

👍
Networking + PowerShell + AWS
Block or report user

Report or block tylerapplebaum

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tylerapplebaum
tylerapplebaum / Sync-Documents.ps1
Created Oct 24, 2019
Robocopy wrapper to mirror directory to backup drive. Includes path validation.
View Sync-Documents.ps1
#https://social.technet.microsoft.com/wiki/contents/articles/1073.robocopy-and-a-few-examples.aspx
#http://www.luisrocha.net/2008/12/robocopy-error-error-5-0x00000005.html
#Robocopy switches used:
#/MIR - mirror directory structure (including empty)
#/COPY:DT - excludes copying permissions
#/XA:H - excludes hidden files
#/W:5 - wait 5 seconds on a failure
#/XJD - exclude junction points
View Create-HiddenDirectories
ForEach ($Folder in @("Folder 1","Folder A","Folder A-Z")) {
New-Item -ItemType Directory -Path $DestDir -Name $Folder | Set-ItemProperty -Name Attributes -Value Hidden
}
@tylerapplebaum
tylerapplebaum / Remove-HTMLEncoding.ps1
Last active Nov 4, 2019
A fix for my wife's annoying CSV download issues :)
View Remove-HTMLEncoding.ps1
[CmdletBinding()]
param(
[Parameter(HelpMessage="Specify the path to the CSV file",Mandatory=$True)]
[string]$CSVPath
)
$FileName = Split-Path $CSVPath -Leaf
$FilePath = Split-Path $CSVPath
$FileNameArr = $FileName.Split('.')
$NewFileName = $FileNameArr[0] + "_fixed." + $FileNameArr[1]
@tylerapplebaum
tylerapplebaum / bootstrap.sh
Last active Aug 13, 2019
Bootstrap for Amazon Linux 2 EC2 instances
View bootstrap.sh
#!/bin/bash
sudo yum install httpd
usermod -a -G apache ec2-user
sudo chown -R ec2-user:apache /var/www
sudo systemctl restart httpd.service
sudo systemctl enable httpd.service
public_ipv4=$(curl -s "http://169.254.169.254/latest/meta-data/public-ipv4")
sudo echo $public_ipv4 > /var/www/html/public-ipv4.txt
cd /var/www/html
curl -O https://gist.githubusercontent.com/tylerapplebaum/98a940c312724ae6a0838d43afc2a592/raw/85523ac76edf2c68ee7431839784dff4313b723a/index.html
View JtR_Notes.txt
.\zip2john.exe "C:\Users\derp\Downloads\Tester.zip" | Out-File C:\Users\derp\Downloads\Tester.hash -Encoding utf8
& type C:\Users\derp\Downloads\Tester.hash
.\john.exe C:\Users\derp\Downloads\Tester.hash
Using default input encoding: UTF-8
Loaded 1 password hash (PKZIP [32/64])
Will run 8 OpenMP threads
Proceeding with single, rules:Single
@tylerapplebaum
tylerapplebaum / Get-DirectoryInfo.ps1
Last active Oct 19, 2019
Identify directories with and without files
View Get-DirectoryInfo.ps1
Function Get-SubdirectoryInfo {
[CmdletBinding()]
param(
[Parameter(HelpMessage="Specify the top level directory to search")]
[string]$TopLevelDir
)
#Find subdirectories with files
$Items = Get-ChildItem $TopLevelDir | Where-Object Attributes -ne Directory | Select-Object DirectoryName,Name,Length
@tylerapplebaum
tylerapplebaum / Snippets.js
Created Jun 11, 2019
Chrome Dev Tools Utilities
View Snippets.js
// Paste these into the Developer Tools Console
// Calculate DNS lookup time in milliseconds
var pageNavArr = performance.getEntriesByType("navigation");
var pageResArr = performance.getEntriesByType("resource");
var pageArr = pageNavArr.concat(pageResArr);
pageArr.forEach(function(element) {
var dnsTime = element.domainLookupEnd - element.domainLookupStart;
if (dnsTime > 0) { // Don't display cached DNS entries
console.log(element.name);
@tylerapplebaum
tylerapplebaum / index.html
Last active Aug 13, 2019
HTML5 and some light CSS. Useful for my AWS testing.
View index.html
<!DOCTYPE html>
<html lang=en>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>AWS Test</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {background-color: AliceBlue;}
View gist:0a82343a53c34b6f0d27724154fbfabe
[CmdletBinding()]
param(
[Parameter(HelpMessage="Specify the path to the CSV file")]
[string]$CSVPath,
[Parameter(HelpMessage="Specify one of OCHIN's supported drivers")]
[ValidateSet("HP LaserJet 4100 Series PCL6", "HP Universal Printing PCL 5 (v5.7.0)", "Kyocera TASKalfa 7551ci", "Sharp MX-3500N", "Xerox Global Print Driver PCL")]$Driver
)
You can’t perform that action at this time.