Skip to content

Instantly share code, notes, and snippets.

View binarytrails's full-sized avatar
:octocat:
0x3a0x29

binarytrails

:octocat:
0x3a0x29
View GitHub Profile
@binarytrails
binarytrails / xor.ps1
Created October 29, 2021 19:52 — forked from gabemarshall/xor.ps1
Simple Encrypt and Decrypt with Powershell
# Not secure by any means, just a PoC for XOR'ing data using powershell
# Credit to http://stackoverflow.com/questions/3478954/code-golf-xor-encryption
$enc = [System.Text.Encoding]::UTF8
function xor {
param($string, $method)
$xorkey = $enc.GetBytes("secretkey")
if ($method -eq "decrypt"){
@binarytrails
binarytrails / snippet.cs
Created August 4, 2021 14:16 — forked from silentbreaksec/snippet.cs
Convert C# EXE to Assembly
[DllImport("shell32.dll", SetLastError = true)]
static extern IntPtr CommandLineToArgvW([MarshalAs(UnmanagedType.LPWStr)] string lpCmdLine, out int pNumArgs);
public static string[] CommandLineToArgs(string commandLine)
{
int argc;
var argv = CommandLineToArgvW(commandLine, out argc);
if (argv == IntPtr.Zero)
throw new System.ComponentModel.Win32Exception();
try
@binarytrails
binarytrails / TestAssembly.cs
Created August 4, 2021 13:35 — forked from Arno0x/TestAssembly.cs
This code shows how to load a CLR in an unmanaged process, then load an assembly from memory (not from a file) and execute a method
/*
================================ Compile as a .Net DLL ==============================
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /target:library /out:TestAssembly.dll TestAssembly.cs
*/
using System.Windows.Forms;
namespace TestNamespace
@binarytrails
binarytrails / gist:49d74a0ca9151ab262e004a45f0dfc9a
Created March 1, 2021 22:01 — forked from spudbean/gist:1558257
Look of disapproval and other emoticons
ΰ² _ΰ² 
( Ν‘Β° ΝœΚ– Ν‘Β°)
Β―\_(ツ)_/Β―
(β•―Β°β–‘Β°)β•―οΈ΅ ┻━┻
http://www.fileformat.info/convert/text/upside-down.htm
WRTTN http://wrttn.me/30dbfd/
Unicode Emoticons

Ethereum Attacks

Security for internet applications is a spectrum, and it would be safe to assume that any application might have unnoticed vulnerabilities waiting to be exploited. Cryptocurrencies are especially attractive targets for hackers: because the technology is so novel, it is more likely to be hiding bugs, and the code usually interacts with tokens that have real-world value. Ethereum is no exception.

Attackers have successfully stolen ether using a number of tactics, which tend to aim at Ethereum smart contracts (written in Solidity), the network itself, cryptocurrency exchanges, or end users.

Attacks on Smart Contracts

The DAO

@binarytrails
binarytrails / raceabrt.c
Created January 26, 2021 19:19 — forked from taviso/raceabrt.c
Race condition exploit for CVE-2015-1862
#include <stdlib.h>
#include <unistd.h>
#include <stdbool.h>
#include <stdio.h>
#include <signal.h>
#include <err.h>
#include <string.h>
#include <alloca.h>
#include <limits.h>
#include <sys/inotify.h>
@binarytrails
binarytrails / edgerouter.md
Created January 20, 2021 17:26 — forked from jperkin/edgerouter.md
OpenBSD/octeon EdgeRouter Lite

This is a nifty little device for under Β£100 suitable for a home router.

I am using one running OpenBSD 6.8 for my AAISP PPPoE connection (avoiding the supplied VMG1312-B10A which has a number of issues).

Installation

I bought a SanDisk 16GB USB stick as there were reports the supplied USB stick isn't particularly reliable, plus it's nice to keep it separate in case of backup or selling the device in the future.

Download the OpenBSD miniroot68.img file system and dd(1) it, for example on macOS (assuming /dev/disk2):

@binarytrails
binarytrails / fetch_from_cloud_logging.sh
Created December 23, 2020 16:45 — forked from dovy/fetch_from_cloud_logging.sh
It's a REAL pain to figure out how to grab the data from Google cloud logging. This script lets you grab historic data and save locally so you can process since Cloud Logging Sync's won't do anything historic.
gcloud beta logging read "resource.type=\"dataflow_step\" resource.labels.job_id=\"2018-11-13_09_13_59-6912497806535022683\" OR \"timestamp>=\\\"2018-11-12T00:00:00Z\" OR \"timing:\" timestamp<=\"2200-01-01T00:00:00.000000000Z\" timestamp<\"2018-11-20T20:20:01.065Z\"" --format=json --limit 100000 | jq -rnc --stream 'fromstream(1|truncate_stream(inputs)) | .jsonPayload.message' >> gcs.txt
@binarytrails
binarytrails / __main__.py
Created December 4, 2020 17:15 — forked from linuxluigi/__main__.py
Python __main__.py parser example
import argparse
# import data2tabshop
# from data2tabshop import __version__
__version__ = '0.1.0'
__author__ = u'Steffen Exler'
def get_parser():
@binarytrails
binarytrails / housekeeping_images.sh
Created November 23, 2020 15:42 — forked from DaanGeurts/housekeeping_images.sh
Deleting unused images from Google Container Registry, leaving x number left
#!/bin/bash
# Copyright Β© 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software