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 Get-Employee { | |
param( | |
[String]$Username, | |
[String]$ProxyAddressesFilter | |
) | |
If($Username) { | |
Get-ADUser -Identity $Username -Properties Department, Title, Manager, Office, LockedOut, officePhone, telephoneNumber | |
} Else { | |
Get-ADUser -Filter "proxyAddresses -like `"*$($ProxyAddressesFilter)*`"" -Properties Department, Title, Manager, Office, LockedOut, officePhone, telephoneNumber |
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
description = [[ | |
This script stores the following nmap output into a sqlite3 database: Hostname, IP, port number, protocol (tcp/udp), service, version, cpe, and OS (if it can be determined) | |
Both, database file name and table name can be passed to the script via arguments (see @args or @example), data will always be appended to an existing table. Non-existant database files or table | |
s are created during the scan. Nmap's regular output (-o) will not be modified in any way. | |
Dependencies: luasql (http://keplerproject.org/luasql) | |
For Debian-based distributions: | |
sudo apt-get install lua-sql-sqlite3 |
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
Param( | |
[String]$Raw, | |
$ASCIIColor = 'White', | |
$HexColor = 'Blue' | |
) | |
$Original = $Host.UI.RawUI.ForegroundColor | |
Write-Host "=======================" | |
$Host.UI.RawUI.ForegroundColor = $ASCIIColor |
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
$Data = [System.Collections.ArrayList]@(); ((cat .\Scan.txt | Select -Skip 1 | Select -SkipLast 1 | %{$Row = ""|Select Host,Status,Ports,OS; $Temp = $_ -Split '\t'; If(($Temp -Join ',') -notlike "*Status:*" -And ($Temp -Join ',') -like "*OS:*"){ $Row.Host = $Temp[0]; $Row.Status = ""; $Row.Ports = $Temp[1]; $Row.OS = $Temp[3]} ElseIf(($Temp -Join ',') -notlike "*Status:*"){$Row.Host = $Temp[0]; $Row.Status = ""; $Row.Ports = $Temp[1]; $Row.OS = $Temp[2]} Else {$Row.Host = $Temp[0]; $Row.Status = $Temp[1]; $Row.Ports = $Temp[2]; $Row.OS = ""}; [Void]$Data.Add($Row)})) | |
$Data |
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
# This is a customized version of the work done by jermity: https://gist.github.com/jermity/d38da10534a7a56af32d | |
# Examples: | |
# To List all available algorithms: | |
# Get-StringHash -List | |
# | |
# To hash the string using all available algorithms: | |
# 'test' | Get-StringHash -All | |
# | |
# To do the same as above, but without using the pipeline: | |
# Get-StringHash -String 'test' -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
# Examples: | |
# 'dABlAHMAdAA=' | Get-Base64DecodedString | |
# Get-Base64DecodedString 'dABlAHMAdAA=' | |
# Get-Base64DecodedString -String 'dABlAHMAdAA=' | |
Function Get-Base64DecodedString { | |
[CmdletBinding()] | |
Param( | |
[Parameter(ValueFromPipeline = $True)] | |
[String]$String | |
) |
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
# Examples: | |
# 'Test' | Get-Base64EncodedString | |
# Get-Base64EncodedString 'Test' | |
# Get-Base64EncodedString -String 'Test' | |
Function Get-Base64EncodedString { | |
[CmdletBinding()] | |
Param( | |
[Parameter(ValueFromPipeline = $True)] | |
[String]$String | |
) |
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
# Keep in mind that this will change the path for shell:personal, which may adversely affect other applications that rely on this. | |
# Use this with caution, and make sure you remember what it was set to previously so that you can revert it if needed. | |
$OldValue = Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\' -Name Personal | |
# $OldValue | |
# Personal : C:\Users\maravedi | |
# You'll want to use the %USERPROFILE% value instead of hardcoding it, just to be consistent with the other entries for this key | |
$NewValue = '%USERPROFILE%\Box' |
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
Say you have this timestamp: 2019-01-17T14:04:47.4927812 | |
Say you want to split it up in Excel (you can't use a PowerShell ALL the time, right?), then here's what I figured out. | |
Assumptions: | |
The timestamp is in the first column, and has a header. For this example, it's in cell A2. | |
To get the date: | |
=LEFT(A2,10) |
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 myFunction() { | |
var doc = DocumentApp.getActiveDocument(); | |
var selection = doc.getSelection(); | |
var ui = DocumentApp.getUi(); | |
if (!selection) { | |
ui.alert( "No current selection"); | |
} | |
else { | |
var elements = selection.getSelectedElements(); | |
for each(var element in elements) { |