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
@ericlaw1979
ericlaw1979 / MakeItHTML.js
Created October 6, 2021 16:17
Transform XML+XSLT to plain html so that it loads without blocking (see https://textslashplain.com/2019/10/09/navigating-to-file-urls/ )
// Filenames
var sXML = "U_MS_Edge_V1R3_STIG_Manual-xccdf.xml";
var sXSLT = "STIG_unclass.xsl";
var sOutput = "TransformedHTML.html";
var fso, f, xmlstr, xsltstr;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.OpenTextFile(sXML);
@ericlaw1979
ericlaw1979 / reattachFiddlerscript.js
Last active December 19, 2023 16:42
Reattach Fiddler as system proxy if unexpectedly detached; see https://feedback.telerik.com/fiddler/1410460-the-system-proxy-was-changed-click-to-reenable-capturing for discussion.
// Click Rules > Customize Rules. Scroll to OnBoot() and inside the function add:
static function OnBoot() {
FiddlerApplication.oProxy.add_DetachedUnexpectedly(DoReattach);
//...
// Just before the OnBoot function, add the following new functions:
static function DoReattach(o: Object, ea: EventArgs) {
FiddlerObject.UI.sbpInfo.Text = "Scheduling automatic reattach at " + new Date();
@ericlaw1979
ericlaw1979 / Fiddler-JPEGify.cs
Last active November 21, 2023 16:53
Trivial Fiddler extension that converts inbound images to JPEG.
using System;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
using Fiddler;
using System.Windows.Forms;
using System.Diagnostics;
[assembly: Fiddler.RequiredVersion("2.6.2.0")]
namespace MakeJPEG
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.google.Chrome.extensions.bkbeeeffjjeopflfhgeknacdieedcoml</key>
<dict>
<key>HideProtectionToggle</key>
<true/>
<key>PreventBlockOverride</key>
<true/>
@ericlaw1979
ericlaw1979 / Immortal.cs
Created March 10, 2023 15:12
C# sample code to deny TerminateProcess rights to non-admin peers.
using System;
using System.Security.AccessControl;
using System.Security.Principal;
using System.Diagnostics;
using System.Runtime.InteropServices;
class Program
{
public class ProcessSecurity : NativeObjectSecurity {
public ProcessSecurity(SafeHandle processHandle)
@ericlaw1979
ericlaw1979 / NativeHostEcho.cc
Last active March 8, 2023 03:16
A simple Native Message Host for Chromium that echoes received messages.
/*
* This is a simple Native Message Host application. It echoes any messages
* it receives. After receiving and echoing a `{"quit":1}` message, the app
* will exit.
*/
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ericlaw1979
ericlaw1979 / Unsubscribe from all YouTube channels
Created January 19, 2023 20:25
Visit https://www.youtube.com/feed/channels and use the F12 Console tab to run this script
var i = 0;
var myVar = setInterval(myTimer, 3000);
function myTimer () {
var els = document.getElementById("grid-container").getElementsByClassName("ytd-expanded-shelf-contents-renderer");
if (i < els.length) {
@ericlaw1979
ericlaw1979 / mutz.cs
Created December 2, 2022 21:09
csc.exe mutz.cs
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace MUTZ
{
[ComImport, GuidAttribute("79EAC9EE-BAF9-11CE-8C82-00AA004BA90B")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface IInternetSecurityManager
{
@ericlaw1979
ericlaw1979 / guetzli.reg
Last active June 24, 2022 00:16
Add guetzli JPEG Optimizer to Fiddler's ImageView context menu.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Fiddler2\ImagesMenuExt\&JPEGGuetzli]
"Command"="C:\\Users\\ericlaw\\Documents\\Fiddler2\\scripts\\Tools\\guetzli_windows_x86-64.exe"
"Parameters"="{in} {out:jpg}"
"Types"="image/jpeg"
accounts_image_fetcher 98658519
adb_client_socket 87775794
affiliation_lookup_by_hash 57748571
aggregation_service_helper_keys 49783589
aggregation_service_report 95942194
ambient_client 46775600
ambient_photo_cache 72532255
ambient_photo_controller 43026447
android_device_manager_socket 37249086
android_web_socket 39356976