Skip to content

Instantly share code, notes, and snippets.

View mwjcomputing's full-sized avatar

Matthew Johnson mwjcomputing

View GitHub Profile
@mwjcomputing
mwjcomputing / New-Packet.ps1
Created November 14, 2012 15:39
PacketTestCode
Add-Type -Path "$env:userprofile\Documents\Development\Other Files\PacketDotNet-0.12.0\release\PacketDotNet.dll"
$sourcePort = "31623"
$destPort = "80"
$packet = New-Object PacketDotNet.TcpPacket($sourcePort,$destPort)
$sourceAddr = [System.Net.IPAddress]::Parse("10.0.0.1")
$destAddr = [System.Net.IPAddress]::Parse("10.0.1.95")
$ipPacket = New-Object PacketDotNet.IPv4Packet($sourceAddr, $destAddr)
@mwjcomputing
mwjcomputing / Send-Packet.ps1
Created November 15, 2012 14:34
Packet Fun
$Port = 80
$IPAddress = "10.0.1.95"
$Address = [System.Net.IPAddress]::Parse($IPAddress)
$EndPoint = New-Object System.Net.IPEndPoint $Address, $Port
$AddressFamily = [System.Net.Sockets.AddressFamily]::InterNetwork
$SocketType = [System.Net.Sockets.SocketType]::Dgram
$ProtocolType = [System.Net.Sockets.ProtocolType]::Udp
@mwjcomputing
mwjcomputing / Get-GitHubStatus.ps1
Created December 10, 2012 19:33
Get Github's Status
function Get-GitHubStatus {
$gitHub = Invoke-WebRequest -Uri 'https://status.github.com/api/status.json'
$gitHub | ConvertFrom-Json
}
@mwjcomputing
mwjcomputing / Search-Chrome.ps1
Last active December 11, 2015 20:08
This is an update to jwgoerlich's Search-Chrome Function.
function Search-Chrome {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[string]$Search
)
begin {
Write-Verbose -Message "Starting $($MyInvocation.Mycommand)"
@mwjcomputing
mwjcomputing / Invoke-RestMethod.ps1
Last active December 12, 2015 01:08
Adds a force switch to Invoke-RestMethod
function Invoke-RestMethod {
[CmdletBinding(HelpUri='http://go.microsoft.com/fwlink/?LinkID=217034')]
param(
[Microsoft.PowerShell.Commands.WebRequestMethod]
${Method},
[Parameter(Mandatory=$true, Position=0)]
[ValidateNotNullOrEmpty()]
[uri]
${Uri},
@mwjcomputing
mwjcomputing / IgnoreCertErrors.ps1
Created February 1, 2013 13:15
.NET command to ignore certificates in web requests.
[Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
function Set-LocalPasswords
{
param(
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
[string]$computer,
[Parameter(Mandatory=$true)]
[string]$password
)
process {
$userList = Get-WmiObject -Class Win32_UserAccount -ComputerName $computer
@mwjcomputing
mwjcomputing / Get-DaysUntilBSidesDetroit.ps1
Created February 5, 2013 21:06
Gets the number of days until BSidesDetroit.
function Get-DaysUntilBSidesDetroit {
Write-Host "There are $((New-Timespan -end '6/7/2013 9:00:00AM').Days) days until BSidesDetroit."
}
@mwjcomputing
mwjcomputing / Get-PublicIPAddress.ps1
Last active December 12, 2015 04:58
Simple one-liner to grab your public IP address.
Invoke-WebRequest 'http://myip.dnsomatic.com' | Select Content
@mwjcomputing
mwjcomputing / Get-OracleJavaVersion.ps1
Created March 1, 2013 20:10
Gets information on the version of Oracle Java that is installed.
function Get-OracleJavaVersion {
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline=$true)]
[alias("Computer")]
[string]$ComputerName = "$env:COMPUTERNAME"
)
begin{