Skip to content

Instantly share code, notes, and snippets.

@jpbruckler
jpbruckler / GithubIssuesForMissingPesterTests.ps1
Last active June 22, 2016 05:27
Finds files that don't have a corresponding pester test, then creates Github issues for the missing tests
<#
.SYNOPSIS
Creates Github issues for missing Pester tests.
.DESCRIPTION
Recurses through .ps1 files and tries to find a matching .tests.ps1 file in
a given test directory. For each missing Pester test, a github issues is
created.
There are some assumptions here, namely that every .ps1 file in the $ScanPath
contains a single function. That's just how I write modules, so this script
@jpbruckler
jpbruckler / New-EicarFile.ps1
Created July 19, 2016 17:48
Because I'm too lazy to keep downloading EICAR files.
function New-EicarFile
{
<#
.SYNOPSIS
Creates an EICAR file.
.DESCRIPTION
Will generate a file with the EICAR antimalware test string at the given path.
.PARAMETER Path
The full path of the file to create.
.PARAMETER Force
@jpbruckler
jpbruckler / Install-VCC.ps1
Created January 2, 2017 18:30
Install all Visual C++ Redistributables in order
<#
This script expects all the redistributables to be in a folder structure like:
D:\DOWNLOADS
├───VS2005
│ vcredist_x64.exe
│ vcredist_x86.exe
├───VS2008
│ vcredist_x64.exe
function Connect-CaVault
{
<#
.SYNOPSIS
Establishes an authenticated REST connection to CyberArk.
.DESCRIPTION
Connect-CAVault establishes an authenticated connection to a given
CyberArk server. This connection can then be used to perform
additional tasks using the CyberArk REST API.

Keybase proof

I hereby claim:

  • I am jpbruckler on github.
  • I am jpbruckler (https://keybase.io/jpbruckler) on keybase.
  • I have a public key ASDvG_tET85oryJt2rn0GvMrVvdZIcIOFHh3jDR_XkL0YQo

To claim this, I am signing this object:

@jpbruckler
jpbruckler / Open-MITRE.ps1
Last active May 2, 2018 22:53
Opens MITRE ATT&CK T-Code in your browser
function Open-MITRE
{
<#
.SYNOPSIS
Opens MITRE ATT&CK wiki page for the given T code in the default browser.
.DESCRIPTION
For a given technique code (Tnnnn), opens the wiki page for the corresponding
MITRE ATT&CK technique in the default browser.
.PARAMETER TechniqueCode
The ATT&CK technique code. This can either be a 4 digit number, or the fully
@jpbruckler
jpbruckler / PowerShell_TAXII_Example.ps1
Created May 20, 2018 03:53
Example of connecting to MITRE TAXII to retrieve collection information
$Header = @{
'Accept' = 'application/vnd.oasis.stix+json; version=2.0'
}
$BaseURI = 'https://cti-taxii.mitre.org/stix/'
$EnterpriseCollection = 'collections/95ecc380-afe9-11e4-9b6c-751b66dd541e/objects'
$Uri = '{0}{1}' -f $BaseURI, $EnterpriseCollection
$Response = Invoke-RestMethod -Headers $Header
<#
.SYNOPSIS
Creates an HTTP header using BASIC authentication for use with Invoke-WebRequest or Invoke-RestMethod.
.DESCRIPTION
PowerShell 5 and below does not support BASIC authentication with Invoke-WebRequest and Invoke-RestMethod.
This function will create a header in the format necessary to send BASIC authorization strings for HTTP
requests. The returned header defaults to a hashtable, but with the -AsJson switch, it will return
properly formatted JSON.
@jpbruckler
jpbruckler / Get-Shrug.ps1
Created September 26, 2018 13:49
PowerShell shrugs in your clipboard!
function Get-Shrug
{
<#
.SYNOPSIS
Copies a shrug emoji to your clipboard.
.DESCRIPTION
Copies the shrug emoji to the clipboard. If this function is saved in a
file (like your $profile), the text encoding of that file needs to be
set to UTF-8 with BOM in order for all the characters to be displayed
propertly.
@jpbruckler
jpbruckler / New-RandomPassword.ps1
Last active October 30, 2018 14:54
Generates a random password
function New-RandomPassword {
<#
.SYNOPSIS
Generates a random password.
.DESCRIPTION
Generates a random password that is $Length characters long and
contains a minimum of $MinSpecial special characters.