Skip to content

Instantly share code, notes, and snippets.

View ericlaw1979's full-sized avatar
💭
Working on Microsoft Web Defense

Eric Lawrence ericlaw1979

💭
Working on Microsoft Web Defense
View GitHub Profile
Get-Process | Sort-Object -Unique -Property 'Name' | Select-Object -Property @(
@{
'Label' = 'Name'
'Expression' = {
$psItem.Name
}
}
@{
@mikowl
mikowl / oneliners.js
Last active March 28, 2024 20:52
👑 Awesome one-liners you might find useful while coding.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// or
const sleep = util.promisify(setTimeout);
# Map URLs to Internet Explorer Security Zones via PowerShell
$csSource = @'
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
public class IEZones
{
[req]
default_bits = 2048
default_md = sha256
string_mask = utf8only
prompt = no
encrypt_key = no
distinguished_name = @req_dn
x509_extensions = @req_ext
[req_dn]
@vcsjones
vcsjones / CustomRules.js
Last active January 5, 2018 17:35
Make Fiddler CHACHA20_POLY1305 aware.
//Add these two imports at the top of 'CustomRules.js'
import System;
import System.Reflection;
//Create or add this to the 'OnBoot' function:
static function OnBoot() : void {
var ciphersField = FiddlerApplication.Assembly.GetType("Fiddler.HTTPSClientHello").GetField("dictTLSCipherSuites", BindingFlags.NonPublic | BindingFlags.Static);
var ciphers = ciphersField.GetValue(null);
ciphers.set_Item(0xCCA8, "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256");
@joshenders
joshenders / mitmproxy.md
Last active July 23, 2023 14:49
mitmproxy configuration for iPad

Successful mitmproxy-3.7 setup tested on OS X 10.13.6 and iPhone X running 12.1.4

Enable IP forwarding and disable ICMP redirects to keep the iPad sending traffic to the proxy

sudo sysctl -w net.inet.ip.forwarding=1
sudo sysctl -w net.inet.ip.redirect=0

net.inet.ip.forwarding
Enable IP forwarding between interfaces

@aaronk6
aaronk6 / README.md
Last active November 9, 2023 05:17
launchUri

Cross-browser implementation of navigator.msLaunchUri

Microsoft’s navigator.msLaunchUri method only works in Internet Explorer on Windows 8. Therefore I came up with a (nearly) cross-browser implementation that uses the native msLaunchUri when it’s available and falls back to adventurous hacks when running in other browsers.

Description

launchUri (uri, successCallback, noHandlerCallback, unknownCallback)
@Rob--W
Rob--W / background.js
Created March 20, 2014 00:05
Implementation example of writable response bodies for Chromium extensions (API draft).
/**
* Implementation example of writable response bodies.
* Based on the draft of the Streams API (19 March 2014)
* https://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm
* Design document for response body reading/writing:
* https://docs.google.com/document/d/1iE6M-YSmPtMOsec7pR-ILWveQie8JQQXTm15JKEcUT8
*/
/* globals chrome, ByteStream, URL, XMLHttpRequest */
'use strict';