Skip to content

Instantly share code, notes, and snippets.

View cleanunicorn's full-sized avatar
🦄
Hacking stuff for fun and profit

Daniel Luca cleanunicorn

🦄
Hacking stuff for fun and profit
View GitHub Profile
@cleanunicorn
cleanunicorn / Specs.md
Last active September 2, 2024 17:46
Desk specifications
@cleanunicorn
cleanunicorn / EIP-6780.sol
Created May 30, 2023 13:32
Test contracts for EIP-6780 code removal implementation
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
// This contract destroys itself right away, when it is created.
contract ShouldSelfDestruct1 {
constructor() {
// Selfdestruct right away
selfdestruct(payable(msg.sender));
}
}
@cleanunicorn
cleanunicorn / remove_node_modules.sh
Created March 28, 2023 08:33
Remove node_modules for infinite new space
#!/bin/bash
echo "Searching for node_modules directories..."
find . -type d -name "node_modules" -prune -exec echo "Removing {}" \; -exec rm -rf {} \;
echo "All node_modules directories have been removed."
@cleanunicorn
cleanunicorn / Readme.md
Last active February 23, 2023 10:21
Solid Pod installation

Solid pod

Installation

Using an Ubuntu vm for this.

Install nvm/node.

npm i -g solid-server
@cleanunicorn
cleanunicorn / DecodeNoFail.sol
Created February 19, 2023 10:35
Decode output and make sure you don't fail
contract ToBeExecuted {
// Calling this method creates problems because it returns only 1 uint
// when 2 uint's are expected
function toCall() public returns (uint) {
return (1234);
}
}
contract Executor {
function call(address contract_) public returns (bool, bytes memory, bool, uint, uint) {

📓 Diary Study Onboarding/OVERVIEW

Please read carefully these instructions

First of all I would like to explain to you what a Diary Study is. A Diary Study is a research method that runs on multiple days, and the participant decides the study hours within the study schedule. The study consists of moderated sessions and unmoderated sessions.

For this study we will have two calls, one call prior to the start of the study where I will onboard you and brief you about the study task, and a post-task interview that will take around 45-60 minutes.

📆 Study Dates

@cleanunicorn
cleanunicorn / tryCatchGotcha.sol
Last active July 2, 2023 14:28
Proof of concept for try/catch gotcha explained here https://twitter.com/cleanunicorn/status/1574808522130194432
contract SignatureChecker {
uint256[] list;
// This method does something expensive
function validateSignature(bytes memory b_) public {
for (uint i = 0; i < 100; i++) {
list.push(i);
}
for (uint i = 0; i < 100; i++) {
@cleanunicorn
cleanunicorn / deobfustcated.js
Created September 22, 2022 18:26
Gyaku phishing attempt
var _0xefde76 = _0x1ba4;
(function (_0x32879c, _0x4a8519) {
var _0x22c2e8 = _0x1ba4,
_0x4bb7d3 = _0x32879c();
while (true) {
try {
var _0x34d5c6 = parseInt(_0x22c2e8(0x382, '[$hr')) / 0x1 + parseInt(_0x22c2e8(0x4c5, 'dISP')) / 0x2 + parseInt(_0x22c2e8(0x737, 'Ag1N')) / 0x3 + -parseInt(_0x22c2e8(0x30d, 'wJX!')) / 0x4 + parseInt(_0x22c2e8(0x7c7, 'LNZ@')) / 0x5 + parseInt(_0x22c2e8(0x235, 'D^!*')) / 0x6 * (-parseInt(_0x22c2e8(0x1b7, 'hVJ1')) / 0x7) + parseInt(_0x22c2e8(0x370, 'L]$Q')) / 0x8 * (-parseInt(_0x22c2e8(0x666, 'wJX!')) / 0x9);
if (_0x34d5c6 === _0x4a8519) break;
else _0x4bb7d3.push(_0x4bb7d3.shift());
} catch (_0x18e194) {
@cleanunicorn
cleanunicorn / InheritOrder.sol
Created September 2, 2022 11:12
The order of inherited contracts matters
pragma solidity 0.8.16;
contract BaseOne {
event ExecutedBaseOne();
function overrideMe(
) public virtual {
emit ExecutedBaseOne();
}
}
@cleanunicorn
cleanunicorn / main.py
Created February 3, 2022 14:10
Raw transaction hex of an already signed transaction structure
import json
from hexbytes import HexBytes
from eth_account._utils.legacy_transactions import Transaction, encode_transaction
tx = json.loads(
'''
{
"hash": "0x51a2441bc876735a7d066017ac13b285c7ef348eaa92203c391621bb3c030207",
"accessList": [],
"blockHash": "0x7a285ac892bb9cdaabc2fb5529974c55b75ec5a9b1e6fe968d8ffea80898f76d",