Skip to content

Instantly share code, notes, and snippets.

@ealmansi
ealmansi / index.html
Created March 15, 2020 11:09
mailto-bug-2020-03-15
<!-- See: https://mailto-bug-2020-03-15.glitch.me -->
<html>
<body>
<a href="">Click</a>
<p></p>
<script>
var href = "mailto:some@email.com?body=" + encodeURIComponent("abc=def");
document.getElementsByTagName("a").item(0).href = href;
document.getElementsByTagName("p").item(0).innerText = href;
</script>
@ealmansi
ealmansi / log.txt
Last active January 4, 2019 21:52
rest.bitcoin.com: wrong status code in response when broadcasting transaction.
# Invalid transaction. Response status: 200.
→ curl -X POST -v https://rest.bitcoin.com/v1/rawtransactions/sendRawTransaction/somethinginvalid
* Trying 104.20.65.160...
* TCP_NODELAY set
* Connected to rest.bitcoin.com (104.20.65.160) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
def combinations(keywords, opts):
if len(keywords) == 0:
yield []
else:
for opt in opts[keywords[0]]:
for combination in combinations(keywords[1:], opts):
yield [opt] + combination
keywords = ['a', 'b']
opts = { 'a': ['a1', 'a2'], 'b': ['b1', 'b2']}
@ealmansi
ealmansi / main.egg
Created February 1, 2018 20:22
Gaussian Elimination in Egglang
do(
define(math, import("modules/math.egg")),
define(matrix, get(math, "matrix")),
define(mset, get(math, "mset")),
define(mprint, get(math, "mprint")),
define(mreduce, get(math, "mreduce")),
# m: [
# [5, -3, 1, 14],
# [2, 3, 3, 15],
This file has been truncated, but you can view the full file.
type Ref;
type Field;
type Union = Ref;
const unique null: Ref;
type Real;
@ealmansi
ealmansi / oyente.txt
Created December 28, 2017 16:28
Oyente Sample Output
# INFO:root:Contract contracts/sol/src/v0.4.16+commit.d7661dd9/ac22a6e6d849f3d3d5de147864be1ac8c77d391c993b0184b83ee198.sol:owned:
# INFO:symExec:Running, please wait...
# INFO:symExec: ============ Results ===========
# INFO:symExec: EVM Code Coverage: 99.7%
# INFO:symExec: Parity Multisig Bug 2: False
# INFO:symExec: Callstack Depth Attack Vulnerability: False
# INFO:symExec: Transaction-Ordering Dependence (TOD): False
# INFO:symExec: Timestamp Dependency: False
# INFO:symExec: Re-Entrancy Vulnerability: False
# INFO:symExec: ====== Analysis Completed ======
@ealmansi
ealmansi / ethereum.hs
Last active December 13, 2017 22:24
Ethereum Execution Semantics Abstraction
-- WIP
-- Based on https://ethereum.github.io/yellowpaper/paper.pdf
type Byte = Integer
type Scalar = Integer
type Address = String
-- Represents the state of the blockchain at a given point in time.
-- WorldState is a total function which maps an AccountState to each
-- valid address.
@ealmansi
ealmansi / generate-ast
Created October 26, 2017 20:30
Bash Script for AST Generation
#!/usr/bin/env bash
root=$(dirname $(readlink -f $0))
src=$root/src
ast=$root/ast
if [ "$#" -ne 1 ]; then
echo "Illegal number of parameters."
echo "Sample command: ./generate-ast src/zeppelin-solidity/contracts/token/StandardToken.sol"
exit 1
@ealmansi
ealmansi / call-graph.js
Last active October 26, 2017 20:36
Solidity - Call Graph Construction
var _ = require('lodash')
var fs = require('fs')
var path = require('path')
/**
* Sample contracts: enhanced-wallet.sol (Parity Multisig Wallet hack)
* Sample query:
* Functions reachable from <entry>. Only calls to functions *not* protected by
* modifiers 'onlyowner' and 'onlymanyowners' are allowed.
* Sample output:
@ealmansi
ealmansi / modifiers.sol
Created October 19, 2017 16:58
Solidity - Modifiers.
pragma solidity ^0.4.17;
contract A {
event Before(string);
event After(string);
bool x;
bool y;
function get_x() public returns (bool) { return x; }
function set_x(bool v) public { x = v; }