Skip to content

Instantly share code, notes, and snippets.

@Enigmatic331
Enigmatic331 / gist:9d2a2eebb976a6e2c6b59ad4bed741cd
Created June 7, 2018 12:21
Draining Ethereum Accounts in Full
Private Async Sub btnClick(sender As Object, e As EventArgs) Handles btnDrain.Click
If btnDrain.Text = "Start" Then
'initialise web3
Dim web3 As Web3
web3 = New Web3("https://mainnet.infura.io/")
'get receiver address
Dim receiverAddress As String = txtReceiving.Text
'declare gas (21000 gas for a simple transaction is sufficient)
@Enigmatic331
Enigmatic331 / 50years.sol
Created July 10, 2018 10:39
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.21;
contract FiftyYearsChallenge {
struct Contribution {
uint256 amount;
uint256 unlockTimestamp;
}
Contribution[] queue;
uint256 head;
pragma solidity ^0.4.24;
library C {
function add(uint256 a, uint256 b) pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
pragma solidity ^0.4.24;
library C {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
Private Async Sub testContract()
Dim privateKey As New Nethereum.Signer.EthECKey("")
Dim account = New Nethereum.Web3.Accounts.Account(privateKey)
' ABI and bytecode of the deployed contract
Dim abi = "[{""constant"":false,""inputs"":[{""name"":""val"",""type"":""uint256""}],""name"":""callTest"",""outputs"":[],""payable"":false,""stateMutability"":""nonpayable"",""type"":""function""},{""constant"":true,""inputs"":[],""name"":""number"",""outputs"":[{""name"":"""",""type"":""uint256""}],""payable"":false,""stateMutability"":""view"",""type"":""function""},{""anonymous"":false,""inputs"":[{""indexed"":false,""name"":""sender"",""type"":""address""},{""indexed"":false,""name"":""val"",""type"":""uint256""}],""name"":""raiseMe"",""type"":""event""}]"
Dim bytecode = "0x608060405234801561001057600080fd5b50610102806100206000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634cbe9d728114604d5780638381f
pragma solidity 0.4.24;
contract mySender{
address public owner;
uint counter = 0;
constructor() public payable{
owner = msg.sender;
}
@Enigmatic331
Enigmatic331 / CTE_fiftyyears_exploitsequence.vb
Last active September 2, 2018 06:13
Exploit Sequence for Fifty Years challenge on Capture The Ether
Private Async Sub testContract()
Dim privateKey As New Nethereum.Signer.EthECKey("<enterprivatekeyhere>")
Dim account = New Nethereum.Web3.Accounts.Account(privateKey)
' ABI and bytecode of the deployed contract
Dim abi = "[{""constant"":false,""inputs"":[{""name"":""index"",""type"":""uint256""}],""name"":""withdraw"",""outputs"":[],""payable"":false,""stateMutability"":""nonpayable"",""type"":""function""},{""constant"":false,""inputs"":[{""name"":""index"",""type"":""uint256""},{""name"":""timestamp"",""type"":""uint256""}],""name"":""upsert"",""outputs"":[],""payable"":true,""stateMutability"":""payable"",""type"":""function""},{""constant"":true,""inputs"":[],""name"":""isComplete"",""outputs"":[{""name"":"""",""type"":""bool""}],""payable"":false,""stateMutability"":""view"",""type"":""function""},{""inputs"":[{""name"":""player"",""type"":""address""}],""payable"":true,""stateMutability"":""payable"",""type"":""constructor""}]"
Dim iweb3 = New Web3(account,
@Enigmatic331
Enigmatic331 / Verifying my Peepeth
Last active September 5, 2018 21:36
Verifying my Peepeth
Verifying my identity on Peepeth.com 0x8688515028955734350067695939423222009623
r = 0x69a726edfb4b802cbf267d5fd1dabcea39d3d7b4bf62b9eeaeba387606167166
# txid: 0xd79fc80e7b787802602f3317b7fe67765c14a7d40c3e0dcb266e63657f881396
s2 = 0x7724cedeb923f374bef4e05c97426a918123cc4fec7b07903839f12517e1b3c8
z2 = 0x350f3ee8007d817fbd7349c477507f923c4682b3e69bd1df5fbb93b39beb1e04
# txid: 0x061bf0b4b5fdb64ac475795e9bc5a3978f985919ce6747ce2cfbbcaccaf51009
s1 = 0x2bbd9c2a6285c2b43e728b17bda36a81653dd5f4612a2e0aefdb48043c5108de
z1 = 0x4f6a8370a435a27724bbc163419042d71b6dcbeb61c060cc6816cda93f57860c
pragma solidity ^0.4.21;
contract GuessTheNumberChallenge {
uint8 answer = 42;
function GuessTheNumberChallenge() public payable {
require(msg.value == 1 ether);
}
function isComplete() public view returns (bool) {