Skip to content

Instantly share code, notes, and snippets.

@DragonDev1906
DragonDev1906 / multicontext.go
Created April 26, 2023 12:40
Go: create Context from multiple parents
package multichain
import (
"context"
"fmt"
"reflect"
"sync"
"time"
)
@DragonDev1906
DragonDev1906 / go-callvis_hover_highlight.js
Last active January 17, 2023 19:23
on-hover highlights for go-callvis
function highlight(selected_node) {
let others = new Set();
others.add(selected_node);
Array.from(document.getElementsByClassName("edge")).forEach((edge) => {
let parts = edge.children[0].textContent.split("->");
let from = parts[0];
let to = parts[1];
let other = (from == selected_node) ? to : (to == selected_node) ? from : null;
if (other == null) {
edge.style = "opacity: 10%";
@DragonDev1906
DragonDev1906 / tracer.go
Created October 10, 2022 13:11
Small package to find pointers to a struct that should only be pointed to within a package.
/*
Tracking where pointers to a variable end up can be difficult. This small package allows you to
record (`tracer.Add`) any pointer together with a short description (string). At a later point
you can then call Print to output all addresses which have been used by multiple packages. In
this implementation an address is not seen as used by multiple packages if theownership moves
only once and does not come back. In addition this implementation contains a filter. Only
addresses that have at least one trace in a given location (prefix) will be printed. This prefix
is additionally used to detect problematic transitions. Therefore this is not meant to detect
all such cases but can be useful when knowing only one/some packages should have a pointer to
an address.
@DragonDev1906
DragonDev1906 / UnknownOrigin.md
Created November 28, 2021 20:11
CyberSecurityRumble 2021

UnknownOrigin

The provided contract checks msg.sender != tx.origin which is the case if the call is sent from a contract. Solution is to make such a contract and call it's function:

// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.7.0 <0.9.0;

import "contracts/UnknownOrigin.sol";
import requests
from hashlib import sha256
def find_between(start, end):
params = {
"secid[$gt]": start,
"secid[$lt]": end,
}
res = requests.get("http://chal.cybersecurityrumble.de:37585/secret_share", params=params)
if res.status_code == 404:
@DragonDev1906
DragonDev1906 / find_block.py
Created March 29, 2020 13:39
Find a block in an extracted jar file (blockstate and all referenced model files) Requires the AssetLoader
import os
import json
from overviewer_core.asset_loader import AssetLoader
extracted_jar_path = "C:/Users/Jens/Documents/projects/Minecraft-Overviewer-working-dir/mc_jar_file"
blockstates_path_format = "assets/minecraft/blockstates/{0}.json"
model_path_format = "assets/minecraft/models/{0}.json"
def print_data(name, data):
print('#' * 50)
import os
from overviewer_core import texturegen
from overviewer_core.textures import Textures
"""
A way to show multiple images at the same time (up to 100 textures)
"""
from PIL import Image