오너쉽을 가져오면 된다.
근데 코드를 보면 그냥 Fal1out이라는 함수를 호출하면 된다.
....? 패스
level 2 . Fal1out 코드
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import 'openzeppelin-contracts-06/math/SafeMath.sol';
contract Fallout {
using SafeMath for uint256;
mapping (address => uint) allocations;
address payable public owner;
/* constructor */
function Fal1out() public payable {
owner = msg.sender;
allocations[owner] = msg.value;
}
modifier onlyOwner {
require(
msg.sender == owner,
"caller is not the owner"
);
_;
}
function allocate() public payable {
allocations[msg.sender] = allocations[msg.sender].add(msg.value);
}
function sendAllocation(address payable allocator) public {
require(allocations[allocator] > 0);
allocator.transfer(allocations[allocator]);
}
function collectAllocations() public onlyOwner {
msg.sender.transfer(address(this).balance);
}
function allocatorBalance(address allocator) public view returns (uint) {
return allocations[allocator];
}
}
'CTF > Ethernaut' 카테고리의 다른 글
[Ethernaut] 6.Delegation (2) | 2024.01.31 |
---|---|
[Ethernaut] 5. Token (0) | 2024.01.26 |
[Ethernaut] 4. Telephone (0) | 2024.01.26 |
[Ethernaut] 3. Coin Flip (0) | 2024.01.25 |
[Ethernaut] 1. Fallback (0) | 2024.01.23 |