-join (1..255 | % { "`e[48;5;$($_)m {0:00#} `e[0m" -f $_ + ($_ % 15 -eq 0 ? "`n" : " ") })
-join (1..255 | % { "`e[48;5;$($_)m {0:00#} `e[0m" -f $_ + ($_ % ($host.ui.RawUI.WindowSize.Width / 10) -eq 0 ? "`n" : " ") })
#Windows Powershell compatible version
-join (1..255 | % { "$([char]27)[48;5;$($_)m {0:00#} $([char]27)[0m" -f $_;if ($_ % ($host.ui.RawUI.WindowSize.Width / 10) -eq 0) { "`n" } else { " " } })
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function colortable { | |
param( | |
[Int]$Padding = 2 | |
) | |
$ht = @{ | |
reset = "$([char]27)[0m" | |
pad = ' ' * $Padding | |
bg = "$([char]27)[48;5;" | |
# numbers + space + padding | |
len = [math]::Floor(($host.ui.RawUI.WindowSize.Width - 10) / (3 + 1 + (2 * $Padding))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using namespace System.Management.Automation.Language | |
function table2am { | |
<# | |
format-table sugar that knows not to format if you're assigning to a variable. | |
it will automatically switch to Select-Object when assigned. | |
also tries to figure out if it's the last command in the pipeline otherwise it will default to Select-Object. | |
only implemented Property param atm, just testing it out for fun. | |
Set-Alias -Name ft -Value table -Force | |
to override default ft alias you need -Force. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function table { | |
<# | |
format-table sugar that knows not to format if you're assigning to a variable. | |
it will automatically switch to Select-Object when assigned. | |
only implemented Property param atm, just testing it out for fun. | |
Set-Alias -Name ft -Value table -Force | |
to override default ft alias you need -Force. | |
#> | |
[CmdletBinding()] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Show-Pipeline { | |
<# | |
.SYNOPSIS | |
Returns an object with the command and resolved command in a pipeline or input line. | |
@trackd | |
.PARAMETER Line | |
the line to parse | |
.EXAMPLE | |
$a = gci | % fullname | gi | Show-Pipeline -Verbose | |
$a | % fullname | gi | Show-Pipeline -Verbose -all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Author: Jonathan Johnson (@jsecurity101) | |
function New-DriverConfig { | |
<# | |
.EXAMPLE | |
New-DriverConfig -Block | |
Creates driver block config in the current directory | |
.EXAMPLE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Scan-LOLDrivers { | |
<# | |
.EXAMPLE | |
Scan-LOLDrivers -Path C:\Windows\System32\drivers | |
$Results = Scan-LOLDrivers -Path C:\Windows\inf | |
$Results | Select-Object * | |
$Results[0].all | |
$Results[0].all.KnownVulnerableSamples | |
.EXAMPLE | |
$iwantitall = 'C:\WINDOWS\inf', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
// gcc print_argv.c -o print_argv | |
int main(int argc, char *argv[]) | |
{ | |
int i; | |
for(i = 1;i < argc;i++) | |
{ | |
printf("[%d] %s\n", i, argv[i]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using namespace System.Globalization | |
# suppress all the errors from the conversion attempts. | |
$ErrorActionPreference = 'SilentlyContinue' | |
Remove-Variable fails, success, results, test* | |
# clean up old runs if run interactively. | |
filter Convert-DateTimeProperties { | |
$_.PSObject.Properties | ForEach-Object { | |
if ($_.Name -match 'date$|time$' -and $_.Value -is [string]) { | |
# these methods give almost the same results. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module PSParseHtml | |
function Search-Google { | |
<# | |
.SYNOPSIS | |
Search Google and return the first result(s) | |
.PARAMETER Query | |
The search query | |
.PARAMETER MaxResults | |
The maximum number of results to return |