Skip to content

Instantly share code, notes, and snippets.

@chowder
chowder / party.proto
Created November 4, 2023 22:23
RuneLite Party Proto
syntax = "proto3";
package party;
option java_package = "net.runelite.client.party";
// c->s
message Join {
int64 partyId = 1;
int64 memberId = 2;
@chowder
chowder / README.md
Last active February 21, 2023 01:49
Exporting Microsoft Authenticator TOTP secrets

Background

Workplaces may enforce TOTP 2FA to be enabled Office 365 accounts, which require the Microsoft Authenticator app to be installed.

Regular TOTP applications (such as Aegis, Authy, or LastPass) cannot be used as Microsoft uses a proprietary scheme called phonefactor. Furthermore, the application requires Google Services Framework (GSF) to be installed (likely to provide device notifications), and will refuse to work when it is not present on the device.

Forunately, after the registration is complete, the underlying mechanism the app uses to generate TOTP codes is regular otpauth, and its secrets can be exported with a little bit of effort.

Extracting the keys

@chowder
chowder / redirect.user.js
Created September 2, 2022 17:25
Privacy Alternatives
// ==UserScript==
// @name redirector
// @namespace Violentmonkey Scripts
// @match *://medium.com/*
// @match *://reddit.com/*
// @grant none
// @version 1.0
// @author -
// @description 7/30/2022, 5:34:35 PM
// ==/UserScript==
@chowder
chowder / README.md
Last active April 29, 2022 12:55
Supporting slicing for PythonExtensions in Python 3

PythonExtension

Below we have a custom 'list' PythonExtension implemented in C++:

struct DummyList : public Py::PythonExtension<DummyList>
{
    std::vector<Py::Object> items;
 
    Py::Object append(const Py::Tuple& args, const Py::Dict& keywords)
    {
@chowder
chowder / main.cpp
Created December 21, 2021 00:42
Advent of Code 2021 - Day 20 - Sparse Array
#include <iostream>
#include <unordered_set>
using namespace std;
typedef pair<int, int> Point;
struct pair_hash {
inline std::size_t operator()(const std::pair<int,int> & v) const {
return v.first * 1024 + v.second;
@chowder
chowder / main.cpp
Created December 16, 2021 22:01
Advent of Code 2021 - Day 16 - State Machine
#include <algorithm>
#include <bitset>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
enum State {
@chowder
chowder / app.py
Created May 3, 2021 17:22
Get Twitch channel redemptions via GraphQL API
import copy
import requests
import pprint
import os
GQL_URL = "https://gql.twitch.tv/gql"
GQL_QUERY = {
"operationName": "ChannelPointsContext",
"extensions": {
@chowder
chowder / RuneliteOnSteam.ps1
Created February 24, 2021 01:31
PowerShell script to patch OSRS on Steam to launch RuneLite
# Self-elevate as admin (required to make symlinks later)
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs;
Exit
}
# Find RuneLite
$RuneliteAppPath = Get-StartApps -Name RuneLite | Select -ExpandProperty AppId
/* Question (i) and (ii)
* Exploit on: Line 13 */
var x = {toString: function(){ alert("1"); return 1 }}
/* Question (iii) and (iv)
* Exploit on: Line 38 */
var x = "h4x0r";
Object.defineProperty(Array.prototype, '0', {
set: function(val) {
if (this.length == 0) { // This part is important so that the exploit is only run once